dph-prim-par-0.4.0: Parallel Primitives for Data-Parallel Haskell.Source codeContentsIndex
Data.Array.Parallel.Unlifted.Distributed
Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Contents
Gang operations
Gang hacks
Distributed types and classes
Higher-order combinators
Equality
Distributed scalars
Distributed pairs
Distributed arrays
Permutations
Debugging
Description
Distributed types and operations.
Synopsis
data Gang
forkGang :: Int -> IO Gang
gangSize :: Gang -> Int
sequentialGang :: Int -> Gang
seqGang :: Gang -> Gang
theGang :: Gang
class DT a where
data Dist a
mapD :: (DT a, DT b) => Gang -> (a -> b) -> Dist a -> Dist b
zipWithD :: (DT a, DT b, DT c) => Gang -> (a -> b -> c) -> Dist a -> Dist b -> Dist c
foldD :: DT a => Gang -> (a -> a -> a) -> Dist a -> a
scanD :: DT a => Gang -> (a -> a -> a) -> a -> Dist a -> Dist a :*: a
eqD :: (Eq a, DT a) => Gang -> Dist a -> Dist a -> Bool
neqD :: (Eq a, DT a) => Gang -> Dist a -> Dist a -> Bool
scalarD :: DT a => Gang -> a -> Dist a
andD :: Gang -> Dist Bool -> Bool
orD :: Gang -> Dist Bool -> Bool
sumD :: (Num a, DT a) => Gang -> Dist a -> a
zipD :: (DT a, DT b) => Dist a -> Dist b -> Dist (a :*: b)
unzipD :: (DT a, DT b) => Dist (a :*: b) -> Dist a :*: Dist b
fstD :: (DT a, DT b) => Dist (a :*: b) -> Dist a
sndD :: (DT a, DT b) => Dist (a :*: b) -> Dist b
lengthD :: UA a => Dist (UArr a) -> Dist Int
splitLenD :: Gang -> Int -> Dist Int
splitLengthD :: UA a => Gang -> UArr a -> Dist Int
splitD :: UA a => Gang -> Distribution -> UArr a -> Dist (UArr a)
splitAsD :: UA a => Gang -> Dist Int -> UArr a -> Dist (UArr a)
joinLengthD :: UA a => Gang -> Dist (UArr a) -> Int
joinD :: UA a => Gang -> Distribution -> Dist (UArr a) -> UArr a
splitJoinD :: (UA a, UA b) => Gang -> (Dist (UArr a) -> Dist (UArr b)) -> UArr a -> UArr b
splitSegdD :: Gang -> USegd -> Dist USegd
splitSD :: UA a => Gang -> Dist USegd -> UArr a -> Dist (UArr a)
lengthUSegdD :: Dist USegd -> Dist Int
lengthsUSegdD :: Dist USegd -> Dist (UArr Int)
indicesUSegdD :: Dist USegd -> Dist (UArr Int)
elementsUSegdD :: Dist USegd -> Dist Int
data Distribution
balanced :: Distribution
unbalanced :: Distribution
permuteD :: UA a => Gang -> Dist (UArr a) -> Dist (UArr Int) -> UArr a
bpermuteD :: UA a => Gang -> UArr a -> Dist (UArr Int) -> Dist (UArr a)
atomicUpdateD :: UA a => Gang -> Dist (UArr a) -> Dist (UArr (Int :*: a)) -> UArr a
fromD :: DT a => Gang -> Dist a -> [a]
toD :: DT a => Gang -> [a] -> Dist a
Gang operations
data Gang Source
A Gang is a either group of threads which execute arbitrary work requests. A sequential Gang simulates such a group by executing work requests sequentially.
show/hide Instances
forkGang :: Int -> IO GangSource
Fork a Gang with the given number of threads (at least 1).
gangSize :: Gang -> IntSource
The number of threads in the Gang.
sequentialGang :: Int -> GangSource
Yield a sequential Gang which simulates the given number of threads.
seqGang :: Gang -> GangSource
Yield a sequential Gang which simulates the given one.
Gang hacks
theGang :: GangSource
Distributed types and classes
class DT a Source

