forkOS should work as well, assuming you have OS threads, like in linux 2.6.  
You should probably be using the -smp compiler flag and not the -threaded 
compiler flag, I'm guessing, and make sure that your +RTS arguments indicate 
that you want to use X total concurrent threads...

-- Jeff

On Tuesday 13 March 2007 13: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 ;-) ).
>
> Regards,
>
>   Dusan
>
> 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:
> >>
> >> http://research.microsoft.com/~simonpj/Papers/strategies.ps.gz
> >
> > 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:
> >
> > \begin{code}
> > 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))
> > \end{code}
> >
> > pep:~/code/snippets/Parallelism$ ghc --make -O Main -threaded
> >
> > pep:~/code/snippets/Parallelism$ time src/Main 33
> > 11405773
> >
> > real    0m1.444s
> > user    0m1.343s
> > sys     0m0.020s
> >
> > pep:~/code/snippets/Parallelism$ time src/Main 33 +RTS -N2
> > 11405773
> >
> > real    0m0.764s
> > user    0m1.367s
> > sys     0m0.030s
> >
> >
> >
> > Got a speedup of 100%, and didn't use threads at all. Yay!
> >
> > pepe
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to