- type Par = ParM RTS
- runParIO_ :: RTSConf -> Par () -> IO ()
- runParIO :: RTSConf -> Par a -> IO (Maybe a)
- done :: Par a
- myNode :: Par NodeId
- allNodes :: Par [NodeId]
- io :: IO a -> Par a
- eval :: a -> Par a
- force :: NFData a => a -> Par a
- fork :: Par () -> Par ()
- spark :: Closure (Par ()) -> Par ()
- pushTo :: Closure (Par ()) -> NodeId -> Par ()
- new :: Par (IVar a)
- put :: IVar a -> a -> Par ()
- get :: IVar a -> Par a
- tryGet :: IVar a -> Par (Maybe a)
- probe :: IVar a -> Par Bool
- glob :: IVar (Closure a) -> Par (GIVar (Closure a))
- rput :: GIVar (Closure a) -> Closure a -> Par ()
- data NodeId
- data IVar a
- data GIVar a
- at :: GIVar a -> NodeId
- module Control.Parallel.HdpH.Closure
- module Control.Parallel.HdpH.Conf
- declareStatic :: StaticDecl
HdpH (Haskell distributed parallel Haskell) is a Haskell DSL for shared- and distributed-memory parallelism, implemented entirely in Haskell (as supported by the GHC). HdpH is described in the following paper:
P. Maier, P. W. Trinder. Implementing a High-level Distributed-Memory Parallel Haskell in Haskell. IFL 2011.
HdpH executes programs written in a monadic embedded DSL for shared-
and distributed-memory parallelism.
HdpH operates a distributed runtime system, scheduling tasks
either explicitly (controled by the DSL) or implicitly (by work stealing).
The runtime system distinguishes between nodes and schedulers.
A node is an OS process running HdpH (that is, a GHC-compiled executable
built on top of the HdpH library), whereas a scheduler is a Haskell IO
thread executing HdpH expressions (that is,
Par monad computation).
As a rule of thumb, a node should correspond to a machine in a network,
and a scheduler should correspond to a core in a machine.
The semantics of HdpH was developed with fault tolerance in mind (though this version of HdpH is not yet fault tolerant). In particular, HdpH allows the replication computations, and the racing of computations against each other. The price to pay for these features is that HdpH cannot enforce determinism.
Par is the monad for parallel computations in HdpH.
It is a continuation monad, similar to the one described in paper
A monad for deterministic parallelism
by S. Marlow, R. Newton, S. Peyton Jones (Haskell 2011).
Par monad by executing the given parallel computation
including setting up and initialising a distributed runtime system
according to the configuration parameter
This function lives in the IO monad because
p may be impure,
p may exhibit non-determinism.
Caveat: Though the computation
p will only be started on a single root
runParIO_ must be executed on every node of the distributed runtime
system du to the SPMD nature of HdpH.
Note that the configuration parameter
conf applies to all nodes uniformly;
at present there is no support for heterogeneous configurations.
Operations in the Par monad
These operations form the HdpH DSL, a low-level API of for parallel programming across shared- and distributed-memory architectures. For a more high-level API see module Control.Parallel.HdpH.Strategies.
Returns a list of all nodes currently forming the distributed runtime system.
Evaluates its argument to normal form (as defined by
Creates a spark, to be available for work stealing. The spark may be converted into a thread and executed locally, or it may be stolen by another node and executed there.
Pushes a computation to the given node, where it is eagerly converted into a thread and executed.
Reads from given IVar; does not block but returns
Nothing if IVar empty.
Globalises given IVar, returning a globally unique handle;
this operation is restricted to IVars of
Writes to (possibly remote) IVar denoted by given global handle;
this operation is restricted to write valueso of
Local and global IVars
A GIVar (short for global IVar) is a globally unique handle referring
to an IVar.
Unlike IVars, GIVars can be compared and serialised.
They can also be written to remotely by the operation
Returns the node hosting the IVar referred to by the given GIVar. This function being pure implies that IVars cannot migrate between nodes.
Runtime system configuration
This module's Static declaration
Static declaration of Static deserialisers used in explicit Closures created or imported by this module. This Static declaration must be imported by every main module using HdpH. The imported Static declaration must be combined with the main module's own Static declaration and registered; failure to do so may abort the program at runtime.