Audrey Tang wrote:
I hacked +RTS -N support into Pugs today; here's a short writeup:
http://pugs.blogs.com/pugs/2006/10/smp_paralleliza.html
Pugs's current implementation for concurrent operations on lists is
very naive:
chan <- newChan
forM ([0..] `zip` xs) $ \(n, x) -> forkIO $ do
rv <- runEvalIO env (reduce x)
writeChan chan (n, rv)
fmap (map snd . sort) (replicateM (length xs) (readChan chan))
While the initial result on Linux 2.6 is encouraging, on OSX/Intel with
two CPUs
it actually slightly slows down the program when running on -N2 or above.
I wonder if there is a more efficient way doing this...
Right, it all depends on how much you're doing in each thread. You might want
to divide the work into larger chunks (several elements of the array) rather
than creating a thread for every element.
Cheers,
Simon
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell