Language Bindings


Up: Lessons Learned Next: Performance Previous: Lessons Learned

One of the earliest lessons learned had to do with the language bindings and choices of C datatypes for some items in the MPI Standard. For example, the 1.0 version passed the MPI_Status structure itself, rather than a pointer to the structure, to the routines MPI_Get_count, MPI_Get_elements, and MPI_Test_cancelled. The C bindings used int in some places where an int might not be large enough to hold the result; most of these (except for MPI_Type_size) were changed to MPI_Aint.

In the MPI_Keyval_create function, the predefined ``null'' functions MPI_NULL_COPY_FN and MPI_NULL_DELETE_FN were originally both MPI_NULL_FN; unfortunately, neither of these is exactly a null function (both have mandatory return values and the copy function also sets a flag). Experience with the implementation helped the MPI Forum to repair these problems in the 1.1 version of the MPI Standard.

A related issue was the desire of the Forum to make the same attribute copy and delete functions usable from both C and Fortran; for this reason, addresses were used in the 1.0 standard for some items in C that were more naturally values. Unfortunately, when the size of the C int datatype is different from that of the Fortran INTEGER datatype, this approach does not work. In a surprise move, the MPI Forum exploited this in the 1.1 Standard, changing the bindings of the functions in C to use values instead of addresses.

Another issue is the Fortran bindings of all of the routines that take buffers. These buffers can be of any Fortran datatype (e.g., INTEGER, REAL, or CHARACTER). This was common practice in most previous message-passing systems but is in violation of the Fortran Standard [15]. The MPI Forum voted to follow standard practice. In most cases, Fortran compilers pass all items by reference, and few complain when a routine is called with different datatypes. Unfortunately, several standard-conforming Fortran implementations use a different representation for CHARACTER data than for numeric data, and in these cases it is difficult to build an MPI implementation that works with CHARACTER data in Fortran. The MPI Forum is attempting to address this problem in the MPI-2 proposal.

The MPI Forum provided a way for users to interrogate the environment to find out, for example, what was the largest valid message tag. This was done in an elegant fashion by using ``attributes,'' a general mechanism for users to attach information to a communicator. The system attributes are attached to the initial MPI_COMM_WORLD communicator. The problem is that, in general, users need to set as well as get attributes. Some users did in fact try to set MPI_TAG_UB. MPICH now detects this as an illegal operation, and the MPI Forum clarified this in the 1.1 Standard.



Up: Lessons Learned Next: Performance Previous: Lessons Learned