| 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 <mpi.h>
|
|---|
| 18 |
|
|---|
| 19 | #include <map>
|
|---|
| 20 |
|
|---|
| 21 | #include "base/tuple.hpp"
|
|---|
| 22 | #include "comm/mpi/key.hpp"
|
|---|
| 23 |
|
|---|
| 24 | namespace VMG
|
|---|
| 25 | {
|
|---|
| 26 |
|
|---|
| 27 | class Index;
|
|---|
| 28 | class Grid;
|
|---|
| 29 | class GridIteratorSet;
|
|---|
| 30 |
|
|---|
| 31 | namespace MPI
|
|---|
| 32 | {
|
|---|
| 33 |
|
|---|
| 34 | class CommInfo
|
|---|
| 35 | {
|
|---|
| 36 | public:
|
|---|
| 37 | CommInfo();
|
|---|
| 38 | virtual ~CommInfo();
|
|---|
| 39 |
|
|---|
| 40 | MPI_Comm GetCommunicator(const Grid& grid);
|
|---|
| 41 | MPI_Comm GetUnionCommunicator(const Grid& grid_1, const Grid& grid_2);
|
|---|
| 42 |
|
|---|
| 43 | MPI_Datatype GetDatatypeSubarray(const Grid& grid, const GridIteratorSet& bounds);
|
|---|
| 44 | MPI_Datatype GetDatatypeSubarray(const Index& begin, const Index& end, const Index& size_total);
|
|---|
| 45 |
|
|---|
| 46 | Index Pos(const Grid& grid);
|
|---|
| 47 | Index Procs(const Grid& grid);
|
|---|
| 48 |
|
|---|
| 49 | void SetCommGlobal(MPI_Comm& comm_global_)
|
|---|
| 50 | {
|
|---|
| 51 | comm_global = comm_global_;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | private:
|
|---|
| 55 | std::map<Key, MPI_Comm> communicators;
|
|---|
| 56 | std::map<Key, MPI_Datatype> datatypes;
|
|---|
| 57 |
|
|---|
| 58 | MPI_Comm comm_global;
|
|---|
| 59 | int max_level;
|
|---|
| 60 |
|
|---|
| 61 | static Index GetGlobalDims(MPI_Comm comm, Index pos);
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | #endif /* COMM_INFO_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.