@@ -1143,6 +1143,9 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) {
11431143 ompi_osc_ucx_module_t * module = (ompi_osc_ucx_module_t * ) win -> w_osc_module ;
11441144 int ret ;
11451145 uint64_t i ;
1146+ ucs_status_ptr_t request ;
1147+ ucp_request_param_t param = {0 };
1148+ ucp_ep_h ep ;
11461149
11471150 assert (module -> lock_count == 0 );
11481151 assert (opal_list_is_empty (& module -> pending_posts ) == true);
@@ -1162,6 +1165,29 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) {
11621165 return ret ;
11631166 }
11641167
1168+ if (!opal_common_ucx_thread_enabled &&
1169+ mca_osc_ucx_component .num_modules == 1 ) {
1170+ /* flush all the default endpoints for the last window */
1171+ for (i = 0 ; i < mca_osc_ucx_component .comm_world_size ; i ++ ) {
1172+ ep = mca_osc_ucx_component .endpoints [i ];
1173+ if (ep != NULL ) {
1174+ request = ucp_ep_flush_nbx (ep , & param );
1175+ ret = opal_common_ucx_wait_request (request ,
1176+ mca_osc_ucx_component .wpool -> dflt_winfo -> worker ,
1177+ "ucp_flush_nbx" );
1178+ if (ret != OMPI_SUCCESS ) {
1179+ return ret ;
1180+ }
1181+ }
1182+ }
1183+
1184+ ret = module -> comm -> c_coll -> coll_barrier (module -> comm ,
1185+ module -> comm -> c_coll -> coll_barrier_module );
1186+ if (ret != OMPI_SUCCESS ) {
1187+ return ret ;
1188+ }
1189+ }
1190+
11651191 if (module -> flavor == MPI_WIN_FLAVOR_SHARED ) {
11661192 if (module -> segment_base != NULL )
11671193 opal_shmem_segment_detach (& module -> seg_ds );
0 commit comments