5 #ifndef FML_PAR_INTERNALS_MPI_UTILS_H
6 #define FML_PAR_INTERNALS_MPI_UTILS_H
17 static const int REDUCE_TO_ALL = -1;
21 static inline void check_MPI_ret(
int ret)
23 if (ret != MPI_SUCCESS)
26 char s[MPI_MAX_ERROR_STRING];
28 MPI_Error_string(ret, s, &slen);
29 throw std::runtime_error(s);
35 static inline void contig_type(
const int count,
const float *x,
36 MPI_Datatype *newtype)
41 ret = MPI_Type_contiguous(count, MPI_FLOAT, newtype);
43 ret = MPI_Type_commit(newtype);
47 static inline void contig_type(
const int count,
const double *x,
48 MPI_Datatype *newtype)
53 ret = MPI_Type_contiguous(count, MPI_DOUBLE, newtype);
55 ret = MPI_Type_commit(newtype);