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:
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe