Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Audet, Martin (Martin.Audet_at_[hidden])
Date: 2007-02-01 21:44:00


Hi,

I would like to suggest you to add macros indicating the version of the OpenMPI library in the C/C++ header file mpi.h analogous to the parameter constants in the Fortran header file:

   parameter (OMPI_MAJOR_VERSION=1)
   parameter (OMPI_MINOR_VERSION=1)
   parameter (OMPI_RELEASE_VERSION=4)
   parameter (OMPI_GREEK_VERSION="")
   parameter (OMPI_SVN_VERSION="r13362")

This would be very handy if someone discover a bug XYZ and a workaround for it in OpenMPI versions before (and not including) 1.1.4 for example and wants his code to be portable on many OpenMPI versions and also on other MPI-2 implementations. In this situation he could do something like this in a common C header file:

   #ifdef OPEN_MPI

   /* true iff (x.y.z < u.v.w) */
   #define DOTTED_LESS_THAN(x,y,z, u,v,w) \
      (((x) < (u)) || (((x) == (u)) && (((y) < (v)) || (((y) == (v)) && ((z) < (w))))))

   # if DOTTED_LESS_THAN(OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION, 1,1,4)
   # define USE_MPI_WORKAROUND_XYZ
   # endif

   #endif

And later in the C source code:

   #ifdef USE_MPI_WORKAROUND_XYZ
     /* use the workaround */
   #else
     /* use the normal method */
   #endif

Thanks,

Martin