[m-rev.] for review: smaller stacks for parallel conjuncts

Peter Wang wangp at students.csse.unimelb.edu.au
Mon Oct 2 14:27:50 AEST 2006


On 2006-10-02, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> On Fri, 29 Sep 2006, Peter Wang wrote:
> >
> >Assuming that most parallel conjuncts contain small sub-computations, we 
> >can
> >allow many contexts to be allocated without excessive memory consumption by
> >just giving them smaller stacks.  This patch creates a simple variant of a
> >MR_Context structure which has smaller stacks than the initial MR_Context
> >structure and executes parallel conjuncts in the smaller contexts if
> >larger contexts are unavailable.
> 
> Presumably you've measured the performance impact of this on parallel
> conjucts?

Yes.  Once the context limit is reached, all new parallel conjuncts get
executed in the same context that they were forked.  That's fine if the
already allocated contexts keep creating more work for themselves.  If
they're mostly suspended then it's a big loss of parallelism.  So we
want to raise the context limit to exploit parallelism, but reduce the
size of each context to get reasonable memory usage.

The patch *is* hack though.  Ideally, all stacks would start small and
grow as needed (or something like that).

> >Index: doc/user_guide.texi
> >===================================================================
> >RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
> >retrieving revision 1.493
> >diff -u -r1.493 user_guide.texi
> >--- doc/user_guide.texi	25 Sep 2006 08:00:38 -0000	1.493
> >+++ doc/user_guide.texi	28 Sep 2006 05:31:03 -0000
> >@@ -8537,6 +8537,36 @@
> >multiplied by the word size in bytes.
> >
> >@sp 1
> >+ at item --small-detstack-size @var{size}
> >+ at findex --small-detstack-size (runtime option)
> >+Sets the size of the det stack used for executing parallel conjunctions
> >+to @var{size} kilobytes.
> >+The regular det stack size should be equal or greater to avoid surprises.
> 
> The initialisation code in the runtime should check that this is the case 
> and
> abort (with a suitable error message) if not.  The documention here should 
> say
> that is the case rather than some vague mention of surprises.  (Similarly 
> for
> the nondet stack etc.)

Will do.

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