Distributed types ----------------------------

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
Methods
show/hide Instances
DT Bool
DT Char
DT Double
DT Float
DT Int
DT Word8
DT ()
DT USegd
DT a => DT (MaybeS a)
UA a => DT (UArr a)
(DT a, DT b) => DT (:*: a b)
Higher-order combinators
mapD :: (DT a, DT b) => Gang -> (a -> b) -> Dist a -> Dist bSource
Map a function over a distributed value.
zipWithD :: (DT a, DT b, DT c) => Gang -> (a -> b -> c) -> Dist a -> Dist b -> Dist cSource
Combine two distributed values with the given function.
foldD :: DT a => Gang -> (a -> a -> a) -> Dist a -> aSource
Fold a distributed value.
scanD :: DT a => Gang -> (a -> a -> a) -> a -> Dist a -> Dist a :*: aSource
Prefix sum of a distributed value.
Equality
eqD :: (Eq a, DT a) => Gang -> Dist a -> Dist a -> BoolSource
Test whether to distributed values are equal. This requires a Gang and hence can't be defined in terms of Eq.
neqD :: (Eq a, DT a) => Gang -> Dist a -> Dist a -> BoolSource
Test whether to distributed values are not equal. This requires a Gang and hence can't be defined in terms of Eq.
Distributed scalars
scalarD :: DT a => Gang -> a -> Dist aSource
Distribute a scalar.
andD :: Gang -> Dist Bool -> BoolSource
orD :: Gang -> Dist Bool -> BoolSource
sumD :: (Num a, DT a) => Gang -> Dist a -> aSource
Distributed pairs
zipD :: (DT a, DT b) => Dist a -> Dist b -> Dist (a :*: b)Source
Pairing of distributed values. The two values must belong to the same Gang.
unzipD :: (DT a, DT b) => Dist (a :*: b) -> Dist a :*: Dist bSource
Unpairing of distributed values.
fstD :: (DT a, DT b) => Dist (a :*: b) -> Dist aSource
Extract the first elements of a distributed pair.
sndD :: (DT a, DT b) => Dist (a :*: b) -> Dist bSource
Extract the second elements of a distributed pair.
Distributed arrays
lengthD :: UA a => Dist (UArr a) -> Dist IntSource
Yield the distributed length of a distributed array.
splitLenD :: Gang -> Int -> Dist IntSource
Distribute the given array length over a Gang.
splitLengthD :: UA a => Gang -> UArr a -> Dist IntSource
Distribute the length of an array over a Gang.
splitD :: UA a => Gang -> Distribution -> UArr a -> Dist (UArr a)Source
Distribute an array over a Gang.
splitAsD :: UA a => Gang -> Dist Int -> UArr a -> Dist (UArr a)Source
Distribute an array over a Gang such that each threads gets the given number of elements.
joinLengthD :: UA a => Gang -> Dist (UArr a) -> IntSource
Overall length of a distributed array.
joinD :: UA a => Gang -> Distribution -> Dist (UArr a) -> UArr aSource
Join a distributed array.
splitJoinD :: (UA a, UA b) => Gang -> (Dist (UArr a) -> Dist (UArr b)) -> UArr a -> UArr bSource
splitSegdD :: Gang -> USegd -> Dist USegdSource
splitSD :: UA a => Gang -> Dist USegd -> UArr a -> Dist (UArr a)Source
lengthUSegdD :: Dist USegd -> Dist IntSource
lengthsUSegdD :: Dist USegd -> Dist (UArr Int)Source
indicesUSegdD :: Dist USegd -> Dist (UArr Int)Source
elementsUSegdD :: Dist USegd -> Dist IntSource
data Distribution Source
balanced :: DistributionSource
unbalanced :: DistributionSource
Permutations
permuteD :: UA a => Gang -> Dist (UArr a) -> Dist (UArr Int) -> UArr aSource
Permute for distributed arrays.
bpermuteD :: UA a => Gang -> UArr a -> Dist (UArr Int) -> Dist (UArr a)Source
atomicUpdateD :: UA a => Gang -> Dist (UArr a) -> Dist (UArr (Int :*: a)) -> UArr aSource
Debugging
fromD :: DT a => Gang -> Dist a -> [a]Source

Yield all elements of a distributed value.

NOTE: Debugging only.

toD :: DT a => Gang -> [a] -> Dist aSource

Generate a distributed value from the first p elements of a list.

NOTE: Debugging only.

Produced by Haddock version 2.6.1