[Haskell-cafe] Haskell Paralellism

Dominik Luecke luecke at informatik.uni-bremen.de
Thu Oct 25 06:43:16 EDT 2007


Hello,

it looks quite similar, but it is not completely what I need, I rather
need something like

inParallel = parMap rwhnf

outList = inParallel (map f) listOfLists

If I use your construction on the first 2 elements of my list, I see
several threads working, but not in the other case.

Regards, 

 Dominik

On Thu, 2007-10-25 at 11:53 +0200, Alberto Ruiz wrote:
> 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
-- 
Dominik Luecke                 Phone +49-421-218-64265
Dept. of Computer Science      Fax   +49-421-218-9864265
University of Bremen           luecke at informatik.uni-bremen.de           
P.O.Box 330440, D-28334 Bremen
PGP-Key ID 0x2D82571B



More information about the Haskell-Cafe mailing list