edenskel-2.0.0.2: Semi-explicit parallel programming skeleton library

Copyright(c) Philipps Universitaet Marburg 2009-2014
LicenseBSD-style (see the file LICENSE)
Maintainereden@mathematik.uni-marburg.de
Stabilitybeta
Portabilitynot portable
Safe HaskellNone
LanguageHaskell98

Control.Parallel.Eden.Map

Contents

Description

This Haskell module defines map-like skeletons for 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

Custom map skeletons

These skeletons expose many parameters to the user and thus have varying types

parMap Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Basic parMap Skeleton - one process for each list element

ranch Source

Arguments

:: (Trans b, Trans c) 
=> (a -> [b])

input transformation function

-> ([c] -> d)

result reduction function

-> (b -> c)

worker function

-> a

input

-> d

output

A process ranch is a generalized (or super-) farm. Arbitrary input is transformed into a list of inputs for the worker processes (one worker for each transformed value). The worker inputs are processed by the worker function. The results of the worker processes are then reduced using the reduction function.

farm Source

Arguments

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

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

A farm distributes its input to a number of worker processes. The distribution function divides the input list into sublists - each sublist is input to one worker process, the number of worker processes is determined by the number of sublists. The results of the worker processes are then combined using the combination function.

Use mapFarmS or mapFarmB if you want a simpler interface.

farmS Source

Arguments

:: (Trans a, Trans b) 
=> Int

number of processes

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Like the farm, but uses a fixed round-robin distribution of tasks.

farmB Source

Arguments

:: (Trans a, Trans b) 
=> Int

number of processes

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Like the farm, but uses a fixed block distribution of tasks.

offlineFarm Source

Arguments

:: Trans b 
=> Int

number of processes

-> ([a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Offline farm (alias direct mapping): Like the farm, but tasks are evaluated inside the workers (less communication overhead). Tasks are mapped inside each generated process abstraction avoiding evaluating and sending them. This often reduces the communication overhead because unevaluated data is usually much smaller than evaluated data.

Use map_offlineFarm if you want a simpler interface.

Notice: The offline farm receives the number of processes to be created as its first parameter. The task lists structure has to be completely defined before process instantiation takes place.

offlineFarmS Source

Arguments

:: (Trans a, Trans b) 
=> Int

number of processes

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Like the offlineFarm, but with fixed round-robin distribution of tasks.

offlineFarmB Source

Arguments

:: (Trans a, Trans b) 
=> Int

number of processes

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Like the offlineFarm, but with fixed block distribution of tasks.

Custom map skeletons with explicit placement

Map skeleton versions with explicit placement

parMapAt Source

Arguments

:: (Trans a, Trans b) 
=> Places

places for instantiation

-> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Basic parMap Skeleton - one process for each list element. This version takes places for instantiation on particular PEs.

ranchAt Source

Arguments

:: (Trans b, Trans c) 
=> Places

places for instantiation

-> (a -> [b])

input transformation function

-> ([c] -> d)

result reduction function

-> (b -> c)

worker function

-> a

input

-> d

output

A process ranch is a generalized (or super-) farm. This version takes places for instantiation. Arbitrary input is transformed into a list of inputs for the worker processes (one worker for each transformed value). The worker inputs are processed by the worker function. The results of the worker processes are then reduced using the reduction function.

farmAt Source

Arguments

:: (Trans a, Trans b) 
=> Places

places for instantiation

-> ([a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

A farm distributes its input to a number of worker processes. This version takes places for instantiation. The distribution function divides the input list into sublists - each sublist is input to one worker process, the number of worker processes is determined by the number of sublists. The results of the worker processes are then combined using the combination function.

Use map_farm if you want a simpler interface.

offlineFarmAt Source

Arguments

:: Trans b 
=> Places

places for instantiation

-> Int

number of processes

-> ([a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Offline farm with explicit placement (alias self-service farm or direct mapping): Like the farm, but tasks are evaluated inside the workers (less communication overhead). Tasks are mapped inside each generated process abstraction, avoiding evaluating and sending them. This often reduces the communication overhead because unevaluated data is usually much smaller than evaluated data.

Use map_offlineFarm if you want a simpler interface.

Notice: The task lists structure has to be completely defined before process instantiation takes place.

Simple map skeleton variants

The map skeletons farm and offlineFarm can be used to define skeletons with the simpler sequential map interface :: (a -> b) -> [a] -> [b]

mapFarmB Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Parallel map variant with map interface using (max (noPe-1) 1) worker processes. Skeletons ending on S use round-robin distribution, skeletons ending on B use block distribution of tasks.

mapFarmS Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Parallel map variant with map interface using (max (noPe-1) 1) worker processes. Skeletons ending on S use round-robin distribution, skeletons ending on B use block distribution of tasks.

mapOfflineFarmS Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Parallel map variant with map interface using (max (noPe-1) 1) worker processes. Skeletons ending on S use round-robin distribution, skeletons ending on B use block distribution of tasks.

mapOfflineFarmB Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Parallel map variant with map interface using (max (noPe-1) 1) worker processes. Skeletons ending on S use round-robin distribution, skeletons ending on B use block distribution of tasks.

Deprecated map skeletons

These skeletons are included to keep old code alive. Use the skeletons above.

farmClassic Source

Arguments

:: (Trans a, Trans b) 
=> Int

number of child processes

-> (Int -> [a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Deprecated: better use farm instead

Deprecated, use the farm; farmClassic distributes its input to a number of worker processes. This is the Classic version as described in the Eden standard reference "Parallel Functional Programming in Eden". The distribution function is expected to divide the input list into the given number of sublists. In the new farm the number of sublists is determined only by the distribution function.

Use map_farm if you want a simpler interface.

ssf Source

Arguments

:: forall a b . Trans b 
=> Int

number of child processes

-> (Int -> [a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Deprecated: better use offlineFarm instead

Deprecated, use offlineFarm; Self service farm. Like the farm, but tasks are evaluated in the workers (less communication overhead). This is the classic version. The distribution function is expected to divide the input list into the given number of sublists. In the new self service farm the number of sublists is determined only by the distribution function.

Use map_ssf if you want a simpler interface.

Notice: The task lists structure has to be completely defined before process instantiation takes place.

offline_farm Source

Arguments

:: Trans b 
=> Int

number of processes

-> ([a] -> [[a]])

input distribution function

-> ([[b]] -> [b])

result combination function

-> (a -> b)

mapped function

-> [a]

input

-> [b]

output

Deprecated: better use offlineFarm instead

Deprecated: Same as offlineFarm.

map_par Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Deprecated: better use parMap instead

Deprecated: Same as parMap.

map_farm Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Deprecated: better use mapFarmS or mapOfflineFarmS instead

Deprecated: Parallel map variants with map interface using noPe worker processes.

map_offlineFarm Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Deprecated: better use mapFarmS or mapOfflineFarmS instead

Deprecated: Parallel map variants with map interface using noPe worker processes.

map_ssf Source

Arguments

:: (Trans a, Trans b) 
=> (a -> b)

worker function

-> [a]

task list

-> [b]

result list

Deprecated: better use mapFarmS or mapOfflineFarmS instead

Deprecated: Parallel map variants with map interface using noPe worker processes.