Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How preallocate buffer through rendezvous protocol before ucp_tag_recv_nbx actually receiving? #10148

Open
MoFHeka opened this issue Sep 12, 2024 · 3 comments

Comments

@MoFHeka
Copy link

MoFHeka commented Sep 12, 2024

It seams there is no api about rendezvous in UCP. And there is no clear document or example for UCT.

@ivankochin
Copy link
Contributor

Hi, what do you mean "preallocate buffer through rendezvous protocol"? AFAIK you need to pass preallocated buffer to ucp_tag_recv_nbx as second argument.

To better understand how do UCP or UCT API works you can check examples

@MoFHeka
Copy link
Author

MoFHeka commented Sep 18, 2024

I would like to transmit the sparse tensors, and there is no way for two workers to know the size of the data in advance.

I don't know if I understand this correctly. In rendezvous protocol, ucp p2p sends the size of the data to be transmitted before the actual transmission begins. So when I use ucp, could I allocate a buffer based on the size of the rendezvous data? And then I pass this buffer into ucp_tag_recv_nbx.

Or is there a tag_recv API which can feed a allocator into.

I guess I need to refer to this to write my own API, right?
https://github.com/openucx/ucx/blob/049eed4d7f5f0f8388054fcf068813427d6287e8/src/ucp/tag/tag_rndv.h

@yosefe
Copy link
Contributor

yosefe commented Sep 22, 2024

@MoFHeka for such case, it is recommended to use the active message API.
The sender can send its tensor using ucp_am_send_nbx, then a callback will be called on receiver with the length of the data and a "data" token. The callback can allocate a receive buffer and pass that token to ucp_am_recv_data_nbx, and complete the rendezvous data transfer. See https://github.com/openucx/ucx/blob/841b1b3/examples/ucp_client_server.c#L560 as example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants