úÎTÚPH      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG Safe-Infered H    H Safe-Infered:dbgTaggedMsg is our routine for logging debugging output: " is for printing a small tag like I (with no line B termination) which produces a different kind of visual output. 0 dbgCharMsg :: Int -> String -> String -> IO () NoneCapability number The J+s of all worker threads on this capability  The local K& for this worker. The worker may push " and pop from the left of its own , but workers on . other threads may only steal from the right. A L for random work stealing. !8A counter of how many extra workers are working on this : capability. This situation arises during nested calls to  51, and the worker loop kills workers as necessary  to keep this value at 1. "7Tracks the number of consecutive times this worker has  invoked a ) and received M. This is used  to implement backoff in    . #.A per-thread source of unique identifiers for  0s. Multiply this value by N and add   for uniqueness. $The ) of this worker' s associated %. %A %4 provides an abstraction of heterogeneous execution & resources, and may be combined using    C operations. Composition of resources is left-biased; for example,  if  resource1 always returns work from its ), the  composed resource  resource1 O resource2 will never  request work from  resource2. )The ) component of a % is a callback that D responds to requests for work from Meta-Par workers. The arguments  to ) are the  for the current thread and a  thread-safe reference to the /. ,The , component of a % is a callback that : implements initialization behavior. For example, the SMP ,  calls 3% a number of times. The arguments to  , are the combined % of the current scheduler and  a thread-safe reference to the /. /A /, structure tracks the state of all Meta-Par  workers in a program in a    indexed by capability  number. 0An 0 is a  write-once,  read-many structure for  communication between 1 threads. 1?The Meta-Par monad with its full suite of instances. Note that  the P, instance, while essential for building new  %/s, is unsafe in client code when combined with  57. This type should therefore be exposed to client code  as a newtype that omits the P instance. 2Produces a variant of Q# that allows exceptions from child / threads to propagate up to the parent thread. 3>Spawn a Meta-Par worker that will stay on a given capability. ?Note: this does not check whether workers already exist on the C capability, and should be called appropriately. In particular, it  is the caller'+s responsibility to manage things like the mortal  count of the given capability. 4Run a 1 computation in the R monad, allowing < non-deterministic Meta-Par variants to be safely executed. 5Run a 1. computation, and return its result as a pure  value. If the choice of %! introduces non-determinism, use  44 instead, as non-deterministic computations are not  referentially-transparent. $ !"#$%&'()*+,-./012 The basic Q implementation .A name for the child thread in error messages 3The ) called by the new worker  Capability 45STUVWXYZ['  !"#$%&'()*+,-./012345'10 54 !"#$/%&'(,-.)*+23  !"#$%&'()*+,-./012345STUVWXYZ[ Safe-Infered6.Create an SMP resource for all capabilities. 7@Create an SMP resource for a configurable list of capabilities. 8,5 for spawning threads on all capabilities, or from a  \=-able list of capability numbers in the environment variable  SMP_CAPS. 9,2 for spawning threads only on a particular set of  capabilities. :) for all capabilities. ;BGiven a set of capabilities and a number of steals to attempt per  capability, return a ). 6!The number of steal attempts per ) call. 7Capability list. !The number of steal attempts per ) call. 89:;6789:;678:9;6789:; Trustworthy<4The Meta-Par monad specialized for SMP parallelism. <=> 0<=><0 =><=> Safe-Infered?#Create a single-threaded resource. @ Spawn a single Meta-Par worker. A?A single-threaded resource by itself is not aware of any other  sources of work, so its ) always returns M. ?@A?@A?@A?@A TrustworthyB>The Meta-Par monad specialized for single-threaded execution. BCD BCDB CDBCD Safe-InferedG:To construct a WorkSearch we need to know the minimum and A maximum amount of time (nanoseconds) to sleep. The exponential B backoff policy is always the same: it starts at 1ns and doubles. >The thing that changes over time is whether sleeping actually  *occurs*. For example, `mkWorkSearch 1000 100000` will not sleep D for the first ten invocations (until 1024), and then will sleep an B amount that doubles each time until it surpasses the maximum, at 8 which point each sleep will be for the maximum: 100ms. EFGEFGFGEEFG] !"#$%&'()*++,-./01234456789:;<=>?@ABCDEFGHI?JKDFH?JKDFLMNOPNQRSTUVWXNYZNQ[N\]^_`NQabcdefghijklmNnop meta-par-0.3Control.Monad.Par.Meta#Control.Monad.Par.Meta.HotVar.IORef*Control.Monad.Par.Meta.Resources.Debugging$Control.Monad.Par.Meta.Resources.SMPControl.Monad.Par.Meta.SMP/Control.Monad.Par.Meta.Resources.SingleThreadedControl.Monad.Par.Meta.Serial(Control.Monad.Par.Meta.Resources.Backoff Control.Monad.Par.Meta.ResourcesBackoffDataMonoidVectorabstract-par-0.3Control.Monad.Par.ClassspawnPgetspawn_spawn ParFuturenewFull_newFullput_putnewforkParIVarHotVar newHotVar modifyHotVar modifyHotVar_ readHotVar writeHotVar readHotVarRawwriteHotVarRaw verbositydbg dbgTaggedMsg dbgCharMsgdbgDelaymeaningless_alloctaggedmsg_global_modeSchednotidsworkpoolrngmortalsconsecutiveFailuresivarUIDschedWsResourcestartup workSearch WorkSearchWSrunWSStartupStrunSt GlobalStateIVarParforkWithExceptionsspawnWorkerOnCPU runMetaParIO runMetaPar mkResource mkResourceOndefaultStartupstartupForCapsdefaultWorkSearch wsForCapsrunParrunParIO mkWorkSearch $fShowIORefbaseGHC.Base. GHC.Conc.SyncThreadIdabstract-deque-0.1.5Data.Concurrent.Deque.ClassWSDequemwc-random-0.12.0.0System.Random.MWCGenIO Data.MaybeNothinggetNumCapabilities Data.Monoidmappendtransformers-0.3.0.0Control.Monad.IO.ClassMonadIOforkOnghc-prim GHC.TypesIO$fParIVarIVarPar$fParFutureIVarPar $fShowSched$fMonoidResource$fMonoidWorkSearch$fShowWorkSearch$fMonoidStartup $fShowStartup $fNFDataIVar Text.Readread