[Haskell-cafe] Control.Parallel.Strategies

Sebastian Sylvan sebastian.sylvan at gmail.com
Wed Apr 9 17:09:30 EDT 2008

I was toying with the Control.Parallel.Strategies library, but can't seem to
get it to actually do anything in parallel!

Here's the code:

import System.Random
import Control.Parallel.Strategies

fib :: Int -> Int
fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2)

main = print $ parMap rnf fib $ take 80 $ randomRs (30,35) (mkStdGen 123)

I compile with "-threaded", and run with +RTS -N2 -RTS, but yet it stays at
50% on my dual core machine!

I should point out that any manual threading with forkIO does indeed use
100% of the CPU, and this problem happens on my work computer too (Vista on
my home computer, XP on the work one).

Anything I'm missing here?


Sebastian Sylvan
UIN: 44640862
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080409/2f4252ad/attachment.htm

More information about the Haskell-Cafe mailing list