Safe Haskell | None |
---|

Distribution of values of primitive types.

- class Unbox e => DPrim e where
- primIndexD :: DPrim a => String -> Dist a -> Int -> a
- primNewMD :: DPrim a => Gang -> ST s (MDist a s)
- primReadMD :: DPrim a => MDist a s -> Int -> ST s a
- primWriteMD :: DPrim a => MDist a s -> Int -> a -> ST s ()
- primUnsafeFreezeMD :: DPrim a => MDist a s -> ST s (Dist a)
- primSizeD :: DPrim a => Dist a -> Int
- primSizeMD :: DPrim a => MDist a s -> Int

# Documentation

class Unbox e => DPrim e whereSource

For distributed primitive values, we can just store all the members in a vector. The vector has the same length as the number of threads in the gang.

mkDPrim :: Vector e -> Dist eSource

Make an immutable distributed value.

unDPrim :: Dist e -> Vector eSource

Unpack an immutable distributed value back into a vector.

mkMDPrim :: STVector s e -> MDist e sSource

Make a mutable distributed value.

unMDPrim :: MDist e s -> STVector s eSource

Unpack a mutable distributed value back into a vector.

primIndexD :: DPrim a => String -> Dist a -> Int -> aSource

Get the member corresponding to a thread index.

primNewMD :: DPrim a => Gang -> ST s (MDist a s)Source

Create a new distributed value, having as many members as threads
in the given `Gang`

.

primReadMD :: DPrim a => MDist a s -> Int -> ST s aSource

Read the member of a distributed value corresponding to the given thread index.

primWriteMD :: DPrim a => MDist a s -> Int -> a -> ST s ()Source

Write the member of a distributed value corresponding to the given thread index.

primUnsafeFreezeMD :: DPrim a => MDist a s -> ST s (Dist a)Source

Freeze a mutable distributed value to an immutable one. You promise not to update the mutable one any further.

primSizeD :: DPrim a => Dist a -> IntSource

Get the size of a distributed value, that is, the number of threads in the gang that it was created for.

primSizeMD :: DPrim a => MDist a s -> IntSource

Get the size of a distributed mutable value, that is, the number of threads in the gang it was created for.