Skip to content

Commit de8568c

Browse files
author
Sergey Oblomov
committed
MCA/COMMON/UCX: enabled fallback into older UCX API
Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
1 parent 1223b05 commit de8568c

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

config/ompi_check_ucx.m4

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ AC_DEFUN([OMPI_CHECK_UCX],[
4545
[OPAL_CHECK_PACKAGE([ompi_check_ucx],
4646
[ucp/api/ucp.h],
4747
[ucp],
48-
[ucp_ep_flush_nb],
48+
[ucp_cleanup],
4949
[],
5050
[],
5151
[],
@@ -77,7 +77,7 @@ AC_DEFUN([OMPI_CHECK_UCX],[
7777
OPAL_CHECK_PACKAGE([ompi_check_ucx],
7878
[ucp/api/ucp.h],
7979
[ucp],
80-
[ucp_ep_flush_nb],
80+
[ucp_cleanup],
8181
[],
8282
[$ompi_check_ucx_dir],
8383
[$ompi_check_ucx_libdir],
@@ -108,6 +108,18 @@ AC_DEFUN([OMPI_CHECK_UCX],[
108108
[AC_DEFINE([HAVE_UCP_TAG_SEND_NBR],[1],
109109
[have ucp_tag_send_nbr()])], [],
110110
[#include <ucp/api/ucp.h>])
111+
AC_CHECK_DECLS([ucp_ep_flush_nb],
112+
[AC_DEFINE([HAVE_UCP_EP_FLUSH_NB],[1],
113+
[have ucp_ep_flush_nb()])], [],
114+
[#include <ucp/api/ucp.h>])
115+
AC_CHECK_DECLS([ucp_worker_flush_nb],
116+
[AC_DEFINE([HAVE_UCP_WORKER_FLUSH_NB],[1],
117+
[have ucp_worker_flush_nb()])], [],
118+
[#include <ucp/api/ucp.h>])
119+
AC_CHECK_DECLS([ucp_request_check_status],
120+
[AC_DEFINE([HAVE_UCP_REQUEST_CHECK_STATUS],[1],
121+
[have ucp_request_check_status()])], [],
122+
[#include <ucp/api/ucp.h>])
111123
CPPFLAGS=$old_CPPFLAGS
112124

113125
OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])])])

opal/mca/common/ucx/common_ucx.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ ucs_status_t opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h
3333
{
3434
ucs_status_t status;
3535
int i;
36+
#ifndef HAVE_UCP_REQUEST_CHECK_STATUS
37+
ucp_tag_recv_info_t info;
38+
#endif
3639

3740
/* check for request completed or failed */
3841
if (OPAL_LIKELY(UCS_OK == request)) {
@@ -44,7 +47,13 @@ ucs_status_t opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h
4447
while (1) {
4548
/* call UCX progress */
4649
for (i = 0; i < opal_common_ucx_progress_iterations; i++) {
47-
if (UCS_INPROGRESS != (status = ucp_request_check_status(request))) {
50+
if (UCS_INPROGRESS != (status =
51+
#if HAVE_UCP_REQUEST_CHECK_STATUS
52+
ucp_request_check_status(request)
53+
#else
54+
ucp_request_test(request, &info)
55+
#endif
56+
)) {
4857
ucp_request_free(request);
4958
return status;
5059
}
@@ -59,19 +68,27 @@ ucs_status_t opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h
5968
static inline
6069
ucs_status_t opal_common_ucx_ep_flush(ucp_ep_h ep, ucp_worker_h worker)
6170
{
71+
#if HAVE_UCP_EP_FLUSH_NB
6272
ucs_status_ptr_t status;
6373

6474
status = ucp_ep_flush_nb(ep, 0, opal_common_ucx_empty_complete_cb);
6575
return opal_common_ucx_wait_request(status, worker);
76+
#else
77+
return ucp_ep_flush(ep);
78+
#endif
6679
}
6780

6881
static inline
6982
ucs_status_t opal_common_ucx_worker_flush(ucp_worker_h worker)
7083
{
84+
#if HAVE_UCP_WORKER_FLUSH_NB
7185
ucs_status_ptr_t status;
7286

7387
status = ucp_worker_flush_nb(worker, 0, opal_common_ucx_empty_complete_cb);
7488
return opal_common_ucx_wait_request(status, worker);
89+
#else
90+
return ucp_worker_flush(worker);
91+
#endif
7592
}
7693

7794
static inline

0 commit comments

Comments
 (0)