@@ -26,6 +26,7 @@ static int component_query(struct ompi_win_t *win, void **base, size_t size, int
26
26
static int component_select (struct ompi_win_t * win , void * * base , size_t size , int disp_unit ,
27
27
struct ompi_communicator_t * comm , struct opal_info_t * info ,
28
28
int flavor , int * model );
29
+ static void ompi_osc_ucx_unregister_progress (void );
29
30
30
31
ompi_osc_ucx_component_t mca_osc_ucx_component = {
31
32
{ /* ompi_osc_base_component_t */
@@ -236,6 +237,20 @@ static inline int mem_map(void **base, size_t size, ucp_mem_h *memh_ptr,
236
237
return ret ;
237
238
}
238
239
240
+ static void ompi_osc_ucx_unregister_progress ()
241
+ {
242
+ int ret ;
243
+
244
+ mca_osc_ucx_component .num_modules -- ;
245
+ OSC_UCX_ASSERT (mca_osc_ucx_component .num_modules >= 0 );
246
+ if (0 == mca_osc_ucx_component .num_modules ) {
247
+ ret = opal_progress_unregister (progress_callback );
248
+ if (OMPI_SUCCESS != ret ) {
249
+ OSC_UCX_VERBOSE (1 , "opal_progress_unregister failed: %d" , ret );
250
+ }
251
+ }
252
+ }
253
+
239
254
static int component_select (struct ompi_win_t * win , void * * base , size_t size , int disp_unit ,
240
255
struct ompi_communicator_t * comm , struct opal_info_t * info ,
241
256
int flavor , int * model ) {
@@ -643,14 +658,7 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in
643
658
}
644
659
if (module ) {
645
660
free (module );
646
- mca_osc_ucx_component .num_modules -- ;
647
- OSC_UCX_ASSERT (mca_osc_ucx_component .num_modules >= 0 );
648
- if (0 == mca_osc_ucx_component .num_modules ) {
649
- ret = opal_progress_unregister (progress_callback );
650
- if (OMPI_SUCCESS != ret ) {
651
- OSC_UCX_VERBOSE (1 , "opal_progress_unregister failed: %d" , ret );
652
- }
653
- }
661
+ ompi_osc_ucx_unregister_progress ();
654
662
}
655
663
656
664
error_nomem :
@@ -819,14 +827,7 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) {
819
827
ompi_comm_free (& module -> comm );
820
828
821
829
free (module );
822
- mca_osc_ucx_component .num_modules -- ;
823
- OSC_UCX_ASSERT (mca_osc_ucx_component .num_modules >= 0 );
824
- if (0 == mca_osc_ucx_component .num_modules ) {
825
- ret = opal_progress_unregister (progress_callback );
826
- if (OMPI_SUCCESS != ret ) {
827
- OSC_UCX_VERBOSE (1 , "opal_progress_unregister failed: %d" , ret );
828
- }
829
- }
830
+ ompi_osc_ucx_unregister_progress ();
830
831
831
832
return ret ;
832
833
}
0 commit comments