ConcurrentUtils-0.4.4.0: Concurrent utilities

Safe HaskellSafe
LanguageHaskell98

Control.CUtils.DataParallel

Contents

Description

An implementation of nested data parallelism (due to Simon Peyton Jones et al)

Synopsis

Flattenable arrays

data ArrC t Source

Instances

newArray :: [e] -> Array Int e Source

The arrows and associated operations

data Structural a t u Source

Instances

data A a t u Source

The A arrow includes a set of primitives that may be executed concurrently. Programs are incrementally optimized as they are put together. A program may be optimized once, and the result saved for repeated use.

Notes:

  • The exact output of the optimizer is subject to change.
  • The program must be a finite data structure, or optimization will diverge.

unA :: Category * t => A t t1 t2 -> Structural t t1 t2 Source

Obtain a Structural program from an A program.

mapA' :: ArrowChoice a => A a t u -> A a (ArrC t) (ArrC u) Source

liftA :: Category a => a t u -> A a t u Source

countA :: A a (t, Int) (ArrC (t, Int)) Source

Supplies an array of a repeated value paired with the index of each element.

indexA :: A a (ArrC u, Int) u Source

Access one index of an array.

zipA :: Category a => A a (ArrC t, ArrC u) (ArrC (t, u)) Source

An operation analogous to zip.

unzipA :: Category a => A a (ArrC (t, u)) (ArrC t, ArrC u) Source

unzipA and zipA are inverses.

concatA :: Category a => A a (ArrC (ArrC t)) (ArrC t) Source

eval :: (ArrowChoice a, Strict a, Concurrent a) => Structural a t u -> a t u Source

Evaluates arrows.

Notes:

  • Effects are supported, but with much weaker semantics than the Kleisli arrows of the monad. In particular, the Map and *** operations are allowed to be parallelized, but on the other hand parallelism is not guaranteed.

Examples

nQueens :: Int -> A (->) () (ArrC [Int]) Source

sorting :: Ord t => Int -> A (->) (ArrC t) (ArrC t) Source