18
18
* Copyright (c) 2014 Intel, Inc. All rights reserved.
19
19
* Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
20
20
* Copyright (c) 2022 IBM Corporation. All rights reserved.
21
+ * Copyright (c) 2023 Triad National Security, LLC. All rights
22
+ * reserved.
21
23
* $COPYRIGHT$
22
24
*
23
25
* Additional copyrights may follow
@@ -69,6 +71,8 @@ static int smcuda_register(void);
69
71
static mca_btl_base_module_t * *
70
72
mca_btl_smcuda_component_init (int * num_btls , bool enable_progress_threads , bool enable_mpi_threads );
71
73
74
+ static void mca_btl_smcuda_component_fini (void );
75
+
72
76
typedef enum {
73
77
MCA_BTL_SM_RNDV_MOD_SM = 0 ,
74
78
MCA_BTL_SM_RNDV_MOD_MPOOL
@@ -214,7 +218,7 @@ static int smcuda_register(void)
214
218
if (0 == mca_btl_smcuda .super .btl_accelerator_eager_limit ) {
215
219
mca_btl_smcuda .super .btl_accelerator_eager_limit = SIZE_MAX ; /* magic number */
216
220
}
217
- #endif
221
+ #endif /* OPAL_CUDA_SUPPORT */
218
222
return mca_btl_smcuda_component_verify ();
219
223
}
220
224
@@ -260,16 +264,24 @@ static int mca_btl_smcuda_component_open(void)
260
264
OBJ_CONSTRUCT (& mca_btl_smcuda_component .sm_frags_max , opal_free_list_t );
261
265
OBJ_CONSTRUCT (& mca_btl_smcuda_component .sm_frags_user , opal_free_list_t );
262
266
OBJ_CONSTRUCT (& mca_btl_smcuda_component .pending_send_fl , opal_free_list_t );
267
+
268
+ opal_finalize_register_cleanup (mca_btl_smcuda_component_fini );
269
+
270
+ return OPAL_SUCCESS ;
271
+ }
272
+
273
+ static int mca_btl_smcuda_component_close (void )
274
+ {
263
275
return OPAL_SUCCESS ;
264
276
}
265
277
266
278
/*
267
279
* component cleanup - sanity checking of queue lengths
268
280
*/
269
281
270
- static int mca_btl_smcuda_component_close (void )
282
+ static void mca_btl_smcuda_component_fini (void )
271
283
{
272
- int return_value = OPAL_SUCCESS ;
284
+ int rc ;
273
285
274
286
OBJ_DESTRUCT (& mca_btl_smcuda_component .sm_lock );
275
287
/**
@@ -282,11 +294,10 @@ static int mca_btl_smcuda_component_close(void)
282
294
283
295
/* unmap the shared memory control structure */
284
296
if (mca_btl_smcuda_component .sm_seg != NULL ) {
285
- return_value = mca_common_sm_fini (mca_btl_smcuda_component .sm_seg );
286
- if (OPAL_SUCCESS != return_value ) {
287
- return_value = OPAL_ERROR ;
297
+ rc = mca_common_sm_fini (mca_btl_smcuda_component .sm_seg );
298
+ if (OPAL_SUCCESS != rc ) {
288
299
opal_output (0 , " mca_common_sm_fini failed\n" );
289
- goto CLEANUP ;
300
+ return ;
290
301
}
291
302
292
303
/* unlink file, so that it will be deleted when all references
@@ -310,13 +321,7 @@ static int mca_btl_smcuda_component_close(void)
310
321
unlink (mca_btl_smcuda_component .sm_fifo_path );
311
322
}
312
323
#endif
313
-
314
- CLEANUP :
315
-
316
- mca_btl_smcuda_accelerator_fini ();
317
-
318
- /* return */
319
- return return_value ;
324
+ return ;
320
325
}
321
326
322
327
/*
0 commit comments