OpenMPI 0.1.1

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

- File List
- Globals

topo.h
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #ifndef MCA_TOPO_H
21 #define MCA_TOPO_H
22
23 #include "ompi_config.h"
24
25 #include "opal/mca/mca.h"
26 #include "opal/mca/base/base.h"
27 #include "ompi/communicator/communicator.h"
28
29 /*
30 * ******************************************************************
31 * ********** Use in components that are of type topo v2.0.0 ********
32 * ******************************************************************
33 */
34 #define MCA_TOPO_BASE_VERSION_2_0_0 \
35 MCA_BASE_VERSION_2_0_0, \
36 "topo", 2, 0, 0
37 /*
38 * ******************************************************************
39 * **************************** Macro ends **************************
40 * ******************************************************************
41 */
42
43 /*
44 * These are the component function prototypes. These function pointers
45 * go into the component structure. These functions (query() and finalize()
46 * are called during topo_base_select(). Each component is query() ied
47 * and subsequently, all the unselected components are finalize() 'ed
48 * so that any *stuff* they did during query() can be undone. By
49 * similar logic, finalize() is also called on the component which
50 * was selected when the communicator is being destroyed.
51 *
52 * So, to sum it up, every component carries 4 functions:
53 * 1. open() - called during MPI_INIT
54 * 2. close() - called during MPI_FINALIZE
55 * 3. query() - called to select a particular component
56 * 4. finalize() - called when actions taken during query have
57 * to be undone
58 */
59
60 /*
61 * **************** component struct *******************************
62 * *********** These functions go in the component struct **********
63 * **************** component struct *******************************
64 */
65 typedef int (*mca_topo_base_component_init_query_1_0_0_fn_t)
66 (bool enable_progress_threads,
67 bool enable_mpi_threads);
68
69 typedef struct mca_topo_base_module_1_0_0_t*
70 (*mca_topo_base_component_comm_query_1_0_0_fn_t) (int *priority);
71
72
73 typedef int (*mca_topo_base_component_comm_unquery_1_0_0_fn_t)
74 (struct ompi_communicator_t *comm);
75
76 /*
77 * ****************** component struct ******************************
78 * Structure for topo v2.0.0 components.This is chained to MCA v2.0.0
79 * ****************** component struct ******************************
80 */
81 struct mca_topo_base_component_2_0_0_t {
82 mca_base_component_t topom_version;
83 mca_base_component_data_t topom_data;
84
85 mca_topo_base_component_init_query_1_0_0_fn_t topom_init_query;
86 mca_topo_base_component_comm_query_1_0_0_fn_t topom_comm_query;
87 mca_topo_base_component_comm_unquery_1_0_0_fn_t topom_comm_unquery;
88 };
89 typedef struct mca_topo_base_component_2_0_0_t mca_topo_base_component_2_0_0_t;
90 typedef mca_topo_base_component_2_0_0_t mca_topo_base_component_t;
91
92 /*
93 * ******************************************************************
94 * *********************** component struct ends here ***************
95 * ******************************************************************
96 */
97 /*
98 * ******************************************************************
99 * *********************** information structure *******************
100 * Note for component authors:
101 * If you find that this is not the most convinient form of
102 * representing your topology, then please feel free to define your
103 * own structure in which this struct is the first element. That way,
104 * type casting can be used to communicate between 2 different topo
105 * components. Note that this representation must be filled up no
106 * matter what the actual topo structure might be.
107 * ******************************************************************
108 */
109
110 struct mca_topo_base_comm_1_0_0_t {
111
112 /* The first section represents data which is passed on to the
113 * structure by the user when creating the topology. This info
114 * is cached on so that if required another component can create the
115 * topology again when comm_dup fails to pick the same component */
116
117 int mtc_ndims_or_nnodes; /**< Number of cart dimensions or graph nodes */
118 int *mtc_dims_or_index; /**< Cart dimensions or graph indices */
119 int *mtc_periods_or_edges; /**< whether this was a periodic cart or graph */
120 bool mtc_reorder; /**< Whether the re-ordering is allowed */
121
122 /* The second section is used by the unity component since it does not
123 * hang its own structure off the communicator. Any component which wishes
124 * to use the base/topo_base* functions to fill in their unimplemented
125 * functions should and must fill this portion up */
126
127 int *mtc_coords; /**< Cart coordinates */
128 };
129 typedef struct mca_topo_base_comm_1_0_0_t mca_topo_base_comm_1_0_0_t;
130 typedef mca_topo_base_comm_1_0_0_t mca_topo_base_comm_t;
131
132 /*
133 * ******************************************************************
134 * *********************** information structure ******************
135 * ******************************************************************
136 */
137
138 struct ompi_proc_t;
139
140 /*
141 * ***********************************************************************
142 * ************************ Interface function definitions **************
143 * These are the typedefs for the function pointers to various topology
144 * backend functions which will be used by the various topology components
145 * ***********************************************************************
146 */
147 typedef int (*mca_topo_base_module_init_1_0_0_fn_t)
148 (struct ompi_communicator_t *comm);
149
150 typedef int (*mca_topo_base_module_finalize_1_0_0_fn_t)
151 (struct ompi_communicator_t *comm);
152
153 typedef int (*mca_topo_base_module_cart_coords_fn_t)
154 (struct ompi_communicator_t *comm,
155 int rank,
156 int maxdims,
157 int *coords);
158
159 typedef int (*mca_topo_base_module_cart_create_fn_t)
160 (mca_topo_base_comm_t *topo_data,
161 int *proc_count,
162 struct ompi_proc_t **proc_pointers,
163 int *new_rank,
164 int ndims,
165 int *dims,
166 int *periods,
167 bool redorder);
168
169 typedef int (*mca_topo_base_module_cart_get_fn_t)
170 (struct ompi_communicator_t *comm,
171 int maxdims,
172 int *dims,
173 int *periods,
174 int *coords);
175
176 typedef int (*mca_topo_base_module_cartdim_get_fn_t)
177 (struct ompi_communicator_t *comm,
178 int *ndims);
179
180 typedef int (*mca_topo_base_module_cart_map_fn_t)
181 (struct ompi_communicator_t *comm,
182 int ndims,
183 int *dims,
184 int *periods,
185 int *newrank);
186
187 typedef int (*mca_topo_base_module_cart_rank_fn_t)
188 (struct ompi_communicator_t *comm,
189 int *coords,
190 int *rank);
191
192 typedef int (*mca_topo_base_module_cart_shift_fn_t)
193 (struct ompi_communicator_t *comm,
194 int direction,
195 int disp,
196 int *rank_source,
197 int *rank_dest);
198
199 typedef int (*mca_topo_base_module_cart_sub_fn_t)
200 (struct ompi_communicator_t *comm,
201 int *remain_dims,
202 struct ompi_communicator_t ** new_comm);
203
204 typedef int (*mca_topo_base_module_graph_create_fn_t)
205 (mca_topo_base_comm_t *topo_data,
206 int *proc_count,
207 struct ompi_proc_t **proc_pointers,
208 int *new_rank,
209 int nnodes,
210 int *index,
211 int *edges,
212 bool reorder);
213
214 typedef int (*mca_topo_base_module_graph_get_fn_t)
215 (struct ompi_communicator_t *comm,
216 int maxindex,
217 int maxedges,
218 int *index,
219 int *edges);
220
221 typedef int (*mca_topo_base_module_graph_map_fn_t)
222 (struct ompi_communicator_t *comm,
223 int nnodes,
224 int *index,
225 int *edges,
226 int *newrank);
227
228 typedef int (*mca_topo_base_module_graphdims_get_fn_t)
229 (struct ompi_communicator_t *comm,
230 int *nnodes,
231 int *nnedges);
232
233 typedef int (*mca_topo_base_module_graph_neighbors_fn_t)
234 (struct ompi_communicator_t *comm,
235 int rank,
236 int maxneighbors,
237 int *neighbors);
238
239 typedef int (*mca_topo_base_module_graph_neighbors_count_fn_t)
240 (struct ompi_communicator_t *comm,
241 int rank,
242 int *nneighbors);
243
244 /*
245 * ***********************************************************************
246 * ******************** Interface function definitions end **************
247 * ***********************************************************************
248 */
249
250 /*
251 * ***********************************************************************
252 * *************************** module structure *************************
253 * ***********************************************************************
254 */
255 struct mca_topo_base_module_1_0_0_t {
256 /*
257 * Per-communicator initialization function. This is called only
258 * on the module which is selected. The finalize corresponding to
259 * this function is present on the component struct above
260 */
261 mca_topo_base_module_init_1_0_0_fn_t topo_module_init;
262 mca_topo_base_module_finalize_1_0_0_fn_t topo_module_finalize;
263
264 /* Graph related functions */
265 mca_topo_base_module_cart_coords_fn_t topo_cart_coords;
266 mca_topo_base_module_cart_create_fn_t topo_cart_create;
267 mca_topo_base_module_cart_get_fn_t topo_cart_get;
268 mca_topo_base_module_cartdim_get_fn_t topo_cartdim_get;
269 mca_topo_base_module_cart_map_fn_t topo_cart_map;
270 mca_topo_base_module_cart_rank_fn_t topo_cart_rank;
271 mca_topo_base_module_cart_shift_fn_t topo_cart_shift;
272 mca_topo_base_module_cart_sub_fn_t topo_cart_sub;
273 mca_topo_base_module_graph_create_fn_t topo_graph_create;
274 mca_topo_base_module_graph_get_fn_t topo_graph_get;
275 mca_topo_base_module_graph_map_fn_t topo_graph_map;
276 mca_topo_base_module_graphdims_get_fn_t topo_graphdims_get;
277 mca_topo_base_module_graph_neighbors_fn_t topo_graph_neighbors;
278 mca_topo_base_module_graph_neighbors_count_fn_t topo_graph_neighbors_count;
279 };
280 typedef struct mca_topo_base_module_1_0_0_t mca_topo_base_module_1_0_0_t;
281 typedef mca_topo_base_module_1_0_0_t mca_topo_base_module_t;
282 /*
283 * ***********************************************************************
284 * ******************* component actions structure ends *****************
285 * ***********************************************************************
286 */
287
288
289 #endif /* MCA_TOPO_H */
mca_topo_base_comm_1_0_0_t::mtc_coords
int * mtc_coords
Cart coordinates.
Definition: topo.h:127
mca_topo_base_comm_1_0_0_t
Definition: topo.h:110
mca_base_component_2_0_0_t
Common type for all MCA components.
Definition: mca.h:250
mca_topo_base_comm_1_0_0_t::mtc_periods_or_edges
int * mtc_periods_or_edges
whether this was a periodic cart or graph
Definition: topo.h:119
ompi_proc_t
Remote Open MPI process structure.
Definition: proc.h:56
mca_topo_base_comm_1_0_0_t::mtc_ndims_or_nnodes
int mtc_ndims_or_nnodes
Number of cart dimensions or graph nodes.
Definition: topo.h:117
mca_topo_base_comm_1_0_0_t::mtc_dims_or_index
int * mtc_dims_or_index
Cart dimensions or graph indices.
Definition: topo.h:118
mca.h
Top-level interface for all MCA components.
mca_topo_base_comm_1_0_0_t::mtc_reorder
bool mtc_reorder
Whether the re-ordering is allowed.
Definition: topo.h:120
mca_topo_base_component_2_0_0_t
Definition: topo.h:81
mca_base_component_data_2_0_0_t
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
mca_topo_base_module_1_0_0_t
Definition: topo.h:255
ompi_communicator_t
Definition: communicator.h:118