MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::Mpi Class Reference

A simple singleton class that calls MPI_Init() at construction and MPI_Finalize() at destruction. It also provides easy access to MPI_COMM_WORLD's rank and size. More...

#include <communication.hpp>

Static Public Member Functions

static void Init (int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
 Singleton creation with Mpi::Init(argc, argv).
 
static void Init (int *argc=nullptr, char ***argv=nullptr, int required=default_thread_required, int *provided=nullptr)
 Singleton creation with Mpi::Init().
 
static void Finalize ()
 Finalize MPI (if it has been initialized and not yet already finalized).
 
static bool IsInitialized ()
 Return true if MPI has been initialized.
 
static bool IsFinalized ()
 Return true if MPI has been finalized.
 
static int WorldRank ()
 Return the MPI rank in MPI_COMM_WORLD.
 
static int WorldSize ()
 Return the size of MPI_COMM_WORLD.
 
static bool Root ()
 Return true if the rank in MPI_COMM_WORLD is zero.
 

Static Public Attributes

static MFEM_EXPORT int default_thread_required = MPI_THREAD_MULTIPLE
 Default level of thread support for MPI_Init_thread.
 

Detailed Description

A simple singleton class that calls MPI_Init() at construction and MPI_Finalize() at destruction. It also provides easy access to MPI_COMM_WORLD's rank and size.

Definition at line 31 of file communication.hpp.

Member Function Documentation

◆ Finalize()

static void mfem::Mpi::Finalize ( )
inlinestatic

Finalize MPI (if it has been initialized and not yet already finalized).

Definition at line 63 of file communication.hpp.

◆ Init() [1/2]

static void mfem::Mpi::Init ( int & argc,
char **& argv,
int required = default_thread_required,
int * provided = nullptr )
inlinestatic

Singleton creation with Mpi::Init(argc, argv).

Definition at line 35 of file communication.hpp.

◆ Init() [2/2]

static void mfem::Mpi::Init ( int * argc = nullptr,
char *** argv = nullptr,
int required = default_thread_required,
int * provided = nullptr )
inlinestatic

Singleton creation with Mpi::Init().

Definition at line 40 of file communication.hpp.

◆ IsFinalized()

static bool mfem::Mpi::IsFinalized ( )
inlinestatic

Return true if MPI has been finalized.

Definition at line 75 of file communication.hpp.

◆ IsInitialized()

static bool mfem::Mpi::IsInitialized ( )
inlinestatic

Return true if MPI has been initialized.

Definition at line 68 of file communication.hpp.

◆ Root()

static bool mfem::Mpi::Root ( )
inlinestatic

Return true if the rank in MPI_COMM_WORLD is zero.

Definition at line 96 of file communication.hpp.

◆ WorldRank()

static int mfem::Mpi::WorldRank ( )
inlinestatic

Return the MPI rank in MPI_COMM_WORLD.

Definition at line 82 of file communication.hpp.

◆ WorldSize()

static int mfem::Mpi::WorldSize ( )
inlinestatic

Return the size of MPI_COMM_WORLD.

Definition at line 89 of file communication.hpp.

Member Data Documentation

◆ default_thread_required

int mfem::Mpi::default_thread_required = MPI_THREAD_MULTIPLE
static

Default level of thread support for MPI_Init_thread.

Definition at line 98 of file communication.hpp.


The documentation for this class was generated from the following files: