-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathna_ucx_ep_flush.patch
64 lines (61 loc) · 2.09 KB
/
na_ucx_ep_flush.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
diff --git a/src/na/na_ucx.c b/src/na/na_ucx.c
index 6e9c3b0..2f157da 100644
--- a/src/na/na_ucx.c
+++ b/src/na/na_ucx.c
@@ -441,6 +441,12 @@ na_ucp_ep_create(ucp_worker_h worker, ucp_ep_params_t *ep_params,
static void
na_ucp_ep_error_cb(void *arg, ucp_ep_h ep, ucs_status_t status);
+/**
+ * Flush endpoint.
+ */
+static ucs_status_ptr_t
+na_ucp_ep_flush(ucp_ep_h ep);
+
/**
* Close endpoint.
*/
@@ -1940,6 +1946,21 @@ na_ucp_ep_error_cb(
na_ucx_addr_ref_decr(na_ucx_addr);
}
+/*---------------------------------------------------------------------------*/
+static ucs_status_ptr_t
+na_ucp_ep_flush(ucp_ep_h ep)
+{
+ const ucp_request_param_t flush_params = {
+ .op_attr_mask = 0};
+ ucs_status_ptr_t status_ptr = ucp_ep_flush_nbx(ep, &flush_params);
+
+ NA_CHECK_SUBSYS_ERROR_DONE(addr,
+ status_ptr != NULL && UCS_PTR_IS_ERR(status_ptr),
+ "ucp_ep_flush_nb() failed (%s)",
+ ucs_status_string(UCS_PTR_STATUS(status_ptr)));
+ return status_ptr;
+}
+
/*---------------------------------------------------------------------------*/
static void
na_ucp_ep_close(ucp_ep_h ep)
@@ -2859,8 +2880,23 @@ na_ucx_addr_release(struct na_ucx_addr *na_ucx_addr)
if (na_ucx_addr->ucp_ep != NULL) {
/* NB. for deserialized addresses that are not "connected" addresses, do
* not close the EP */
- if (na_ucx_addr->worker_addr == NULL)
+ if (na_ucx_addr->worker_addr == NULL) {
+ if (!na_ucx_addr->na_ucx_class->ucp_listener) {
+ ucs_status_ptr_t status_ptr = na_ucp_ep_flush(na_ucx_addr->ucp_ep);
+
+ if (UCS_PTR_IS_PTR(status_ptr)) {
+ ucs_status_t status;
+
+ do {
+ ucp_worker_progress(na_ucx_addr->na_ucx_class->ucp_worker);
+ status = ucp_request_check_status(status_ptr);
+ } while (status == UCS_INPROGRESS);
+ ucp_request_free(status_ptr);
+ }
+ }
+
na_ucp_ep_close(na_ucx_addr->ucp_ep);
+ }
na_ucx_addr->ucp_ep = NULL;
}