Repository navigation
Description
I am having trouble canceling submitted non-blocking tag send/recv requests with UCX 1.6.1 on our EDR platform. I start two ranks on different compute nodes. The attached test routine does the following:
- allocate 2 large buffers (10mb) on each rank
- submit non-blocking send / recv of the buffers to/from peer
- submit non-blocking send / recv of a small (1b) messages to/from peer
- wait for the small messages to complete and verify that the large messages are still in-progress
- cancel the large
recvrequests
I run the code with a single thread per rank. UCX aborts with the following error:
small arrived
small arrived
large recv status: 1 1 (UCS_OK 0 UCS_INPROGRESS 1)
large recv status: 1 1 (UCS_OK 0 UCS_INPROGRESS 1)
[c3-4:40218:0:40218] tag_match.c:79 Bug: expected request not found
==== backtrace (tid: 194528) ====
0 0x000000000001e250 ucs_fatal_error_message() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucs/debug/assert.c:36
1 0x000000000001e3b6 ucs_fatal_error_format() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucs/debug/assert.c:52
2 0x000000000003b51e ucp_tag_exp_remove() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucp/tag/tag_match.c:79
3 0x000000000003b51e ucp_tag_exp_delete() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucp/tag/tag_match.inl:98
4 0x000000000003b51e ucp_tag_exp_remove() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucp/tag/tag_match.c:74
5 0x0000000000018fdb ucp_request_cancel() /cluster/projects/nn9999k/marcink/src/ucx-1.6.1/src/ucp/core/ucp_request.c:111
6 0x00000000004035e8 main._omp_fn.0() ghex_p2p_bi_cb_avail_mt.cpp:0
7 0x000000000000df3f GOMP_parallel() /cluster/work/users/vegarde/build/GCCcore/8.3.0/system-system/gcc-8.3.0/stage3_obj/x86_64-pc-linux-gnu/libgomp/../../../libgomp/parallel.c:168
8 0x0000000000402175 main() ???:0
9 0x0000000000022495 __libc_start_main() ???:0
10 0x000000000040230f _start() ???:0
It seems that calling ucp_request_cancel on an ongoing recv request after another request submitted later has already arrived results in the above error. Am I doing something wrong, or is this a bug?
I'd appreciate any help.. Thanks!
As side question, in the test code I execute ucp_worker_fence between the large and small communication phases, but it seems that the has no effect on the tag send/recv requests. I am guessing that, as withucp_worker_flush_nb, it only affects the the AMO and RMA comm? Just making sure, because it is not spelled out in the documentation.
Here is the code:
void test(){
ucp_ep_h ep;
int peer = (m_rank+1)%2;
ucs_status_ptr_t rrequests[2];
ucs_status_ptr_t srequests[2];
ucs_status_t status1, status2;
unsigned char *sbuffer, *rbuffer;
unsigned char sbuffer2[128], rbuffer2[128];
int bsize = 10000000;
sbuffer = (unsigned char*)malloc(bsize); memset(sbuffer, 0xf, bsize);
rbuffer = (unsigned char*)malloc(bsize); memset(rbuffer, 0x1, bsize);
ep = rank_to_ep(peer);
/* submit large messages */
rrequests[0] = ucp_tag_recv_nb(ucp_worker, rbuffer, bsize, ucp_dt_make_contig(1),
42, 0xfffffffffffffffful, ucx::empty_recv_cb);
srequests[0] = ucp_tag_send_nb(ep, sbuffer, bsize, ucp_dt_make_contig(1),
42, ucx::empty_send_cb);
/* should this order the two comm phases? */
ucp_worker_fence(ucp_worker);
/* submit small messages */
rrequests[1] = ucp_tag_recv_nb(ucp_worker, rbuffer2, 1, ucp_dt_make_contig(1),
420, 0xfffffffffffffffful, ucx::empty_recv_cb);
srequests[1] = ucp_tag_send_nb(ep, sbuffer2, 1, ucp_dt_make_contig(1),
420, ucx::empty_send_cb);
/* wait for small messages to arrive */
while(1){
ucp_worker_progress(ucp_worker);
if(UCS_OK != (uintptr_t)srequests[1])
status1 = ucp_request_check_status(srequests[1]);
else
status1 = UCS_OK;
status2 = ucp_request_check_status(rrequests[1]);
if(UCS_OK == status1 && UCS_OK == status2) break;
}
fprintf(stderr, "small arrived\n");
/* verify that the large messages haven't arrived yet */
if(UCS_OK != (uintptr_t)srequests[0])
status1 = ucp_request_check_status(srequests[0]);
else
status1 = UCS_OK;
status2 = ucp_request_check_status(rrequests[0]);
fprintf(stderr, "large recv status: %d %d (UCS_OK %d UCS_INPROGRESS %d)\n", status1, status2, UCS_OK, UCS_INPROGRESS);
/* assertion failed */
ucp_request_cancel(ucp_worker, rrequests[0]);
}
Activity
brminich commentedon Nov 23, 2019
you are canceling
sreq, not a receive request:ucp_request_cancel(ucp_worker, srequests[0]);It should not fail anyway, so looking into this.
Why do you call
ucp_worker_fence? Tag API guarantees that the message matching on the receiver will be done in order, but it does not guarantee actual message arrival order.To separate communication flows you would need to call flush. But why would you need that?
angainor commentedon Nov 23, 2019
@brminich
Sorry, that's a typo. I was testing both to see, which one fails, and pasted the working code. It is canceling of the recv request that fails. I edited the test and fixed this.
The problem arose in a benchmark, where I first send
nmessages of some size, and then want to synchronize the ranks on a simple barrier. The small messages were the barrier messages. I assumed that when the barrierrecvrequests complete, then all prior requests will also have completed.Does that mean that the recv requests should complete in order large-small? because it seems that is not what I see.
brminich commentedon Nov 23, 2019
ok, anyway mentioned bug should not have happened, so needs to be analyzed.
No, completion order is not guaranteed either. In your case small message will arrive earlier, because large messages transfer implies several stages based protocol.
You can be sure that receive buffers will be consumed in the order posted. Thus, you may use the same tag for sending small and large messages, but still be sure that messages will arrive to the correct buffers. If you want to know when all messages arrived on the receiver, you'd need to wait their completions (all of the receive requests). If all the messages have the same size (and you need to sync with just one peer), you could try waiting for completion of the latest one.
BTW, does the bug happen in 100% cases? Can you please post a relevant code (if send request cancel is not the only difference)?
angainor commentedon Nov 23, 2019
Thanks for the clarification.
This happens in 100% of the cases, but the requirement is that the large message is large enough so that the small one arrives and is completed before. The only change was to cancel the recv request. Otherwise the rest of the
test()routine is accurate.