[382] | 1 | #ifndef __XIOS_MPI_HPP__ |
---|
| 2 | #define __XIOS_MPI_HPP__ |
---|
| 3 | |
---|
| 4 | /* skip C++ Binding for mpich , intel MPI */ |
---|
| 5 | #define MPICH_SKIP_MPICXX |
---|
| 6 | |
---|
| 7 | /* skip C++ Binding for SGI MPI library */ |
---|
| 8 | #define MPI_NO_CPPBIND |
---|
| 9 | |
---|
| 10 | /* skip C++ Binding for OpenMPI */ |
---|
| 11 | #define OMPI_SKIP_MPICXX |
---|
| 12 | |
---|
| 13 | #include <mpi.h> |
---|
[1759] | 14 | #include <climits> |
---|
| 15 | #include <cstdint> |
---|
[382] | 16 | |
---|
[1759] | 17 | #if SIZE_MAX == UCHAR_MAX |
---|
| 18 | #define MPI_SIZE_T MPI_UNSIGNED_CHAR |
---|
| 19 | #elif SIZE_MAX == USHRT_MAX |
---|
| 20 | #define MPI_SIZE_T MPI_UNSIGNED_SHORT |
---|
| 21 | #elif SIZE_MAX == UINT_MAX |
---|
| 22 | #define MPI_SIZE_T MPI_UNSIGNED |
---|
| 23 | #elif SIZE_MAX == ULONG_MAX |
---|
| 24 | #define MPI_SIZE_T MPI_UNSIGNED_LONG |
---|
| 25 | #elif SIZE_MAX == ULLONG_MAX |
---|
| 26 | #define MPI_SIZE_T MPI_UNSIGNED_LONG_LONG |
---|
| 27 | #else |
---|
| 28 | #error "Unable to find MPI_SIZE_T equivalent type" |
---|
[382] | 29 | #endif |
---|
[1759] | 30 | |
---|
| 31 | #include "mpi_tools.hpp" |
---|
| 32 | |
---|
[2584] | 33 | namespace xios |
---|
[2576] | 34 | { |
---|
[2584] | 35 | inline int MPI_Comm_dup(::MPI_Comm comm, ::MPI_Comm * newcomm) |
---|
| 36 | { |
---|
| 37 | int ret=::MPI_Comm_dup(comm, newcomm) ; |
---|
| 38 | xios::CCommTrack::registerComm(*newcomm) ; |
---|
| 39 | return ret ; |
---|
| 40 | } |
---|
[2576] | 41 | |
---|
[2584] | 42 | inline int MPI_Intercomm_create(::MPI_Comm local_comm, int local_leader, |
---|
| 43 | ::MPI_Comm peer_comm, int remote_leader, int tag, ::MPI_Comm * newintercomm) |
---|
| 44 | { |
---|
| 45 | int ret=::MPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, newintercomm) ; |
---|
| 46 | xios::CCommTrack::registerComm(*newintercomm) ; |
---|
| 47 | return ret ; |
---|
| 48 | } |
---|
[2576] | 49 | |
---|
[2584] | 50 | inline int MPI_Intercomm_merge(::MPI_Comm intercomm, int high, ::MPI_Comm * newintracomm) |
---|
| 51 | { |
---|
| 52 | int ret=::MPI_Intercomm_merge(intercomm, high, newintracomm) ; |
---|
| 53 | xios::CCommTrack::registerComm(*newintracomm) ; |
---|
| 54 | return ret ; |
---|
| 55 | } |
---|
[2576] | 56 | |
---|
[2584] | 57 | inline int MPI_Comm_split(::MPI_Comm comm, int color, int key, ::MPI_Comm * newcomm) |
---|
| 58 | { |
---|
| 59 | int ret=::MPI_Comm_split(comm, color, key,newcomm) ; |
---|
| 60 | xios::CCommTrack::registerComm(*newcomm) ; |
---|
| 61 | return ret ; |
---|
| 62 | } |
---|
[2576] | 63 | |
---|
[2584] | 64 | inline int MPI_Comm_create(::MPI_Comm comm, ::MPI_Group group, ::MPI_Comm *newcomm) |
---|
| 65 | { |
---|
| 66 | int ret=::MPI_Comm_create(comm, group, newcomm) ; |
---|
| 67 | xios::CCommTrack::registerComm(*newcomm) ; |
---|
| 68 | return ret ; |
---|
| 69 | } |
---|
[2576] | 70 | |
---|
[2584] | 71 | inline int MPI_Comm_free(::MPI_Comm *comm) |
---|
| 72 | { |
---|
| 73 | xios::CCommTrack::releaseComm(*comm) ; |
---|
| 74 | return ::MPI_Comm_free(comm) ; |
---|
| 75 | } |
---|
[2576] | 76 | } |
---|
| 77 | |
---|
[1759] | 78 | #endif |
---|