Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does MPI provide preprocessor macros?

Tags:

c++

c

mpi

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.

like image 738
user2052436 Avatar asked Feb 05 '15 21:02

user2052436


People also ask

Are macros preprocessor?

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.

What is macro processing in preprocessor?

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.

What does a preprocessor macro do in C++?

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.

Is OpenMPI a compiler?

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.


1 Answers

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
like image 137
Cameron Avatar answered Sep 28 '22 08:09

Cameron