Newsgroups: comp.parallel.mpi
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Subject: Re: MPI_finalize crashes program
Organization: University of Cambridge, England
Date: 18 Dec 1996 15:33:39 GMT
Message-ID: <5992sj$hj2@lyra.csx.cam.ac.uk>

In article <E2M28t.2Dr@undergrad.math.uwaterloo.ca>, eddemain@PROBLEM_WITH_YOUR_MAIL_GATEWAY_FILE.uwaterloo.ca (Erik Demaine) writes:
|> Andre Fachat (fachat@physik.tu-chemnitz.de) wrote:
|> : I upgraded to a new version of mpich, and the problem
|> : went away [...]
|> 
|> If this is not your problem, make sure the call to Finalize is right.
|> This is right:
|>         integer ierr
|>         call mpi_finalize (ierr)
|> This is not and will surely cause a bus error:
|>         call mpi finalize

It is unlikely that is the cause, unfortunately.  The probable
reason is that somewhere in your program, you have an overwriting
bug (e.g. array index out of range or uninitialised, bad pointer,
using data after it has been freed, or whatever).  This did not
cause any obvious trouble at the time, but has trashed MPI's own
workspace.  When MPI comes to clean up, it needs to chase through
its data structures, and falls over because they are corrupted.

Aside:  This is not unique to MPI, and is far more common in
unspeakable heaps of junk like the X Toolkit and most X widget
sets.  In fact, the X Toolkit documentation specifically said that
you should NOT close down the X Toolkit, but call exit() directly.
When I tried to close down cleanly, I discovered that it was normal
for X11R3 to trash its own workspace, even when the calling code
was perfectly correct!

A GOOD MPI implementation will have a routine MPI_CHECK_WORKSPACE
that can be inserted at strategic positions in your code.  While
it would be easy to require this as part of the standard, it would
be much harder to get implementors to code it in a sufficiently
paranoid fashion.


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

