[Haskell-cafe] Unable to get parallelism using `par`

Brandon Moore brandon_m_moore at yahoo.com
Thu Feb 17 18:20:18 CET 2011




>From: C K Kashyap <ckkashyap at gmail.com>
>
>Hi,
>I tried the first example from "A tutorial on Parallel and Concurrent 
>programming in Haskell" but I cant seem to get sparks to get converted to OS 
>threads.
>
>
>Below is the program I am using.
>I did ghc --make -threaded program.hs
>then 
>./program +RTS -N2
>I don't see any speed gain compared to N1.
>Am I missing something?

If you are using ghc 7.01, you need to compile with -rtsopts for the compiled
program to parse +RTS options. I don't know of any way to provide a default
value at compile time.

http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/runtime-control.html

Also, in general a program might not run faster with speculation, so if you want 
to
check if several threads are used, check if CPU time used is over 100%.

Brandon



      



More information about the Haskell-Cafe mailing list