61 [[nodiscard]] MPI_Comm
get() const noexcept {
return comm_; }
64 [[nodiscard]]
bool is_null() const noexcept {
return comm_ == MPI_COMM_NULL; }
70 [[nodiscard]]
int rank()
const {
80 [[nodiscard]]
int size()
const {
168 inline operator boost::mpi::communicator()
const {
return boost::mpi::communicator(comm_, boost::mpi::comm_duplicate); }
169 inline communicator(boost::mpi::communicator c) : comm_(c) {}
190 if (poll_msec == 0) {
197 check_mpi_call(MPI_Test(&req, &flag, MPI_STATUS_IGNORE),
"MPI_Test");
198 usleep(poll_msec * 1000);
205 MPI_Comm comm_ = MPI_COMM_WORLD;
227 if (
has_env)
check_mpi_call(MPI_Comm_split_type(comm_, split_type, key, MPI_INFO_NULL, &c.comm_),
"MPI_Comm_split_type");
int size() const
Get the size of the communicator.
communicator(MPI_Comm c)
Construct a communicator with a given MPI_Comm object.
shared_communicator split_shared(int split_type=MPI_COMM_TYPE_SHARED, int key=0) const
Partition the communicator into subcommunicators according to their type.
int rank() const
Get the rank of the calling process in the communicator.
communicator duplicate() const
Duplicate the communicator.
void free()
Free the communicator.
communicator split(int color, int key=0) const
Split the communicator into disjoint subgroups.
MPI_Comm get() const noexcept
Get the wrapped MPI_Comm object.
bool is_null() const noexcept
Check if the contained MPI_Comm is MPI_COMM_NULL.
void barrier(long poll_msec=1) const
Barrier synchronization.
void abort(int error_code) const
If mpi::has_env is true, MPI_Abort is called with the given error code, otherwise it calls std::abort...
communicator()=default
Construct a communicator with MPI_COMM_WORLD.
C++ wrapper around MPI_Comm that is a result of the mpi::communicator::split_shared operation.
shared_communicator()
Construct a shared communicator with MPI_COMM_NULL.
communicator()=default
Construct a communicator with MPI_COMM_WORLD.
Provides an MPI environment for initializing and finalizing an MPI program.
static const bool has_env
Boolean variable that is true, if one of the environment variables OMPI_COMM_WORLD_RANK,...
void check_mpi_call(int errcode, const std::string &mpi_routine)
Check the success of an MPI call.
Provides general utilities related to MPI.