1 | #ifndef __MPI_ROUTING_HPP__ |
---|
2 | #define __MPI_ROUTING_HPP__ |
---|
3 | |
---|
4 | #include "mpi.hpp" |
---|
5 | #include <vector> |
---|
6 | #include "mpi_cascade.hpp" |
---|
7 | |
---|
8 | namespace sphereRemap { |
---|
9 | |
---|
10 | class CMPIRouting |
---|
11 | { |
---|
12 | |
---|
13 | MPI_Comm communicator; |
---|
14 | int mpiRank; |
---|
15 | int mpiSize; |
---|
16 | |
---|
17 | int nbSource; |
---|
18 | int *sourceRank; |
---|
19 | std::vector<int> nbSourceElement; |
---|
20 | int totalSourceElement; |
---|
21 | std::vector<int> sourceElementIndex; |
---|
22 | |
---|
23 | int nbTarget; |
---|
24 | int *targetRank; |
---|
25 | std::vector<int> nbTargetElement; |
---|
26 | std::vector<int> targetElementIndex; |
---|
27 | int totalTargetElement; |
---|
28 | |
---|
29 | |
---|
30 | public: |
---|
31 | CMPIRouting(MPI_Comm comm); |
---|
32 | ~CMPIRouting(); |
---|
33 | template<typename T> void init(const std::vector<T>& route, CMPICascade *cascade = NULL); |
---|
34 | int getTotalSourceElement(void); |
---|
35 | |
---|
36 | template<typename T> void transferToTarget(T *targetElement, T *sourceElement); |
---|
37 | template<typename T, typename t_pack, typename t_unpack> void transferToTarget(T *targetElement, T *sourceElement, t_pack pack, t_unpack unpack); |
---|
38 | |
---|
39 | template<typename T> void transferFromSource(T *targetElement, T *sourceElement); |
---|
40 | template<typename T, typename t_pack, typename t_unpack> void transferFromSource(T *targetElement, T *sourceElement, t_pack pack, t_unpack unpack); |
---|
41 | |
---|
42 | }; |
---|
43 | |
---|
44 | template <typename T> |
---|
45 | void alltoalls_known(const std::vector<std::vector<T> >& send, std::vector<std::vector<T> >& recv, |
---|
46 | const std::vector<int>& ranks, MPI_Comm communicator); |
---|
47 | |
---|
48 | template <typename T> |
---|
49 | void alltoalls_unknown(const std::vector<std::vector<T> >& send, std::vector<std::vector<T> >& recv, |
---|
50 | const std::vector<int>& ranks, MPI_Comm communicator); |
---|
51 | } |
---|
52 | #endif |
---|