[97] | 1 | // -*- c++ -*- |
---|
| 2 | // |
---|
| 3 | // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
---|
| 4 | // University Research and Technology |
---|
| 5 | // Corporation. All rights reserved. |
---|
| 6 | // Copyright (c) 2004-2005 The University of Tennessee and The University |
---|
| 7 | // of Tennessee Research Foundation. All rights |
---|
| 8 | // reserved. |
---|
| 9 | // Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
---|
| 10 | // University of Stuttgart. All rights reserved. |
---|
| 11 | // Copyright (c) 2004-2005 The Regents of the University of California. |
---|
| 12 | // All rights reserved. |
---|
| 13 | // $COPYRIGHT$ |
---|
| 14 | // |
---|
| 15 | // Additional copyrights may follow |
---|
| 16 | // |
---|
| 17 | // $HEADER$ |
---|
| 18 | // |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | class Cartcomm : public Intracomm { |
---|
| 22 | public: |
---|
| 23 | |
---|
| 24 | // construction |
---|
| 25 | Cartcomm() { } |
---|
| 26 | // copy |
---|
| 27 | Cartcomm(const Comm_Null& data) : Intracomm(data) { } |
---|
| 28 | // inter-language operability |
---|
| 29 | inline Cartcomm(const MPI_Comm& data); |
---|
| 30 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 31 | Cartcomm(const Cartcomm& data) : Intracomm(data), pmpi_comm(data) { } |
---|
| 32 | Cartcomm(const PMPI::Cartcomm& d) : |
---|
| 33 | Intracomm((const PMPI::Intracomm&)d), |
---|
| 34 | pmpi_comm(d) { } |
---|
| 35 | |
---|
| 36 | // assignment |
---|
| 37 | Cartcomm& operator=(const Cartcomm& data) { |
---|
| 38 | Intracomm::operator=(data); |
---|
| 39 | pmpi_comm = data.pmpi_comm; return *this; } |
---|
| 40 | Cartcomm& operator=(const Comm_Null& data) { |
---|
| 41 | Intracomm::operator=(data); |
---|
| 42 | pmpi_comm = (PMPI::Cartcomm)data; return *this; } |
---|
| 43 | // inter-language operability |
---|
| 44 | Cartcomm& operator=(const MPI_Comm& data) { |
---|
| 45 | Intracomm::operator=(data); |
---|
| 46 | pmpi_comm = data; return *this; } |
---|
| 47 | #else |
---|
| 48 | Cartcomm(const Cartcomm& data) : Intracomm(data.mpi_comm) { } |
---|
| 49 | // assignment |
---|
| 50 | Cartcomm& operator=(const Cartcomm& data) { |
---|
| 51 | mpi_comm = data.mpi_comm; return *this; } |
---|
| 52 | Cartcomm& operator=(const Comm_Null& data) { |
---|
| 53 | mpi_comm = data; return *this; } |
---|
| 54 | // inter-language operability |
---|
| 55 | Cartcomm& operator=(const MPI_Comm& data) { |
---|
| 56 | mpi_comm = data; return *this; } |
---|
| 57 | #endif |
---|
| 58 | // |
---|
| 59 | // Groups, Contexts, and Communicators |
---|
| 60 | // |
---|
| 61 | |
---|
| 62 | Cartcomm Dup() const; |
---|
| 63 | |
---|
| 64 | virtual Cartcomm& Clone() const; |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | // |
---|
| 68 | // Groups, Contexts, and Communicators |
---|
| 69 | // |
---|
| 70 | |
---|
| 71 | virtual int Get_dim() const; |
---|
| 72 | |
---|
| 73 | virtual void Get_topo(int maxdims, int dims[], bool periods[], |
---|
| 74 | int coords[]) const; |
---|
| 75 | |
---|
| 76 | virtual int Get_cart_rank(const int coords[]) const; |
---|
| 77 | |
---|
| 78 | virtual void Get_coords(int rank, int maxdims, int coords[]) const; |
---|
| 79 | |
---|
| 80 | virtual void Shift(int direction, int disp, |
---|
| 81 | int &rank_source, int &rank_dest) const; |
---|
| 82 | |
---|
| 83 | virtual Cartcomm Sub(const bool remain_dims[]); |
---|
| 84 | |
---|
| 85 | virtual int Map(int ndims, const int dims[], const bool periods[]) const; |
---|
| 86 | |
---|
| 87 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 88 | private: |
---|
| 89 | PMPI::Cartcomm pmpi_comm; |
---|
| 90 | #endif |
---|
| 91 | }; |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | //=================================================================== |
---|
| 95 | // Class Graphcomm |
---|
| 96 | //=================================================================== |
---|
| 97 | |
---|
| 98 | class Graphcomm : public Intracomm { |
---|
| 99 | public: |
---|
| 100 | |
---|
| 101 | // construction |
---|
| 102 | Graphcomm() { } |
---|
| 103 | // copy |
---|
| 104 | Graphcomm(const Comm_Null& data) : Intracomm(data) { } |
---|
| 105 | // inter-language operability |
---|
| 106 | inline Graphcomm(const MPI_Comm& data); |
---|
| 107 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 108 | Graphcomm(const Graphcomm& data) : Intracomm(data), pmpi_comm(data) { } |
---|
| 109 | Graphcomm(const PMPI::Graphcomm& d) : |
---|
| 110 | Intracomm((const PMPI::Intracomm&)d), pmpi_comm(d) { } |
---|
| 111 | |
---|
| 112 | // assignment |
---|
| 113 | Graphcomm& operator=(const Graphcomm& data) { |
---|
| 114 | Intracomm::operator=(data); |
---|
| 115 | pmpi_comm = data.pmpi_comm; return *this; } |
---|
| 116 | Graphcomm& operator=(const Comm_Null& data) { |
---|
| 117 | Intracomm::operator=(data); |
---|
| 118 | pmpi_comm = (PMPI::Graphcomm)data; return *this; } |
---|
| 119 | // inter-language operability |
---|
| 120 | Graphcomm& operator=(const MPI_Comm& data) { |
---|
| 121 | Intracomm::operator=(data); |
---|
| 122 | pmpi_comm = data; return *this; } |
---|
| 123 | |
---|
| 124 | #else |
---|
| 125 | Graphcomm(const Graphcomm& data) : Intracomm(data.mpi_comm) { } |
---|
| 126 | // assignment |
---|
| 127 | Graphcomm& operator=(const Graphcomm& data) { |
---|
| 128 | mpi_comm = data.mpi_comm; return *this; } |
---|
| 129 | Graphcomm& operator=(const Comm_Null& data) { |
---|
| 130 | mpi_comm = data; return *this; } |
---|
| 131 | // inter-language operability |
---|
| 132 | Graphcomm& operator=(const MPI_Comm& data) { |
---|
| 133 | mpi_comm = data; return *this; } |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | // |
---|
| 137 | // Groups, Contexts, and Communicators |
---|
| 138 | // |
---|
| 139 | |
---|
| 140 | Graphcomm Dup() const; |
---|
| 141 | |
---|
| 142 | virtual Graphcomm& Clone() const; |
---|
| 143 | |
---|
| 144 | // |
---|
| 145 | // Process Topologies |
---|
| 146 | // |
---|
| 147 | |
---|
| 148 | virtual void Get_dims(int nnodes[], int nedges[]) const; |
---|
| 149 | |
---|
| 150 | virtual void Get_topo(int maxindex, int maxedges, int index[], |
---|
| 151 | int edges[]) const; |
---|
| 152 | |
---|
| 153 | virtual int Get_neighbors_count(int rank) const; |
---|
| 154 | |
---|
| 155 | virtual void Get_neighbors(int rank, int maxneighbors, |
---|
| 156 | int neighbors[]) const; |
---|
| 157 | |
---|
| 158 | virtual int Map(int nnodes, const int index[], |
---|
| 159 | const int edges[]) const; |
---|
| 160 | |
---|
| 161 | #if 0 /* OMPI_ENABLE_MPI_PROFILING */ |
---|
| 162 | private: |
---|
| 163 | PMPI::Graphcomm pmpi_comm; |
---|
| 164 | #endif |
---|
| 165 | }; |
---|
| 166 | |
---|