Safe Haskell | None |
---|
Module with the internal workhorse for the library, parallelTasks
. You only
need to use this module if you want to alter ExtendedParTaskOpts
, which allows
you to redirect the logging output or store information about task timing.
- data ExtendedParTaskOpts m a = ExtendedParTaskOpts {
- coreOpts :: ParTaskOpts m a
- printTo :: forall r. (Handle -> IO r) -> IO r
- afterFinish :: Double -> Int -> TaskOutcome -> IO (Maybe String)
- data ParTaskOpts m a = ParTaskOpts {
- simpleOpts :: SimpleParTaskOpts
- wrapWorker :: forall r. m (m r -> IO r)
- timeLimit :: Maybe (Integer, a)
- data SimpleParTaskOpts = SimpleParTaskOpts {}
- data TaskOutcome
- = Success
- | TookTooLong
- defaultExtendedParTaskOpts :: MonadIO m => ParTaskOpts m a -> ExtendedParTaskOpts m a
- defaultParTaskOpts :: ParTaskOpts IO a
- parallelTasks :: MonadIO m => ExtendedParTaskOpts m a -> [m a] -> m (IOVector a)
Documentation
data ExtendedParTaskOpts m a Source
Advanced options controlling the behaviour of parallel tasks. The m
parameter
is the monad that the tasks execute in, the a
parameter is the output value of the
tasks, and the b
parameter is the type that is stored in the results array. It is
common that either b = a
or b = Maybe a
.
ExtendedParTaskOpts | |
|
data ParTaskOpts m a Source
Options controlling the general running of parallel tasks. The m
parameter is the monad (which must be an instance
of MonadIO
) in which the tasks will be run, and the a
parameter is the return value of the tasks.
ParTaskOpts | |
|
data SimpleParTaskOpts Source
SimpleParTaskOpts | |
|
data TaskOutcome Source
Value indicating whether a task successfully completed, or was killed off for taking too long
defaultExtendedParTaskOpts :: MonadIO m => ParTaskOpts m a -> ExtendedParTaskOpts m aSource
Default extended options. Prints messages to stderr, and writes a message when a task is killed
defaultParTaskOpts :: ParTaskOpts IO aSource
Default parallel task options. The number of workers defaults to the number of capabilities, with no time limit, and printing progress every 50 tasks and an estimated time every 200
parallelTasks :: MonadIO m => ExtendedParTaskOpts m a -> [m a] -> m (IOVector a)Source
Runs the given set of computations in parallel, and once they are all finished, returns their results. Note that they won't all be run in parallel from the start; rather, a set of workers will be spawned that work their way through the (potentially large) set of jobs.