Hello, you can build your ompi with --with-devel-headers and use the header <ompi/version.h>:
#define OMPI_MAJOR_VERSION 1 #define OMPI_MINOR_VERSION 1 #define OMPI_RELEASE_VERSION 4 #define OMPI_GREEK_VERSION "" Bert Audet, Martin wrote: > 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 > > > ------------------------------------------------------------------------ > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users