[Mpi-forum] Preprocessor Constants

Hal Finkel hal.finkel at yale.edu
Thu Nov 18 17:25:57 CST 2010


Hello,

Appendix A of the current MPI 3 draft (line 45 of page 545) indicates
that MPI_VERSION and MPI_SUBVERSION are of type, "const int (or unnamed
enum)". This text is identical to that of the the MPI 2.2 specfication
(line 45 of page 523), and it should be changed. As the heading on the
previous line implies, these should be "preprocessor constants," and
must not be "const int (or unnamed enum)". I recommend replacing, "const
int (or unnamed enum)" with "integer literal."

Also, regarding the recommendation I made at the SC'10 BOF, I recommend
adding the following text after line 19 of page 18 and after line 43 on
page 18:
User code may assume that mpi.h is unavailable to the preprocessor
unless the preprocessor constant _MPI is defined prior to source-file
processing.

The practical implication is intended to be that wrapper programs such
as mpicc will, in addition to adding the various include and linker
flags, also add -D_MPI to the compiler command line. This will allow
user programs to:

#ifdef _MPI
#include <mpi.h>
#endif

in a portable way (analogous to testing for _OMP prior to including
<omp.h> when using OpenMP, for example). If the implementation simply
documents a set of flags which must be given to the compiler, that set
of flags can simply be extended to include "-D_MPI". Since many codes
have optional MPI support, this will allow them to use a common
preprocessor constant, instead of some codes requiring -DMPI, some
requiring -D_MPI, some requiring -DUSE_MPI, some requiring -DHAVE_MPI,
some requiring -DHAVE_MPI_H, etc.

Sincerely,
Hal





More information about the mpi-forum mailing list