runhaskell a parallel program

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu May 7 18:58:50 EDT 2009


On Thu, 2009-05-07 at 15:12 +0100, Neil Mitchell wrote:

> >> This is a test framework that spawns system commands. My guess is the
> >> Haskell accounts for a few milliseconds of execution per hour. Running
> >> two system commands in parallel gives a massive boost.
> >
> > That still doesn't explain why you need +RTS -N2.  You can spawn multiple
> > processes by making multiple calls to runProcess or whatever. If you want to
> > wait for multiple processes simultaneously, compile with -threaded and use
> > forkIO.
> 
> I do need to wait for them - so I don't end up firing too many at
> once. I was hoping to avoid the compile, which the ghc -e will give
> me.

Right, it works because ghc itself is compiled with the threaded rts. So
you don't need the +RTS -N when you call ghc -e.

Note that for the next ghc release the process library will use a
different implementation of waitForProcess (at least on Unix) so will
not need multiple OS threads to wait for multiple processes
simultaneously.

Duncan



More information about the Glasgow-haskell-users mailing list