edenskel-2.0.0.2: Semi-explicit parallel programming skeleton library

Copyright (c) Philipps Universitaet Marburg 2009-2014 BSD-style (see the file LICENSE) eden@mathematik.uni-marburg.de beta not portable None Haskell98

Control.Parallel.Eden.Auxiliary

Description

This Haskell module defines auxiliary functions for programming with the parallel functional language Eden.

Depends on GHC. Using standard GHC, you will get a threaded simulation of Eden. Use the forked GHC-Eden compiler from http://www.mathematik.uni-marburg.de/~eden for a parallel build.

Eden Group ( http://www.mathematik.uni-marburg.de/~eden )

Synopsis

# Distribution and combine functions

... of form: ` Int -> [a] -> [[a]] ` / ` [[a]] -> [a] `

Arguments

 :: Int number of sublists -> [a] input list -> [[a]] distributed output

Round robin distribution - inverse to shuffle

Arguments

 :: [[a]] sublists -> [a] shuffled sublists

Simple shuffling - inverse to round robin distribution

Arguments

 :: Int number of blocks -> [a] list to be split -> [[a]] list of blocks

Block distribution, ` splitIntoN ` distributes one list on n lists with equal distribution ((+-1) without precondition on length).

Arguments

 :: [[a]] list of blocks -> [a] restored list

Inverse function to ` splitIntoN ` - alias for concat.

Arguments

 :: Int ` d `: chunk-length -> [a] list to be split -> [[a]] list of chunks (blocks)

Creates a list of chunks of length ` d` .

Result: list of chunks (blocks)

Arguments

 :: [[a]] list of chunks -> [a] restored list

Inverse function to ` chunk ` - alias for concat.

# Distribution function for workpools

Arguments

 :: Int number of workers -> [Int] request stream (worker IDs ranging from 0 to n-1) -> [t] task list -> [[t]] task distribution, each inner list for one worker

Task distribution according to worker requests.

# Lazy functions

lazy :: [a] -> [a] Source

A lazy list is an infinite stream

lazy1ZipWith :: (a -> b -> c) -> [a] -> [b] -> [c] Source

lazy in first argument

lazy2ZipWith :: (a -> b -> c) -> [a] -> [b] -> [c] Source

lazy in second argument

lazy1Zip :: [a] -> [b] -> [(a, b)] Source

lazy in first argument

lazy2Zip :: [a] -> [b] -> [(a, b)] Source

lazy in second argument

lazyTranspose :: [[a]] -> [[a]] Source

lazy in tail lists

# other useful functions

takeEach :: Int -> [a] -> [a] Source

transposeRt :: [[a]] -> [[a]] Source

transpose for matrices of rectangular shape (rows of equal length). Top level list of the resulting matrix is defined as soon as the first row of the original matrix is closed.

# unLiftRDs

Arguments

 :: (Trans a, Trans b) => (RD a -> RD b) Function to be unlifted -> a input -> b output

Arguments

 :: (Trans a, Trans b, Trans c) => (RD a -> RD b -> RD c) Function to be unlifted -> a First input -> b Second input -> c output

see `liftRD`

unLiftRD3 :: (Trans a, Trans b, Trans c, Trans d) => (RD a -> RD b -> RD c -> RD d) -> a -> b -> c -> d Source

see `liftRD`

unLiftRD4 :: (Trans a, Trans b, Trans c, Trans d, Trans e) => (RD a -> RD b -> RD c -> RD d -> RD e) -> a -> b -> c -> d -> e Source

see `liftRD`

# More predefined Parallel Actions

spawnPss :: (Trans a, Trans b) => [[Process a b]] -> [[a]] -> [[b]] Source

Spawn a matrix of processes

fetch2 :: (Trans a, Trans b) => RD a -> RD b -> (a, b) Source

Fetch two Remote Data values

fetchRDss :: Trans a => [[RD a]] -> [[a]] Source

Fetch a matrix of Remote Data

mergeS :: [[a]] -> Strategy a -> [a] Source

A variant of non-deterministic list merging, which applies a strategy to list elements prior to merging them and stops the additional merge thread (the suckIO_S thread) when only one input stream is left.