1 // This Message Passing Interface mock header is used, to mock typedefs, 2 // constants and functions, required for integration tests being part of 3 // clang-tidy MPI checks. 4 5 #ifndef MPIMOCK_H 6 #define MPIMOCK_H 7 8 #define NULL 0 9 10 // These typedefs are used to mock MPI types, fixed width integer types and the 11 // templated C++ complex number type. 12 typedef int MPI_Datatype; 13 typedef int MPI_Comm; 14 typedef int MPI_Request; 15 typedef int MPI_Status; 16 typedef int MPI_Op; 17 typedef int int8_t; 18 typedef int uint8_t; 19 typedef int uint16_t; 20 typedef int int64_t; 21 namespace std { template<class T> struct complex { T real; T imag; }; } 22 23 // These defines are used to mock MPI constants. 24 #define MPI_DATATYPE_NULL 0 25 #define MPI_CHAR 0 26 #define MPI_BYTE 0 27 #define MPI_SHORT 0 28 #define MPI_INT 0 29 #define MPI_LONG 0 30 #define MPI_LONG_DOUBLE 0 31 #define MPI_UNSIGNED 0 32 #define MPI_INT8_T 0 33 #define MPI_UINT8_T 0 34 #define MPI_UINT16_T 0 35 #define MPI_C_FLOAT_COMPLEX 0 36 #define MPI_C_LONG_DOUBLE_COMPLEX 0 37 #define MPI_FLOAT 0 38 #define MPI_DOUBLE 0 39 #define MPI_CXX_BOOL 0 40 #define MPI_CXX_FLOAT_COMPLEX 0 41 #define MPI_CXX_DOUBLE_COMPLEX 0 42 #define MPI_CXX_LONG_DOUBLE_COMPLEX 0 43 #define MPI_IN_PLACE 0 44 #define MPI_COMM_WORLD 0 45 #define MPI_STATUS_IGNORE 0 46 #define MPI_STATUSES_IGNORE 0 47 #define MPI_SUM 0 48 49 // These declarations are used to mock MPI functions. 50 int MPI_Comm_size(MPI_Comm, int *); 51 int MPI_Comm_rank(MPI_Comm, int *); 52 int MPI_Send(const void *, int, MPI_Datatype, int, int, MPI_Comm); 53 int MPI_Recv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); 54 int MPI_Isend(const void *, int, MPI_Datatype, int, int, MPI_Comm, 55 MPI_Request *); 56 int MPI_Irecv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request *); 57 int MPI_Wait(MPI_Request *, MPI_Status *); 58 int MPI_Waitall(int, MPI_Request[], MPI_Status[]); 59 int MPI_Reduce(const void *, void *, int, MPI_Datatype, MPI_Op, int, MPI_Comm); 60 int MPI_Ireduce(const void *, void *, int, MPI_Datatype, MPI_Op, int, MPI_Comm, 61 MPI_Request *); 62 int MPI_Bcast(void *, int count, MPI_Datatype, int, MPI_Comm); 63 64 #endif // end of include guard: MPIMOCK_H 65