Celeritas
0.5.0-56+6b053cd
|
Wrap an MPI communicator. More...
#include <MpiCommunicator.hh>
Public Types | |
Type aliases | |
using | MpiComm = detail::MpiComm |
Public Member Functions | |
MpiCommunicator (MpiComm comm) | |
Construct with a native MPI communicator. More... | |
MpiComm | mpi_comm () const |
Get the MPI communicator for low-level MPI calls. | |
int | rank () const |
Get the local process ID. | |
int | size () const |
Get the number of total processors. | |
operator bool () const | |
True if non-null communicator. | |
Static Public Member Functions | |
static MpiCommunicator | self () |
Construct a communicator with MPI_COMM_SELF. More... | |
static MpiCommunicator | world () |
Construct a communicator with MPI_COMM_WORLD. More... | |
static MpiCommunicator | world_if_enabled () |
Construct a communicator with MPI_COMM_WORLD or null if disabled. | |
Wrap an MPI communicator.
This class uses ScopedMpiInit
to determine whether MPI is available and enabled. As many instances as desired can be created, but Celeritas by default will share the instance returned by comm_world
, which defaults to MPI_COMM_WORLD
if MPI has been initialized, or a "self" comm if it has not.
A "null" communicator (the default) does not use MPI calls and can be constructed without calling MPI_Init
or having MPI compiled. It will act like MPI_Comm_Self
but will not actually use MPI calls.
|
explicit |
Construct with a native MPI communicator.
This will fail with a NotConfigured
error if MPI is disabled.
|
inlinestatic |
Construct a communicator with MPI_COMM_SELF.
Each process sees itself as rank zero in size zero, thus operating independently.
|
inlinestatic |
Construct a communicator with MPI_COMM_WORLD.
Each process sees every other process in MPI's domain, operating at the maximum level of interprocess cooperation.