Hi,
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?
Thanks,
--
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862