diff options
Diffstat (limited to 'Source/ablastr/parallelization/MPIInitHelpers.H')
-rw-r--r-- | Source/ablastr/parallelization/MPIInitHelpers.H | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/ablastr/parallelization/MPIInitHelpers.H b/Source/ablastr/parallelization/MPIInitHelpers.H new file mode 100644 index 000000000..6b9bdfa47 --- /dev/null +++ b/Source/ablastr/parallelization/MPIInitHelpers.H @@ -0,0 +1,45 @@ +/* Copyright 2020 Axel Huebl + * + * This file is part of ABLASTR. + * + * License: BSD-3-Clause-LBNL + */ +#ifndef ABLASTR_MPI_INIT_HELPERS_H_ +#define ABLASTR_MPI_INIT_HELPERS_H_ + +#include <utility> + +namespace ablastr::parallelization +{ + /** Return the required MPI threading + * + * @return the MPI_THREAD_* level required for MPI_Init_thread + */ + int + mpi_thread_required (); + + /** Initialize MPI + * + * @return pair(required, provided) of MPI thread level from MPI_Init_thread + */ + std::pair< int, int > + mpi_init (int argc, char* argv[]); + + /** Finalize MPI + * + * This function is simply a wrapper around MPI_Finalize(). It is a no-op if + * ABLASTR is compiled without MPI support. + */ + void + mpi_finalize (); + + /** Check if the requested MPI thread level is valid + * + * Prints warnings and notes otherwise. + */ + void + check_mpi_thread_level (); + +} // namespace ablastr::parallelization + +#endif // ABLASTR_MPI_INIT_HELPERS_H_ |