Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Compile-time MPI_Datatype checking
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2012-05-30 17:57:02


I've reviewed the patch. Good stuff!

I annotated your patch file -- see attached for my comments. Search for "*** JMS" (my initials).

On May 29, 2012, at 11:08 AM, 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 OpenMPI side we need to:
> * add attributes to MPI functions to mark them as accepting pointers
> with type tags;
> * add attributes to ompi_mpi_* declarations to mark them as type tags.
>
> All in all, the changes boil down to:
> 1. Annotate type tags:
> OMPI_DECLSPEC extern struct ompi_predefined_datatype_t
> ompi_mpi_float OMPI_ATTR_TYPE_TAG(float);
>
> 2. Annotate functions:
> OMPI_DECLSPEC int MPI_Send(void *buf, int count, MPI_Datatype
> datatype, int dest,
> int tag, MPI_Comm comm)
> OMPI_ATTR_POINTER_WITH_TYPE_TAG(1,3);
>
>
> where OMPI_ATTR* are macros that are defined to attributes when
> compiling under clang with this feature.
>
> Attached is the OpenMPI patch I've arrived to. Although I tried to be
> attentive, changes to mpi.h are very repetitive and error-prone, so
> please review them closely.
>
> I've implemented a similar patch for MPICH2. [2] OpenMPI developers
> might want to follow that discussion, too.
>
> Dmitri
>
> [1] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120521/058137.html
> [2] http://lists.mcs.anl.gov/pipermail/mpich2-dev/2012-May/000938.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_[hidden]>*/
> <ompi-v2.patch>_______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/