[Haskell-cafe] Haskell Paralellism

Alberto Ruiz aruiz at um.es
Thu Oct 25 05:53:45 EDT 2007


Hello Dominik,

I have used something like this and it worked very well:

import Control.Parallel.Strategies

inParallel = parMap rwhnf id

[a,b] = inParallel [f x, g y]

I hope it helps,

Alberto

On Thursday 25 October 2007 11:36, Dominik Luecke wrote:
> Hello,
>
> I am trying to use the code
>
> rels list =
>     let
>         o1 = (map makeCompEntry) $ head $ splitList list
>         o2 = (map makeCompEntry) $ head $ tail $ splitList list
>         o3 = (map makeCompEntry) $ head $ tail $ tail $ splitList list
>     in
>       case (head $ tail $ tail $ tail $ splitList list) of
>         [] -> o1 `par` o2 `par` o3 `seq` o1 : o2 : o3 : []
>         _  ->
>             let o4 = rels (head $ tail $ tail $ tail $ splitList list)
>             in
>               o1 `par` o2 `par` o3 `par` o4 `seq`
>               o1 : o2 : o3 : o4
>
> to apply some operation on some lists in parallel. The input list "list"
> is quite long (about 10^17) entries, and I split it into chunks of 1000
> entries each. I am compiling with the options " -O2 --make -smp
> -threaded" and when running the file with "+RTS -N2 -sstderr -RTS", I
> see that only one worker thread is really doing anything. I am using a
> vanilla build of ghc-6.6.1 running on Ubuntu 7.10. I am currently
> wondering about what I am doing wrong.
>
> Regards,
>  Dominik


More information about the Haskell-Cafe mailing list