Tensorium
Loading...
Searching...
No Matches
MPI_init.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef MORPHEUS_USE_MPI
4# include <mpi.h>
5#endif
6
7namespace tensorium {
8 namespace mpi {
9
10#ifdef MORPHEUS_USE_MPI
11
12 inline void init(int *argc, char ***argv) {
14 }
15
16 inline void finalize() {
18 }
19
20 inline int rank() {
21 int rank;
23 return rank;
24 }
25
26 inline int size() {
27 int size;
29 return size;
30 }
31
32 inline void barrier() {
34 }
35
36 inline void send(const void* data, int count, MPI_Datatype type, int dest, int tag) {
37 MPI_Send(data, count, type, dest, tag, MPI_COMM_WORLD);
38 }
39
40 inline void recv(void* data, int count, MPI_Datatype type, int source, int tag) {
42 }
43
44 inline void bcast(void* data, int count, MPI_Datatype type, int root) {
45 MPI_Bcast(data, count, type, root, MPI_COMM_WORLD);
46 }
47
48 inline void allreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype type, MPI_Op op) {
50 }
51
52 inline void reduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype type, MPI_Op op, int root) {
54 }
55
56 inline void gather(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
57 void* recvbuf, int recvcount, MPI_Datatype recvtype, int root) {
59 }
60
61 inline void scatter(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
62 void* recvbuf, int recvcount, MPI_Datatype recvtype, int root) {
64 }
65
66#else // no MPI
67
68
69 inline void init(int*, char***) {}
70 inline void finalize() {}
71 inline int rank() { return 0; }
72 inline int size() { return 1; }
73 inline void barrier() {}
74
75 template<typename... Args>
76 inline void send(Args...) {}
77
78 template<typename... Args>
79 inline void recv(Args...) {}
80
81 template<typename... Args>
82 inline void bcast(Args...) {}
83
84 template<typename... Args>
85 inline void allreduce(Args...) {}
86
87 template<typename... Args>
88 inline void reduce(Args...) {}
89
90 template<typename... Args>
91 inline void gather(Args...) {}
92
93 template<typename... Args>
94 inline void scatter(Args...) {}
95
96#endif // MORPHEUS_USE_MPI
97
98 }
99}
Multi-dimensional tensor class with fixed rank and SIMD support.
Definition Tensor.hpp:25
void scatter(Args...)
Definition MPI_init.hpp:94
void send(Args...)
Definition MPI_init.hpp:76
void allreduce(Args...)
Definition MPI_init.hpp:85
void finalize()
Definition MPI_init.hpp:70
void reduce(Args...)
Definition MPI_init.hpp:88
void gather(Args...)
Definition MPI_init.hpp:91
int rank()
Definition MPI_init.hpp:71
void bcast(Args...)
Definition MPI_init.hpp:82
void recv(Args...)
Definition MPI_init.hpp:79
void barrier()
Definition MPI_init.hpp:73
void init(int *, char ***)
Definition MPI_init.hpp:69
int size()
Definition MPI_init.hpp:72
Definition Derivate.hpp:24