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

Safe HaskellNone

Data.Array.Parallel.Unlifted.Distributed.Data.Scalar

Description

Distribution of values of primitive types.

Synopsis

Documentation

class DT a whereSource

Class of distributable types. Instances of DT can be distributed across all workers of a Gang. All such types must be hyperstrict as we do not want to pass thunks into distributed computations.

Associated Types

data Dist a Source

data MDist a :: * -> *Source

Methods

indexD :: String -> Dist a -> Int -> aSource

Extract a single element of an immutable distributed value.

newMD :: Gang -> ST s (MDist a s)Source

Create an unitialised distributed value for the given Gang. The gang is used (only) to know how many elements are needed in the distributed value.

readMD :: MDist a s -> Int -> ST s aSource

Extract an element from a mutable distributed value.

writeMD :: MDist a s -> Int -> a -> ST s ()Source

Write an element of a mutable distributed value.

unsafeFreezeMD :: MDist a s -> ST s (Dist a)Source

Unsafely freeze a mutable distributed value.

deepSeqD :: a -> b -> bSource

Ensure a distributed value is fully evaluated.

sizeD :: Dist a -> IntSource

Number of elements in the distributed value.

  • For debugging only, as code shouldn't be sensitive to the return value.

sizeMD :: MDist a s -> IntSource

Number of elements in the mutable distributed value.

  • For debugging only, as code shouldn't be sensitive to the return value.

measureD :: a -> StringSource

Show a distributed value.

  • For debugging only.

Instances

DT Bool 
DT Char 
DT Double 
DT Float 
DT Int 
DT Integer 
DT Ordering 
DT Word8 
DT () 
DT UVSegd 
DT USSegd 
DT USegd 
DT a => DT (Maybe a) 
Unbox a => DT (Vector a) 
(DT a, DT b) => DT (a, b) 
(DT a, DT b, DT c) => DT (a, b, c) 

scalarD :: DT a => Gang -> a -> Dist aSource

Distribute a scalar. Each thread gets its own copy of the same value. Example: scalarD theGangN4 10 = [10, 10, 10, 10]

sumD :: (Num a, DT a) => Gang -> Dist a -> aSource

Sum all instances of a distributed number.