Some other utilities used in the mpi library.
|
template<typename T > |
using | mpi::regular_t = typename detail::_regular<std::decay_t<T>>::type |
| Type trait to get the regular type of a type.
|
|
|
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.
|
|
◆ regular_t
template<typename T >
using mpi::regular_t = typename detail::_regular<std::decay_t<T>>::type |
#include <mpi/utils.hpp>
Type trait to get the regular type of a type.
- Template Parameters
-
Definition at line 55 of file utils.hpp.
◆ check_mpi_call()
void mpi::check_mpi_call |
( |
int | errcode, |
|
|
const std::string & | mpi_routine ) |
|
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:
int value = 5;
int result = 0;
void check_mpi_call(int errcode, const std::string &mpi_routine)
Check the success of an MPI call.
Map C++ datatypes to the corresponding MPI datatypes.
- Parameters
-
errcode | Error code returned by an MPI routine. |
mpi_routine | Name of the MPI routine used in the error message. |
Definition at line 72 of file utils.hpp.
◆ chunk()
#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.
- Template Parameters
-
- Parameters
-
- Returns
- An itertools::sliced range assigned to the calling process.
Definition at line 66 of file chunk.hpp.
◆ chunk_length()
long mpi::chunk_length |
( |
long | end, |
|
|
int | nranges, |
|
|
int | i, |
|
|
long | min_size = 1 ) |
|
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 throws an exception if min_size < 1
or if it is not a divisor of end
.
- Parameters
-
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. |
- Returns
- Length of the ith subrange.
Definition at line 50 of file chunk.hpp.