VIPRA Documentation
Loading...
Searching...
No Matches
mpi_types.hpp
1#pragma once
2
3#ifdef VIPRA_USE_MPI
4#include <mpi.h>
5namespace VIPRA::Util {
6
7template <typename data_t>
8[[nodiscard]] inline auto get_mpi_type() -> MPI_Datatype;
9
10template <>
11[[nodiscard]] inline auto get_mpi_type<double>() -> MPI_Datatype
12{
13 return MPI_DOUBLE;
14}
15
16template <>
17[[nodiscard]] inline auto get_mpi_type<char>() -> MPI_Datatype
18{
19 return MPI_CHAR;
20}
21
22template <>
23[[nodiscard]] inline auto get_mpi_type<int8_t>() -> MPI_Datatype
24{
25 return MPI_INT8_T;
26}
27
28template <>
29[[nodiscard]] inline auto get_mpi_type<int16_t>() -> MPI_Datatype
30{
31 return MPI_INT16_T;
32}
33
34template <>
35[[nodiscard]] inline auto get_mpi_type<int>() -> MPI_Datatype
36{
37 return MPI_INT;
38}
39
40template <>
41[[nodiscard]] inline auto get_mpi_type<int64_t>() -> MPI_Datatype
42{
43 return MPI_INT64_T;
44}
45
46} // namespace VIPRA::Util
47#endif