[mpich2-dev] Compile-time MPI_Datatype checking

Dave Goodell goodell at mcs.anl.gov
Tue May 29 17:36:33 CDT 2012


Hi Dimitri,

This sounds like very interesting work, and I do wish to followup on your proposed patch (a colleague and I were just wishing for this functionality last week).  However I am on travel right now for a few more days and don't immediately have the time to look at it now.

I'll try to look at it during the coming week and get back to you as soon as possible.

Best,
-Dave

On May 29, 2012, at 10:58 PM GMT+09:00, Dmitri Gribenko wrote:

> Hello,
> 
> 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
> match.
> 
> 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
> tags.
> 
> All in all, the changes boil down to:
> 1. Introduce declarations like:
> static const MPI_Datatype mpich_mpi_float
>    MPICH_ATTR_TYPE_TAG(float) = MPI_FLOAT;
> 
> 2. Annotate functions:
> int MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm)
>    MPICH_ATTR_POINTER_WITH_TYPE_TAG(1,3);
> 
> 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.
> 
> Dmitri
> 
> [1] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120521/058137.html
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> <mpich2-v2.patch>



More information about the mpich2-dev mailing list