Subject: Error handling (really Environmental ?)

From: James Cownie <[email-masked]>
Date: Thu, 19 Aug 1993 12:06:05 +0100

Is error handling still in point to point ? or should this be goint to
Enviromental ?

Anyhow I can't remember the alias for environmental, so I'll send it
here...

Error handling (and modes)
==========================

Marc used to have a section in the point to point chapter on how MPI
handles user errors. (But it seems to have gone away...)

This suggested (in effect) that we "raise a signal" on an MPI error,
and have a default handler which executes to core dump, or whatever.
It would be illegal to attempt to communicate after an error had been
raised.

This raises a few questions :-
1) We can't really rely on raising a "real" signal, since MPI need not run
   on Unix, therefore we probably have to have our own MPI routines
   for registering error handlers, analogous to the signal style ones.

2) Do we have a single MPI error routine, or do we want to distinguish
   different MPI errors. (e.g. Receive overrun vs Insufficient system
   buffering vs ...) ?

   If we want to distinguish, then do we have to enumerate all of the
   MPI standard error conditions ? Or can we allow these to be
   implementation defined (and if so what's the use of the standard ?) ?

3) What arguments get passed to the user's error handler ?
   e.g. If the error is associated with a communicator does it get that ?

4) When is the error handler called ?
   Possibilities include :-
      Asynchronously as soon as the library knows there's a problem.
      When the next MPI routine is called by the user.
      When the next "heavyweight" MPI routine is called.
      ...
   What do we promise ?

5) As detailed above this error handler represents global state. It is
   not easy for a library to insert its own handler(s).
    
   One possible solution here would be to associate the handler(s)
   with a communicator (and its descendents). This seems elegant, 
   and solves the library problem. (It's also relatively cheap unless
   many different handlers are used)
   However there's still the problem of errors which represent a more
   global failure (e.g. no buffering available for a received
   message), which handler do we now invoke ? (Note that there may not
   even be a communicator for the message at the time it arrives)

My opinion (for what it's worth)
================================

I'd have a single MPI error handler associated with a communicator, so
I'd provide a routine for associating an error handler with a
communicator. 

e.g.
MPI_ERRHANDLER mpi_set_handler(MPI_COMM comm, 
	                       (void (*handler)(MPI_COMM,int *,...));
Which sets the handler and returns the previous one. This is a LOCAL
routine, the communicator is NOT used for communication !

I'd inherit this error handler in all communicators
derived from this one. 

I'd accept that the errors will be machine dependent, but provide a
defined way of mapping an error code into a string, so you can at
least write a handler which says something beyond "Error 92".

I'd give the error handler a prototype like this
void MPI_ERROR_HANDLER( MPI_COMM communicator, int * errcode, ...)
{
}

(errcode is only int * so that you can write this routine in Fortran
if you must !)

The ... arguments would be implementation defined.

The communicator could be MPI_COMM_NULL if the error could not be
related to a particular communicator.

I'd give errors which couldn't be associated with a specific
communicator to the error handler for MPI_COMM_ALL, for want of
anywhere better.

I'd make no promises about when the handler gets called, beyond that
it's before the user completion routine (WAIT, TEST, blocking op) for
the failing operation completes. (I think this is the least you can
say. It certainly seems unreasonable to return a success status to the
user, and then raise an error exception for the same transaction !)

I'd state that the handler should call MPI_ABORT(), or return in which
case MPI_ABORT(errcode) will be called anyway.

Thoughts, other options ?

-- Jim
James Cownie 
Meiko Limited			Meiko Inc.
650 Aztec West			Reservoir Place
Bristol BS12 4SD		1601 Trapelo Road
England				Waltham
				MA 02154

Phone : +44 454 616171		+1 617 890 7676
FAX   : +44 454 618188		+1 617 890 5042
E-Mail: [email-masked]   or    [email-masked]