OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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