This source file includes following definitions.
- mca_coll_sync_module_construct
- mca_coll_sync_module_destruct
- mca_coll_sync_init_query
- mca_coll_sync_comm_query
- mca_coll_sync_module_enable
- mca_coll_sync_ft_event
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "ompi_config.h"
24
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #include <stdio.h>
29
30 #include "coll_sync.h"
31
32 #include "mpi.h"
33
34 #include "opal/util/show_help.h"
35 #include "ompi/mca/rte/rte.h"
36
37 #include "ompi/constants.h"
38 #include "ompi/communicator/communicator.h"
39 #include "ompi/mca/coll/coll.h"
40 #include "ompi/mca/coll/base/base.h"
41 #include "coll_sync.h"
42
43
44 static void mca_coll_sync_module_construct(mca_coll_sync_module_t *module)
45 {
46 memset(&(module->c_coll), 0, sizeof(module->c_coll));
47 module->before_num_operations = 0;
48 module->after_num_operations = 0;
49 module->in_operation = false;
50 }
51
52 static void mca_coll_sync_module_destruct(mca_coll_sync_module_t *module)
53 {
54 OBJ_RELEASE(module->c_coll.coll_bcast_module);
55 OBJ_RELEASE(module->c_coll.coll_gather_module);
56 OBJ_RELEASE(module->c_coll.coll_gatherv_module);
57 OBJ_RELEASE(module->c_coll.coll_reduce_module);
58 OBJ_RELEASE(module->c_coll.coll_reduce_scatter_module);
59 OBJ_RELEASE(module->c_coll.coll_scatter_module);
60 OBJ_RELEASE(module->c_coll.coll_scatterv_module);
61
62
63
64 if (NULL != module->c_coll.coll_exscan_module) {
65 OBJ_RELEASE(module->c_coll.coll_exscan_module);
66 OBJ_RELEASE(module->c_coll.coll_scan_module);
67 }
68 }
69
70 OBJ_CLASS_INSTANCE(mca_coll_sync_module_t, mca_coll_base_module_t,
71 mca_coll_sync_module_construct,
72 mca_coll_sync_module_destruct);
73
74
75
76
77
78
79
80 int mca_coll_sync_init_query(bool enable_progress_threads,
81 bool enable_mpi_threads)
82 {
83
84 return OMPI_SUCCESS;
85 }
86
87
88
89
90
91
92
93 mca_coll_base_module_t *
94 mca_coll_sync_comm_query(struct ompi_communicator_t *comm,
95 int *priority)
96 {
97 mca_coll_sync_module_t *sync_module;
98
99
100 if (0 == mca_coll_sync_component.barrier_before_nops &&
101 0 == mca_coll_sync_component.barrier_after_nops) {
102 return NULL;
103 }
104
105 sync_module = OBJ_NEW(mca_coll_sync_module_t);
106 if (NULL == sync_module) {
107 return NULL;
108 }
109
110 *priority = mca_coll_sync_component.priority;
111
112
113 sync_module->super.coll_module_enable = mca_coll_sync_module_enable;
114 sync_module->super.ft_event = mca_coll_sync_ft_event;
115
116
117
118 sync_module->super.coll_allgather = NULL;
119 sync_module->super.coll_allgatherv = NULL;
120 sync_module->super.coll_allreduce = NULL;
121 sync_module->super.coll_alltoall = NULL;
122 sync_module->super.coll_alltoallv = NULL;
123 sync_module->super.coll_alltoallw = NULL;
124 sync_module->super.coll_barrier = NULL;
125 sync_module->super.coll_bcast = mca_coll_sync_bcast;
126 sync_module->super.coll_exscan = mca_coll_sync_exscan;
127 sync_module->super.coll_gather = mca_coll_sync_gather;
128 sync_module->super.coll_gatherv = mca_coll_sync_gatherv;
129 sync_module->super.coll_reduce = mca_coll_sync_reduce;
130 sync_module->super.coll_reduce_scatter = mca_coll_sync_reduce_scatter;
131 sync_module->super.coll_scan = mca_coll_sync_scan;
132 sync_module->super.coll_scatter = mca_coll_sync_scatter;
133 sync_module->super.coll_scatterv = mca_coll_sync_scatterv;
134
135 return &(sync_module->super);
136 }
137
138
139
140
141
142 int mca_coll_sync_module_enable(mca_coll_base_module_t *module,
143 struct ompi_communicator_t *comm)
144 {
145 bool good = true;
146 char *msg = NULL;
147 mca_coll_sync_module_t *s = (mca_coll_sync_module_t*) module;
148
149
150 s->c_coll = *comm->c_coll;
151
152 #define CHECK_AND_RETAIN(name) \
153 if (NULL == s->c_coll.coll_ ## name ## _module) { \
154 good = false; \
155 msg = #name; \
156 } else if (good) { \
157 OBJ_RETAIN(s->c_coll.coll_ ## name ## _module); \
158 }
159
160 CHECK_AND_RETAIN(bcast);
161 CHECK_AND_RETAIN(gather);
162 CHECK_AND_RETAIN(gatherv);
163 CHECK_AND_RETAIN(reduce);
164 CHECK_AND_RETAIN(reduce_scatter);
165 CHECK_AND_RETAIN(scatter);
166 CHECK_AND_RETAIN(scatterv);
167 if (!OMPI_COMM_IS_INTER(comm)) {
168
169 CHECK_AND_RETAIN(exscan);
170 CHECK_AND_RETAIN(scan);
171 }
172
173
174 if (good) {
175 return OMPI_SUCCESS;
176 }
177 opal_show_help("help-coll-sync.txt", "missing collective", true,
178 ompi_process_info.nodename,
179 mca_coll_sync_component.priority, msg);
180 return OMPI_ERR_NOT_FOUND;
181 }
182
183
184 int mca_coll_sync_ft_event(int state)
185 {
186 if (OPAL_CRS_CHECKPOINT == state) {
187 ;
188 }
189 else if (OPAL_CRS_CONTINUE == state) {
190 ;
191 }
192 else if (OPAL_CRS_RESTART == state) {
193 ;
194 }
195 else if (OPAL_CRS_TERM == state ) {
196 ;
197 }
198 else {
199 ;
200 }
201
202 return OMPI_SUCCESS;
203 }