They would be replaced with:
MPI_Copy_attr_function
MPI_Delete_attr_function
MPI_Errorhandler_function (can't use MPI_Handler_function -- it's used in
MPI-1)
***************
I would prefer MPI_Errhandler_function for the third one.
***************
-----
PART 2: Change the types of parameters in functions to match these new
typedefs. The following functions are affected:
MPI_*_Create_keyval * = { Comm, Win, Type }
MPI_*_Create_errhandler (<-- File as well? I don't remember)
**************
For error handlers, the set of types are Comm, Win and File (Type is not
there).
**************
Jean-Pierre
jsquyres @ lsc.nd.edu
05/06/97 04:46 PM
Please respond to jsquyres@lsc.nd.edu
To: mpi-external @ mcs.anl.gov, mpi-core @ mcs.anl.gov
cc: (bcc: Jean-Pierre Prost/Watson/IBM Research)
Subject: New errhandler text
I bring this text to the external and core lists because it has been
passed around internally to several people, but everyone on the list
should see it.
Here's the context: I'm not happy with the new errhandler and caching
functions. The only problem that I have with them is that they are
essentially the same functions, but times 3 (because we define the same
operations on MPI_Comm, MPI_Datatype, and MPI_File).
I am requesting a minor change that would ease a lot of implementations (C
and C++) while still providing the 3x functions (since it's too late to
change that).
I appologize in advance for the length of this letter. :-) If you don't
care about the details about *why* am asking for all of this, skip to "THE
BOTTOM LINE" near the bottom.
=====
My main problem with having essentially the same functions 3 times is that
there is no potential for code reuse within the implementation
(specifically, the C++ implementation, regardless of whether it is layered
on C bindings or not).
The main reason that there is no possibility for code reuse is the user
callback function typedefs.
The present scheme has user callback functions, that are typedef'ed
something like (I'll show just the C bindings, for simplicity):
------
typedef int MPI_Comm_copy_attr_function(MPI_Comm comm, int comm_keyval,
void *extra_state, void *attr_val_in, void *attr_val_out,
int *flag);
typedef int MPI_Win_copy_attr_function(MPI_Win win, int comm_keyval,
void *extra_state, void *attr_val_in, void *attr_val_out,
int *flag);
typedef int MPI_Type_copy_attr_function(MPI_Datatype type, int comm_keyval,
void *extra_state, void *attr_val_in, void *attr_val_out,
int *flag);
------
Notice that they only have the first parameter different in each of the
three typedefs.
This makes the bindings for the MPI_*_CREATE_KEYVAL function be something
like this:
------
int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *copy_fn, ...);
int MPI_Win_create_keyval(MPI_File_copy_attr_function *copy_fn, ...);
int MPI_Type_create_keyval(MPI_Type_copy_attr_function *copy_fn, ...);
------
Notice that the first parameter is different in all three, only because
the first parameter of the respective typedefs are different.
Here's what I am proposing: have only *one* typedef for the user callback
functions (that takes (void *) as its first argument vs. an MPI opaque
handle), and then have the MPI_*_CREATE_KEYVAL functions all take that one
typedef as their argument:
------
typedef MPI_Copy_attr_function(void *handle, int keyval, void
*extra_state, void *attr_val_in, void *attr_val_out, int *flag);
int MPI_Comm_create_keyval(MPI_Copy_attr_function *copy_fn, ...);
int MPI_Win_create_keyval(MPI_Copy_attr_function *copy_fn, ...);
int MPI_Type_create_keyval(MPI_Copy_attr_function *copy_fn, ...);
------
Notice how they all use that one typedef. The only type checking that we
lose is in the first parameter of the user's callback function. This is
very minor.
The same reasoning can be applied to all the user callback functions for
attribute caching and error hander functions. Here's a synopsis of
exactly what I am asking for:
-----
PART 1: Eliminate all the object-dependant typedefs:
MPI_*_copy_attr_function * = { Comm, Win, Type }
MPI_*_delete_attr_function
MPI_*_handler_function (<-- was there one for for File as well?)
They would be replaced with:
MPI_Copy_attr_function
MPI_Delete_attr_function
MPI_Errorhandler_function (can't use MPI_Handler_function -- it's used in
MPI-1)
-----
PART 2: Change the types of parameters in functions to match these new
typedefs. The following functions are affected:
MPI_*_Create_keyval * = { Comm, Win, Type }
MPI_*_Create_errhandler (<-- File as well? I don't remember)
---This allows the C++ implementation to lump together all the attribute, error handler, and name functions and only implement them once (rather than 3 times).
*** THE BOTTOM LINE: I want one callback typedef (of each type -- copy, delete, etc.), that takes a (void *) as its first argument, not an MPI opaque handle.
I want this functionality because this allows for an elegant implmentation in C++ (specifically, we can use inheritance -- I can supply the details if anyone wants to know), and the cost is very small (i.e. the change is minor). It can also help in C implementations.
{+} Jeff Squyres {+} squyres@cse.nd.edu {+} Perpetual Obsessive Notre Dame Student Craving Utter Madness {+} "I came to ND for 4 years and ended up staying for a decade"