[m-rev.] for review: Runtime granularity control changes.

Peter Wang novalazy at gmail.com
Fri Jun 12 11:26:16 AEST 2009


2009/6/12 Paul Bone <pbone at csse.unimelb.edu.au>:
>
> I've fixed the problems with this patch, some code within C macros had typos
> that wern't detected until the macros where expanded by test cases that used
> the parallelism feastures.
>
> For review by Zoltan,  Peter Wang, you may like to look at the atomic
> operations I'm using.

Paul, I haven't looked at this yet.

You may remember I posted a patch that implements work stealing.  I still
haven't committed that (forgot about it), but if I did then the runtime
granularity control, as it exists now, would have to be discarded.

The reason is this.  Currently there is a single global spark queue, and you
try to guess, ahead of time, by whatever means, whether it's likely that a
spark will be taken up to be executed in parallel.  So the granularity
control macros are used to help you guess.

Under work stealing, there are multiple spark dequeues.  When you create a
spark, you *always* put it on a local queue, no guess required, as it is, by
design, a cheap operation.  When an engine becomes idle, it can steal a spark
from any one of those dequeues.  The nice part is that there is no trying to
see into the future, making a mistake and losing the potential parallelism.
The bad part is that an idle engine doesn't know exactly which deques are
non-empty or if any of them are non-empty, which can result in wasted effort.
The hand wavy argument is that it's not a problem if your program is indeed
highly parallel, i.e. #sparks >> #engines

I think it's up to you which way to proceed, or both if you can manage the
complexity in the runtime.  It would be best to do an evaluation on a real
parallel program, if there is one.

Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list