[m-rev.] for review: more efficient parallel mmc --make

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Jul 29 18:23:39 AEST 2009


On Tue, 28 Jul 2009, Peter Wang wrote:

> Branches: main
>
> Fix a performance problem with mmc --make --jobs <n>.  It would fork a new
> process for each target, whether or not that target was already up-to-date.
> For a large program which is mostly up-to-date, this could be very costly.
> The main reason it was implemented so was to avoid interprocess communication
> which might be non-portable (the only communication was via a sub-process's
> exit code).
>
> This patch makes use of IPC to allow the master process to fork off only N-1
> worker processes, itself being the last worker.  The workers communicate via
> shared memory as to which tasks still need doing, and which are completed.
> A worker process therefore may work on as many tasks as required before
> terminating.
>
> Parallel mmc --make is currently disabled in .par grades.  It should be
> fairly simple to restore.
>
>
> configure.in:
> runtime/mercury_conf.h.in:
>        Check sys/mman.h is available for mmap().
>
>        Check if -lrt is required for POSIX semaphores.
>
> Mmake.common.in:
> compiler/Mmakefile:
>        Link with -lrt if found.
>
> compiler/make.util.m:
>        Reimplement process-based concurrent fold predicate as above.
>        Fall back to non-concurrent fold if the IPC mechanisms are
>        unavailable.
>
>        Delete old thread-based concurrent fold implementation.
>
> compiler/process_util.m:
>        Add wait_pid to wait on a particular child process.
>
> compiler/Mercury.options:
>        Set --no-ansi-c on make.util.m.

That looks okay.  Please check that it works (or is at least
properly disabled) on systems other than Linux before committing.

Julien.
--------------------------------------------------------------------------
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