abstract-par-accelerate-0.3: Provides the class ParAccelerate, nothing more.

Safe HaskellSafe-Infered




The Class

class ParFuture iv p => ParAccelerate iv p where

A class containing Accelerate-specific Par operations.


runAcc :: Arrays a => Acc a -> p a

Run an Accelerate computation and wait for its result. In the context of a Par computation this can result in better performance than using an Accelerate-provided run function directly, because this version enables the CPU work scheduler to do other work while waiting for the GPU computation to complete.

Moreover, when configured with a high-performance CPU Accelerate backend in the future this routine can enable automatic CPU/GPU work partitioning.

spawnAcc :: Arrays a => Acc a -> p (iv a)

Like runAcc but runs the Accelerate computation asynchronously.

spawnAccWith :: Arrays a => (Acc a -> a) -> Acc a -> p (iv a)

unsafeHybrid :: Arrays b => (b -> a) -> (p a, Acc b) -> p (iv a)

Spawn an computation which may execute either on the CPU or GPU based on runtime load. The CPU and GPU implementations may employ completely different algorithms; this is an UNSAFE operation which will not guarantee determinism unless the user ensures that the result of both computations is always equivalent.

A common application of unsafeHybrid is the following:

 unsafeHybrid Data.Array.Accelerate.IO.toVector

Example applications of unsafeHybrid

unsafeHybridVector :: (Storable a, Elt a, BlockPtrs (EltRepr a) ~ ((), Ptr a), ParAccelerate iv p) => (p (Vector a), Acc (Array DIM1 a)) -> p (iv (Vector a))

An example application of unsafeHybrid for vectors.

unsafeHybridIArray :: (EltRepr ix ~ EltRepr sh, IArray a e, Ix ix, Shape sh, Elt ix, Elt e, ParAccelerate iv p) => (p (a ix e), Acc (Array sh e)) -> p (iv (a ix e))

An example application of unsafeHybrid for any IArray type.