Does MPI standard provide a preprocessor macro, so my C/C++ code could branch if it is compiled by MPI-enabled compiler? Something like _OPENMP
macro for OpenMP.
The C preprocessor is a macro preprocessor (allows you to define macros) that transforms your program before it is compiled. These transformations can be the inclusion of header files, macro expansions, etc.
Macros allow you to write commonly used PL/I code in a way that hides implementation details and the data that is manipulated and exposes only the operations. In contrast with a generalized subroutine, macros allow generation of only the code that is needed for each individual use.
The preprocessor expands macros in all lines except preprocessor directives, lines that have a # as the first non-white-space character. It expands macros in parts of some directives that aren't skipped as part of a conditional compilation.
OpenMPI is a library. It doesn't compile your code using gcc, you compile your code using gcc or aarch64-linux-gnu-gcc . You presumably need an aarch64-linux build of OpenMPI to compile/link against.
According to the MPI standard (page 335), you can check for the MPI_VERSION
macro:
In order to cope with changes to the MPI Standard, there are both compile-time and runtime ways to determine which version of the standard is in use in the environment one is using.
The "version" will be represented by two separate integers, for the version and subversion:
In C,
#define MPI_VERSION 3 #define MPI_SUBVERSION 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With