Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] Compile-time MPI_Datatype checking
From: Dmitri Gribenko (gribozavr_at_[hidden])
Date: 2012-05-29 11:08:00


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 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)

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.



(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr_at_[hidden]>*/