Naming objects

James Cownie (jcownie@bbn.com)
Wed, 12 Jun 1996 14:49:30 +0100

For a debugger to be able to provide a maningful display of the
message passing state of a program it would be useful to have a method
by which the user could associate a print name with a communicator
(and potentially with other MPI types as well ?).

The debugger could then use this name when displaying the outstanding
communication operations, thus avoiding any need for the user to deal
with context identifers (or other implementation specific details).

Such a capability would probably also be useful to a profiler.

The apparently obvious way to do this would be to add an additional
pre-defined attribute key, something like
MPI_NAME

However there are a number of problems with this approach :-

1) All currently pre-defined attributes are read-only. MPI_NAME
would need to be modifiable to be useful.
2) The copy behaviour is clear (the name does not get copied),
but the delete behaviour is unclear (should the storage for the
string be deleted ???)
3) It's not possible to pass a string into put_attr from Fortran.

Since these problems seem rather hard to solve, I suggest instead a
pair of new functions...

int MPI_Comm_set_name (IN MPI_Comm comm, IN string name)
int MPI_Comm_set_name(MPI_Comm comm, char * name);
integer MPI_Comm_set_name( integer comm, character*(*) name)

int MPI_Comm_get_name (IN MPI_Comm comm, OUT string name)
int MPI_Comm_get_name(MPI_Comm comm, char ** name);
integer MPI_Comm_get_name( integer comm, character*(*) name)

MPI_Comm_set_name allows a user to associate a name string with a
communicator. The passed in character string will be saved inside the
MPI library (so need not be allocated in persistent store).

MPI_Comm_get_name returns any name which had previously been associated
with the given communicator. (Note that in the C binding it returns a
reference to the internal copy of the name, which should not be
modified by the user, and which will become invalid should the name be
altered (by another call to MPI_Comm_set_name), or the communicator
deleted).

If the user has not associated a name with a communicator the system
should return a null string (all spaces in Fortran, "" in C), or a
system dependent name. (This allows the MPI system to give default
print names to communicators, one might expect MPI_COMM_WORLD to
return "MPI_COMM_WORLD", for instance).

Notes:

I have called these MPI_Comm_set_name and MPI_Comm_get_name, in case
we decide that we also want to have similar functions for other data
structures.

Comments ?

-- Jim

James Cownie
BBN UK Ltd
Phone : +44 117 9071438
E-Mail: jcownie@bbn.com