| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file comm_info.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Nov 21 13:27:22 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Stores some MPI-relevant information.
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef COMM_INFO_HPP_
|
|---|
| 11 | #define COMM_INFO_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #ifndef HAVE_MPI
|
|---|
| 14 | #error MPI is needed to compile this class
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | #include <map>
|
|---|
| 18 |
|
|---|
| 19 | #include "base/tuple.hpp"
|
|---|
| 20 | #include "comm/mpi/key.hpp"
|
|---|
| 21 |
|
|---|
| 22 | namespace VMG
|
|---|
| 23 | {
|
|---|
| 24 |
|
|---|
| 25 | class Index;
|
|---|
| 26 | class Grid;
|
|---|
| 27 | class GridIteratorSet;
|
|---|
| 28 |
|
|---|
| 29 | namespace MPI
|
|---|
| 30 | {
|
|---|
| 31 |
|
|---|
| 32 | class CommInfo
|
|---|
| 33 | {
|
|---|
| 34 | public:
|
|---|
| 35 | CommInfo();
|
|---|
| 36 | virtual ~CommInfo();
|
|---|
| 37 |
|
|---|
| 38 | MPI_Comm GetCommunicator(const Grid& grid);
|
|---|
| 39 | MPI_Comm GetUnionCommunicator(const Grid& grid_1, const Grid& grid_2);
|
|---|
| 40 |
|
|---|
| 41 | MPI_Datatype GetDatatypeSubarray(const Grid& grid, const GridIteratorSet& bounds);
|
|---|
| 42 | MPI_Datatype GetDatatypeSubarray(const Index& begin, const Index& end, const Index& size_total);
|
|---|
| 43 |
|
|---|
| 44 | Index Pos(const Grid& grid);
|
|---|
| 45 | Index Procs(const Grid& grid);
|
|---|
| 46 |
|
|---|
| 47 | void SetCommGlobal(MPI_Comm& comm_global_)
|
|---|
| 48 | {
|
|---|
| 49 | comm_global = comm_global_;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | private:
|
|---|
| 53 | std::map<Key, MPI_Comm> communicators;
|
|---|
| 54 | std::map<Key, MPI_Datatype> datatypes;
|
|---|
| 55 |
|
|---|
| 56 | MPI_Comm comm_global;
|
|---|
| 57 | int max_level;
|
|---|
| 58 |
|
|---|
| 59 | static Index GetGlobalDims(MPI_Comm comm, Index pos);
|
|---|
| 60 | };
|
|---|
| 61 |
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | #endif /* COMM_INFO_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.