OpenMPI 0.1.1

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

- File List
- Globals

coll_sync.h
1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 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) 2008-2009 Cisco Systems, Inc. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #ifndef MCA_COLL_SYNC_EXPORT_H
21 #define MCA_COLL_SYNC_EXPORT_H
22
23 #include "ompi_config.h"
24
25 #include "mpi.h"
26
27 #include "opal/class/opal_object.h"
28 #include "opal/mca/mca.h"
29
30 #include "ompi/constants.h"
31 #include "ompi/mca/coll/coll.h"
32 #include "ompi/mca/coll/base/base.h"
33 #include "ompi/communicator/communicator.h"
34
35 BEGIN_C_DECLS
36
37 /* API functions */
38
39 int mca_coll_sync_init_query(bool enable_progress_threads,
40 bool enable_mpi_threads);
41 mca_coll_base_module_t
42 *mca_coll_sync_comm_query(struct ompi_communicator_t *comm,
43 int *priority);
44
45 int mca_coll_sync_module_enable(mca_coll_base_module_t *module,
46 struct ompi_communicator_t *comm);
47
48 int mca_coll_sync_barrier(struct ompi_communicator_t *comm,
49 mca_coll_base_module_t *module);
50
51 int mca_coll_sync_bcast(void *buff, int count,
52 struct ompi_datatype_t *datatype,
53 int root,
54 struct ompi_communicator_t *comm,
55 mca_coll_base_module_t *module);
56
57 int mca_coll_sync_exscan(void *sbuf, void *rbuf, int count,
58 struct ompi_datatype_t *dtype,
59 struct ompi_op_t *op,
60 struct ompi_communicator_t *comm,
61 mca_coll_base_module_t *module);
62
63 int mca_coll_sync_gather(void *sbuf, int scount,
64 struct ompi_datatype_t *sdtype,
65 void *rbuf, int rcount,
66 struct ompi_datatype_t *rdtype,
67 int root,
68 struct ompi_communicator_t *comm,
69 mca_coll_base_module_t *module);
70
71 int mca_coll_sync_gatherv(void *sbuf, int scount,
72 struct ompi_datatype_t *sdtype,
73 void *rbuf, int *rcounts, int *disps,
74 struct ompi_datatype_t *rdtype,
75 int root,
76 struct ompi_communicator_t *comm,
77 mca_coll_base_module_t *module);
78
79 int mca_coll_sync_reduce(void *sbuf, void *rbuf, int count,
80 struct ompi_datatype_t *dtype,
81 struct ompi_op_t *op,
82 int root,
83 struct ompi_communicator_t *comm,
84 mca_coll_base_module_t *module);
85
86 int mca_coll_sync_reduce_scatter(void *sbuf, void *rbuf,
87 int *rcounts,
88 struct ompi_datatype_t *dtype,
89 struct ompi_op_t *op,
90 struct ompi_communicator_t *comm,
91 mca_coll_base_module_t *module);
92
93 int mca_coll_sync_scan(void *sbuf, void *rbuf, int count,
94 struct ompi_datatype_t *dtype,
95 struct ompi_op_t *op,
96 struct ompi_communicator_t *comm,
97 mca_coll_base_module_t *module);
98
99 int mca_coll_sync_scatter(void *sbuf, int scount,
100 struct ompi_datatype_t *sdtype,
101 void *rbuf, int rcount,
102 struct ompi_datatype_t *rdtype,
103 int root,
104 struct ompi_communicator_t *comm,
105 mca_coll_base_module_t *module);
106
107 int mca_coll_sync_scatterv(void *sbuf, int *scounts, int *disps,
108 struct ompi_datatype_t *sdtype,
109 void *rbuf, int rcount,
110 struct ompi_datatype_t *rdtype,
111 int root,
112 struct ompi_communicator_t *comm,
113 mca_coll_base_module_t *module);
114
115 int mca_coll_sync_ft_event(int status);
116
117 /* Types */
118 /* Module */
119
120 typedef struct mca_coll_sync_module_t {
121 mca_coll_base_module_t super;
122
123 /* Pointers to all the "real" collective functions */
124 mca_coll_base_comm_coll_t c_coll;
125
126 /* How many ops we've executed */
127 int before_num_operations;
128
129 /* How many ops we've executed (it's easier to have 2) */
130 int after_num_operations;
131
132 /* Avoid recursion of syncs */
133 bool in_operation;
134 } mca_coll_sync_module_t;
135
136 OBJ_CLASS_DECLARATION(mca_coll_sync_module_t);
137
138 /* Component */
139
140 typedef struct mca_coll_sync_component_t {
141 mca_coll_base_component_2_0_0_t super;
142
143 /* Priority of this component */
144 int priority;
145
146 /* Do a sync *before* each Nth collective */
147 int barrier_before_nops;
148
149 /* Do a sync *after* each Nth collective */
150 int barrier_after_nops;
151 } mca_coll_sync_component_t;
152
153 /* Globally exported variables */
154
155 OMPI_MODULE_DECLSPEC extern mca_coll_sync_component_t mca_coll_sync_component;
156
157 /* Macro used in most of the collectives */
158
159 #define COLL_SYNC(module, op) \
160 do { \
161 int err = MPI_SUCCESS; \
162 s->in_operation = true; \
163 if (OPAL_UNLIKELY(++s->before_num_operations == \
164 mca_coll_sync_component.barrier_before_nops)) { \
165 s->before_num_operations = 0; \
166 err = s->c_coll.coll_barrier(comm, s->c_coll.coll_barrier_module); \
167 } \
168 if (OPAL_LIKELY(MPI_SUCCESS == err)) { \
169 err = op; \
170 } \
171 if (OPAL_UNLIKELY(++s->after_num_operations == \
172 mca_coll_sync_component.barrier_after_nops) && \
173 OPAL_LIKELY(MPI_SUCCESS == err)) { \
174 s->after_num_operations = 0; \
175 err = s->c_coll.coll_barrier(comm, s->c_coll.coll_barrier_module); \
176 } \
177 s->in_operation = false; \
178 return err; \
179 } while(0)
180
181 END_C_DECLS
182
183 #endif /* MCA_COLL_SYNC_EXPORT_H */
mca_coll_base_module_2_0_0_t
Collective module interface.
Definition: coll.h:316
ompi_datatype_t
Definition: ompi_datatype.h:68
mca_coll_base_component_2_0_0_t
Collective component interface.
Definition: coll.h:283
base.h
MCA coll base framework public interface functions.
mca.h
Top-level interface for all MCA components.
coll.h
Collective Communication Interface.
mca_coll_sync_component_t
Definition: coll_sync.h:140
opal_object.h
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
ompi_communicator_t
Definition: communicator.h:118
ompi_op_t
Back-end type of MPI_Op.
Definition: op.h:100
mca_coll_base_comm_coll_t
Collectives communicator cache structure.
Definition: coll.h:367
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
mca_coll_sync_module_t
Definition: coll_sync.h:120