[Haskell-cafe] Parallelism on concurrent?
mnislaih at gmail.com
Tue Mar 13 13:26:57 EDT 2007
Excuse me, I read too quick.
It works for forkIO too, although I'm not sure about forkOS. I don't
have a demo around, but you can verify with the concurrency demos in
If it doesn't work, perhaps you are in an unsupported platform.
On 13/03/2007, at 18:10, Dusan Kolar wrote:
> Yes, it works for operator /par/. That's what I've reported. But
> should it work for forkIO and forkOS? Could anybody give more
> detailed answer than yes, no? :-) (Link to the Web is OK.)
> BTW, thanks for the link to the paper (moreover, I can see, that
> googling over haskell.org is not sufficient ;-) ).
> Pepe Iborra wrote:
>> On 13/03/2007, at 17:46, Jefferson Heard wrote:
>>> Simon will probably chime in on it as well, but his paper on the
>>> subject is
>>> the best there is:
>> It does work in GHC 6.6 very nicely.
>> You can try it with the following naive fib function, extracted
>> from the paper mentioned above:
>> import Control.Parallel
>> import System.Environment
>> import Fib
>> main = do
>> (x:_) <- getArgs
>> print$ pfib (read x)
>> pfib 0 = 1
>> pfib 1 = 1
>> pfib n = n1 `par` n2 `seq` n1+n2+1
>> where (n1,n2) = (pfib(n-1), pfib(n-2))
>> pep:~/code/snippets/Parallelism$ ghc --make -O Main -threaded
>> pep:~/code/snippets/Parallelism$ time src/Main 33
>> real 0m1.444s
>> user 0m1.343s
>> sys 0m0.020s
>> pep:~/code/snippets/Parallelism$ time src/Main 33 +RTS -N2
>> real 0m0.764s
>> user 0m1.367s
>> sys 0m0.030s
>> Got a speedup of 100%, and didn't use threads at all. Yay!
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
> Dusan Kolar tel: +420 54 114 1238
> UIFS FIT VUT Brno fax: +420 54 114 1270
> Bozetechova 2 e-mail: kolar at fit.vutbr.cz
> Brno 612 66
> Czech Republic
More information about the Haskell-Cafe