TRIQS/mpi 1.3.0
C++ interface to MPI
|
Some other utilities used in the mpi library.
Concepts | |
concept | mpi::MPICompatibleRange |
A concept that checks if a range type is contiguous and sized and has an MPI compatible value type. | |
Functions | |
void | mpi::check_mpi_call (int errcode, const std::string &mpi_routine) |
Check the success of an MPI call. | |
template<typename R> | |
auto | mpi::chunk (R &&rg, communicator c={}) |
Divide a given range as evenly as possible across the MPI processes in a communicator and get the subrange assigned to the calling process. | |
long | mpi::chunk_length (long end, int nranges, int i, long min_size=1) |
Get the length of the ith subrange after splitting the integer range [0, end) as evenly as possible across n subranges. | |
|
inline |
#include <mpi/utils.hpp>
Check the success of an MPI call.
It checks if the given error code returned by an MPI routine is equal to MPI_SUCCESS
. If it isn't, it throws an exception.
It is intended to simply wrap any calls to the MPI C library:
errcode | Error code returned by an MPI routine. |
mpi_routine | Name of the MPI routine used in the error message. |
|
nodiscard |
#include <mpi/chunk.hpp>
Divide a given range as evenly as possible across the MPI processes in a communicator and get the subrange assigned to the calling process.
R | Range type. |
rg | Range to divide. |
c | mpi::communicator. |
|
inlinenodiscard |
#include <mpi/chunk.hpp>
Get the length of the ith subrange after splitting the integer range [0, end)
as evenly as possible across n
subranges.
The optional parameter min_size
can be used to first divide the range into equal parts of size min_size
before distributing them as evenly as possible across the number of specified subranges.
It is expected that min_size > 0
and that min_size
is a divisor of end
.
end | End of the integer range [0, end) . |
nranges | Number of subranges. |
i | Index of the subrange of interest. |
min_size | Minimum size of the subranges. |