Public Member Functions | |
MPI_InitFinalize (int &argc, char **&argv) | |
~MPI_InitFinalize () | |
Private Attributes | |
const bool | owns_mpi |
If a program uses MPI one would typically just create an object of this type at the beginning of main()
. The constructor of this class then runs MPI_Init()
with the given arguments. At the end of the program, the compiler will invoke the destructor of this object which in turns calls MPI_Finalize
to shut down the MPI system.
Utilities::System::MPI_InitFinalize::MPI_InitFinalize | ( | int & | argc, | |
char **& | argv | |||
) |
Constructor. Takes the arguments from the command line (in case of MPI, the number of processes is specified there), and sets up a respective communicator by calling MPI_Init()
. This constructor can only be called once in a program, since MPI cannot be initialized twice.
Utilities::System::MPI_InitFinalize::~MPI_InitFinalize | ( | ) |
Destructor. Calls MPI_Finalize()
in case this class owns the MPI process.
const bool Utilities::System::MPI_InitFinalize::owns_mpi [private] |
This flag tells the class whether it owns the MPI process (i.e., it has been constructed using the argc/argv input, or it has been copied). In the former case, the command MPI_Finalize()
will be called at destruction.