@@ -127,6 +127,36 @@ cuda_component_register(void)
127
127
static int
128
128
cuda_component_init_query (bool enable_progress_threads ,
129
129
bool enable_mpi_thread_multiple )
130
+ {
131
+ return OMPI_SUCCESS ;
132
+ }
133
+
134
+ /*
135
+ * Query whether this component can be used for a specific op
136
+ */
137
+ static struct ompi_op_base_module_1_0_0_t *
138
+ cuda_component_op_query (struct ompi_op_t * op , int * priority )
139
+ {
140
+ ompi_op_base_module_t * module = NULL ;
141
+
142
+ module = OBJ_NEW (ompi_op_base_module_t );
143
+ module -> opm_device_enabled = true;
144
+ for (int i = 0 ; i < OMPI_OP_BASE_TYPE_MAX ; ++ i ) {
145
+ module -> opm_stream_fns [i ] = ompi_op_cuda_functions [op -> o_f_to_c_index ][i ];
146
+ module -> opm_3buff_stream_fns [i ] = ompi_op_cuda_3buff_functions [op -> o_f_to_c_index ][i ];
147
+
148
+ if ( NULL != module -> opm_fns [i ] ) {
149
+ OBJ_RETAIN (module );
150
+ }
151
+ if ( NULL != module -> opm_3buff_fns [i ] ) {
152
+ OBJ_RETAIN (module );
153
+ }
154
+ }
155
+ * priority = 50 ;
156
+ return (ompi_op_base_module_1_0_0_t * ) module ;
157
+ }
158
+
159
+ void ompi_op_cuda_lazy_init ()
130
160
{
131
161
int num_devices ;
132
162
int rc ;
@@ -166,30 +196,4 @@ cuda_component_init_query(bool enable_progress_threads,
166
196
}
167
197
}
168
198
169
- return OMPI_SUCCESS ;
170
- }
171
-
172
- /*
173
- * Query whether this component can be used for a specific op
174
- */
175
- static struct ompi_op_base_module_1_0_0_t *
176
- cuda_component_op_query (struct ompi_op_t * op , int * priority )
177
- {
178
- ompi_op_base_module_t * module = NULL ;
179
-
180
- module = OBJ_NEW (ompi_op_base_module_t );
181
- module -> opm_device_enabled = true;
182
- for (int i = 0 ; i < OMPI_OP_BASE_TYPE_MAX ; ++ i ) {
183
- module -> opm_stream_fns [i ] = ompi_op_cuda_functions [op -> o_f_to_c_index ][i ];
184
- module -> opm_3buff_stream_fns [i ] = ompi_op_cuda_3buff_functions [op -> o_f_to_c_index ][i ];
185
-
186
- if ( NULL != module -> opm_fns [i ] ) {
187
- OBJ_RETAIN (module );
188
- }
189
- if ( NULL != module -> opm_3buff_fns [i ] ) {
190
- OBJ_RETAIN (module );
191
- }
192
- }
193
- * priority = 50 ;
194
- return (ompi_op_base_module_1_0_0_t * ) module ;
195
- }
199
+ }
0 commit comments