File indexing completed on 2025-01-18 09:54:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "corecel/Config.hh"
0012
0013 #if CELERITAS_USE_MPI
0014 # include <mpi.h>
0015 #endif
0016
0017 namespace celeritas
0018 {
0019 namespace detail
0020 {
0021
0022 #if CELERITAS_USE_MPI
0023
0024
0025 using MpiComm = MPI_Comm;
0026
0027 #else
0028
0029
0030
0031 struct MpiComm
0032 {
0033 int value_;
0034 };
0035
0036 constexpr inline bool operator==(MpiComm a, MpiComm b)
0037 {
0038 return a.value_ == b.value_;
0039 }
0040
0041 constexpr inline bool operator!=(MpiComm a, MpiComm b)
0042 {
0043 return !(a == b);
0044 }
0045
0046
0047 #endif
0048
0049
0050
0051 inline MpiComm mpi_comm_null()
0052 {
0053 #if CELERITAS_USE_MPI
0054 return MPI_COMM_NULL;
0055 #else
0056 return {0};
0057 #endif
0058 }
0059
0060
0061 inline MpiComm mpi_comm_world()
0062 {
0063 #if CELERITAS_USE_MPI
0064 return MPI_COMM_WORLD;
0065 #else
0066 return {1};
0067 #endif
0068 }
0069
0070
0071 inline MpiComm mpi_comm_self()
0072 {
0073 #if CELERITAS_USE_MPI
0074 return MPI_COMM_SELF;
0075 #else
0076 return {-1};
0077 #endif
0078 }
0079
0080
0081 }
0082 }