[Haskell-cafe] Re: Parallel foldl doesn't work correctly
Philip Beadling
phil at beadling.co.uk
Mon Dec 14 19:37:08 EST 2009
> If you still have trouble, then try using ThreadScope
>
> http://code.haskell.org/ThreadScope/
>
> with GHC 6.12.1. You can use ThreadScope directly from the darcs
> repository on code.haskell.org, and we hope to do a proper release soon.
>
> Cheers,
> Simon
Thanks for the advice, just downloaded ThreadScope and it's pretty
useful (before I was using Ubuntu's System Monitor which isn't ideal).
I've moved onto 6.12 and I now have my program working nicely over 2
cores - the problem was at least in part my own design - I was
generating large thunks in my parallel version which was killing
performance. With this solved 2 cores gives me ~50% performance
increase.
What I'm doing now is taking a list I am going to fold over and
splitting it up so I have a list of lists, where each parent list
element representing work for 1 core. I then fold lazily and only
parallelise on the final sum operation which (as far as I can see) sends
each chunk of folds to a different core and sums the results.
Can I confirm - what you are suggesting is that although I can't
parallelise fold itself, I could force evaluation on the list I am about
to fold in parallel and then merely accumulate the result at the end --
thus most the donkey work is done in parallel?
If this is possible, it may be more flexible then my method. I'm lucky
as each fold operation will take give-or-take the same amount of time so
I can just chunk up fold jobs for each core equally. If this wasn't the
case (and it certainly won't always be!), parallelising on individual
items would be the way to go.
Thanks,
Phil.
More information about the Haskell-Cafe
mailing list