[mpich2-dev] Compile-time MPI_Datatype checking

Dmitri Gribenko gribozavr at gmail.com
Tue May 29 08:58:16 CDT 2012


I've implemented a patch for clang that enables compile-time checking
of <pointer, type tag> arguments to functions.  When applied to MPI,
this enables the compiler to check that buffer type and MPI_Datatype

Latest version of clang patch can be found here. [1]  Please note that
clang patch was not yet accepted to clang trunk.

On the MPICH2 side we need to:
* add attributes to MPI functions to mark them as accepting pointers
with type tags;
* because MPICH2 uses magic values for type tags we need to introduce
declarations to which we attach attributes that mark them as type

All in all, the changes boil down to:
1. Introduce declarations like:
static const MPI_Datatype mpich_mpi_float

2. Annotate functions:
int MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm)

where MPICH_ATTR* are macros that are defined to attributes when
compiling under clang with this feature.

Attached is the MPICH2 patch I've arrived to.  Please pay extreme
attention to changes to hairy Perl scripts that generate bindings.

Although I tried to be attentive, changes to mpi.h are very repetitive
and error-prone, so please review them closely, too.


[1] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120521/058137.html

(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpich2-v2.patch
Type: application/octet-stream
Size: 60227 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich2-dev/attachments/20120529/67ef59c1/attachment-0001.obj>

More information about the mpich2-dev mailing list