16
16
#include "ompi/mca/coll/coll.h"
17
17
#include "coll_acoll.h"
18
18
19
+
20
+ static int acoll_module_enable (mca_coll_base_module_t * module , struct ompi_communicator_t * comm );
21
+ static int acoll_module_disable (mca_coll_base_module_t * module , struct ompi_communicator_t * comm );
22
+
19
23
/*
20
24
* Initial query function that is invoked during MPI_INIT, allowing
21
25
* this component to disqualify itself if it doesn't support the
@@ -27,6 +31,26 @@ int mca_coll_acoll_init_query(bool enable_progress_threads, bool enable_mpi_thre
27
31
return OMPI_SUCCESS ;
28
32
}
29
33
34
+
35
+
36
+ #define ACOLL_INSTALL_COLL_API (__comm , __module , __api ) \
37
+ do \
38
+ { \
39
+ if (__module->super.coll_##__api) \
40
+ { \
41
+ MCA_COLL_INSTALL_API(__comm, __api, __module->super.coll_##__api, &__module->super, "acoll"); \
42
+ } \
43
+ } while (0)
44
+
45
+ #define ACOLL_UNINSTALL_COLL_API (__comm , __module , __api ) \
46
+ do \
47
+ { \
48
+ if (__comm->c_coll->coll_##__api##_module == &__module->super) \
49
+ { \
50
+ MCA_COLL_INSTALL_API(__comm, __api, NULL, NULL, "acoll"); \
51
+ } \
52
+ } while (0)
53
+
30
54
/*
31
55
* Invoked when there's a new communicator that has been created.
32
56
* Look at the communicator and decide which set of functions and
@@ -124,49 +148,53 @@ mca_coll_base_module_t *mca_coll_acoll_comm_query(struct ompi_communicator_t *co
124
148
125
149
/* Choose whether to use [intra|inter], and [subgroup|normal]-based
126
150
* algorithms. */
127
- acoll_module -> super .coll_module_enable = mca_coll_acoll_module_enable ;
151
+ acoll_module -> super .coll_module_enable = acoll_module_enable ;
152
+ acoll_module -> super .coll_module_disable = acoll_module_disable ;
128
153
129
154
acoll_module -> super .coll_allgather = mca_coll_acoll_allgather ;
130
- acoll_module -> super .coll_allgatherv = NULL ;
131
155
acoll_module -> super .coll_allreduce = mca_coll_acoll_allreduce_intra ;
132
- acoll_module -> super .coll_alltoall = NULL ;
133
- acoll_module -> super .coll_alltoallv = NULL ;
134
- acoll_module -> super .coll_alltoallw = NULL ;
135
156
acoll_module -> super .coll_barrier = mca_coll_acoll_barrier_intra ;
136
157
acoll_module -> super .coll_bcast = mca_coll_acoll_bcast ;
137
- acoll_module -> super .coll_exscan = NULL ;
138
158
acoll_module -> super .coll_gather = mca_coll_acoll_gather_intra ;
139
- acoll_module -> super .coll_gatherv = NULL ;
140
159
acoll_module -> super .coll_reduce = mca_coll_acoll_reduce_intra ;
141
- acoll_module -> super .coll_reduce_scatter_block = NULL ;
142
- acoll_module -> super .coll_reduce_scatter = NULL ;
143
- acoll_module -> super .coll_scan = NULL ;
144
- acoll_module -> super .coll_scatter = NULL ;
145
- acoll_module -> super .coll_scatterv = NULL ;
146
-
147
- acoll_module -> super .coll_neighbor_allgather = NULL ;
148
- acoll_module -> super .coll_neighbor_allgatherv = NULL ;
149
- acoll_module -> super .coll_neighbor_alltoall = NULL ;
150
- acoll_module -> super .coll_neighbor_alltoallv = NULL ;
151
- acoll_module -> super .coll_neighbor_alltoallw = NULL ;
152
-
153
- acoll_module -> super .coll_reduce_local = NULL ;
154
160
155
161
return & (acoll_module -> super );
156
162
}
157
163
158
164
/*
159
165
* Init module on the communicator
160
166
*/
161
- int mca_coll_acoll_module_enable (mca_coll_base_module_t * module , struct ompi_communicator_t * comm )
167
+ static int acoll_module_enable (mca_coll_base_module_t * module , struct ompi_communicator_t * comm )
162
168
{
169
+ mca_coll_acoll_module_t * acoll_module = (mca_coll_acoll_module_t * ) module ;
170
+
163
171
/* prepare the placeholder for the array of request* */
164
172
module -> base_data = OBJ_NEW (mca_coll_base_comm_t );
165
173
if (NULL == module -> base_data ) {
166
174
return OMPI_ERROR ;
167
175
}
168
176
177
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , allgather );
178
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , allreduce );
179
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , barrier );
180
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , bcast );
181
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , gather );
182
+ ACOLL_INSTALL_COLL_API (comm , acoll_module , reduce );
183
+
169
184
/* All done */
170
185
return OMPI_SUCCESS ;
171
186
}
172
187
188
+ static int acoll_module_disable (mca_coll_base_module_t * module , struct ompi_communicator_t * comm )
189
+ {
190
+ mca_coll_acoll_module_t * acoll_module = (mca_coll_acoll_module_t * ) module ;
191
+
192
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , allgather );
193
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , allreduce );
194
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , barrier );
195
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , bcast );
196
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , gather );
197
+ ACOLL_UNINSTALL_COLL_API (comm , acoll_module , reduce );
198
+
199
+ return OMPI_SUCCESS ;
200
+ }
0 commit comments