Class wrapping all MPI functionalities.
More...
#include <Mpi.hpp>
|
| Mpi () |
| Initialize MPI.
|
|
bool | isInitialized () const |
| Check initialization flag.
|
|
| ~Mpi () |
| Finalize MPI.
|
|
int | getRank () const |
| Get current rank calling explicitly MPI.
|
|
int | rank () const |
| Cached value of current rank. More...
|
|
int | getNRanks () const |
| Get the total number of ranks, calling explicitly MPI.
|
|
bool | isMasterRank () const |
| Check if this is the master rank. More...
|
|
int | nRanks () const |
| Cached value of total number of ranks. More...
|
|
template<typename T > |
T | allReduce (const T &in) const |
| Reduces among all MPI process.
|
|
template<typename T , TypeIf<(isTriviallyCopyable< T >), void * > = nullptr> |
void | broadcast (T *x, const size_t &size, int root=MASTER_RANK) const |
|
template<typename T , TypeIf<(isTriviallyCopyable< T >), void * > = nullptr> |
void | broadcast (T &x, int root=MASTER_RANK) const |
|
template<typename T , TypeIf<(isBinarizable< T >), void * > = nullptr> |
void | broadcast (T &&val, int root=MASTER_RANK) const |
|
|
template<typename... Args> |
int | crashOnError (const int line, const char *file, const char *function, const int rc, Args &&...args) const |
|
Class wrapping all MPI functionalities.
Definition at line 57 of file Mpi.hpp.
template<typename T , TypeIf<(isTriviallyCopyable< T >), void * > = nullptr>
void SUNphi::Mpi::broadcast |
( |
T * |
x, |
|
|
const size_t & |
size, |
|
|
int |
root = MASTER_RANK |
|
) |
| const |
|
inline |
Broadcast among all MPI process
This is a simple wrapper around the MPI_Bcast function
- Parameters
-
x | Quantity to broadcast |
size | Size of the quantity to broadcast |
root | Rank from which to broadcast |
Definition at line 267 of file Mpi.hpp.
template<typename T , TypeIf<(isTriviallyCopyable< T >), void * > = nullptr>
void SUNphi::Mpi::broadcast |
( |
T & |
x, |
|
|
int |
root = MASTER_RANK |
|
) |
| const |
|
inline |
Broadcast among all MPI process
Accepts trivially copyable structures
- Parameters
-
x | Quantity to broadcast |
root | Rank from which to broadcast |
Definition at line 283 of file Mpi.hpp.
template<typename T , TypeIf<(isBinarizable< T >), void * > = nullptr>
void SUNphi::Mpi::broadcast |
( |
T && |
val, |
|
|
int |
root = MASTER_RANK |
|
) |
| const |
|
inline |
Broadcast among all MPI process
Accepts all binarizable classes
- Parameters
-
val | Quantity to broadcast |
root | Rank from which to broadcast |
Definition at line 295 of file Mpi.hpp.
template<typename... Args>
int SUNphi::Mpi::crashOnError |
( |
const int |
line, |
|
|
const char * |
file, |
|
|
const char * |
function, |
|
|
const int |
rc, |
|
|
Args &&... |
args |
|
) |
| const |
|
inlineprivate |
Decrypt the returned value of an MPI call
Returns the value of rc
- Parameters
-
line | Line of file where the error needs to be checked |
file | File where the error must be checked |
function | Function where the error was possibly raised |
rc | Exit condition of the called routine |
args | Other arguments |
Definition at line 69 of file Mpi.hpp.
bool SUNphi::Mpi::isMasterRank |
( |
| ) |
const |
|
inline |
Check if this is the master rank.
Store the result
Definition at line 212 of file Mpi.hpp.
int SUNphi::Mpi::nRanks |
( |
| ) |
const |
|
inline |
Cached value of total number of ranks.
Stored value
Definition at line 224 of file Mpi.hpp.
int SUNphi::Mpi::rank |
( |
| ) |
const |
|
inline |
Cached value of current rank.
Stored value
Definition at line 178 of file Mpi.hpp.
constexpr int SUNphi::Mpi::ALL_RANKS |
|
static |
Initial value:
Placeholder for all ranks.
Definition at line 104 of file Mpi.hpp.
constexpr int SUNphi::Mpi::MASTER_RANK |
|
static |
Initial value:
Id of master rank.
Definition at line 99 of file Mpi.hpp.
The documentation for this class was generated from the following file: