|
1 | 1 | /* |
2 | | - * Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED. |
| 2 | + * Copyright (C) 2001-2011 Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED. |
3 | 3 | * Copyright (c) 2016 The University of Tennessee and The University |
4 | 4 | * of Tennessee Research Foundation. All rights |
5 | 5 | * reserved. |
| 6 | + * Copyright (c) 2018 Research Organization for Information Science |
| 7 | + * and Technology (RIST). All rights reserved. |
6 | 8 | * $COPYRIGHT$ |
7 | 9 | * |
8 | 10 | * Additional copyrights may follow |
@@ -381,14 +383,19 @@ static void mca_pml_ucx_waitall(void **reqs, size_t *count_p) |
381 | 383 | *count_p = 0; |
382 | 384 | } |
383 | 385 |
|
| 386 | +static void mca_pml_fence_complete_cb(int status, void *fenced) |
| 387 | +{ |
| 388 | + *(int*)fenced = 1; |
| 389 | +} |
| 390 | + |
384 | 391 | int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) |
385 | 392 | { |
| 393 | + volatile int fenced = 0; |
386 | 394 | ompi_proc_t *proc; |
387 | 395 | size_t num_reqs, max_reqs; |
388 | 396 | void *dreq, **dreqs; |
389 | 397 | ucp_ep_h ep; |
390 | 398 | size_t i; |
391 | | - ucs_status_t ret; |
392 | 399 |
|
393 | 400 | max_reqs = ompi_pml_ucx.num_disconnect; |
394 | 401 | if (max_reqs > nprocs) { |
@@ -430,16 +437,11 @@ int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) |
430 | 437 |
|
431 | 438 | mca_pml_ucx_waitall(dreqs, &num_reqs); |
432 | 439 | free(dreqs); |
433 | | - /* flush worker to allow all pending operations to complete. |
434 | | - * ignore error (we can do nothing here), just try to |
435 | | - * finalize gracefully */ |
436 | | - ret = ucp_worker_flush(ompi_pml_ucx.ucp_worker); |
437 | | - if (UCS_OK != ret) { |
438 | | - PML_UCX_ERROR("ucp_worker_flush failed: %s", |
439 | | - ucs_status_string(ret)); |
440 | | - } |
441 | 440 |
|
442 | | - opal_pmix.fence(NULL, 0); |
| 441 | + opal_pmix.fence_nb(NULL, 0, mca_pml_fence_complete_cb, &fenced); |
| 442 | + while (!fenced) { |
| 443 | + ucp_worker_progress(ompi_pml_ucx.ucp_worker); |
| 444 | + } |
443 | 445 |
|
444 | 446 | return OMPI_SUCCESS; |
445 | 447 | } |
|
0 commit comments