dph-prim-par-0.7.0.1: Data Parallel Haskell segmented arrays. (production version)

Safe HaskellNone

Data.Array.Parallel.Unlifted.Distributed.Primitive.DistST

Contents

Description

Distributed ST computations.

Computations of type DistST are data-parallel computations which are run on each thread of a gang. At the moment, they can only access the element of a (possibly mutable) distributed value owned by the current thread.

TODO: Add facilities for implementing parallel scans etc.

TODO:

Synopsis

Documentation

data DistST s a Source

Data-parallel computations. When applied to a thread gang, the computation implicitly knows the index of the thread it's working on. Alternatively, if we know the thread index then we can make a regular ST computation.

Instances

Primitives.

stToDistST :: ST s a -> DistST s aSource

Lifts an ST computation into the DistST monad. The lifted computation should be data parallel.

distST_ :: Comp -> Gang -> DistST s () -> ST s ()Source

Execute a data-parallel computation on a Gang. The same DistST comutation runs on each thread.

distST :: DT a => Comp -> Gang -> DistST s a -> ST s (Dist a)Source

Execute a data-parallel computation, yielding the distributed result.

runDistST :: DT a => Comp -> Gang -> (forall s. DistST s a) -> Dist aSource

Run a data-parallel computation, yielding the distributed result.

runDistST_seq :: forall a. DT a => Gang -> (forall s. DistST s a) -> Dist aSource

myIndex :: DistST s IntSource

Yields the index of the current thread within its gang.

myD :: DT a => Dist a -> DistST s aSource

Yields the Dist element owned by the current thread.

readMyMD :: DT a => MDist a s -> DistST s aSource

Yields the MDist element owned by the current thread.

writeMyMD :: DT a => MDist a s -> a -> DistST s ()Source

Writes the MDist element owned by the current thread.

Monadic combinators

mapDST_ :: DT a => What -> Gang -> (a -> DistST s ()) -> Dist a -> ST s ()Source

mapDST :: (DT a, DT b) => What -> Gang -> (a -> DistST s b) -> Dist a -> ST s (Dist b)Source

zipWithDST_ :: (DT a, DT b) => What -> Gang -> (a -> b -> DistST s ()) -> Dist a -> Dist b -> ST s ()Source

zipWithDST :: (DT a, DT b, DT c) => What -> Gang -> (a -> b -> DistST s c) -> Dist a -> Dist b -> ST s (Dist c)Source