-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add Active Messages support #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A partial look, I haven't gone through the logical of the implementation properly yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wence- for looking at this, apologies for not addressing it earlier but somehow I completely missed the notification for this PR. I've addressed/responded to your comments now, please have a look when you've got the chance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a little cleanup we can do in the recvWait/recvPool mapping handling, and then some other minor cleanups/queries in the logic side of things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wence- for another great, thorough review. I've addressed your comments, could you please take another look when you have a chance?
|
||
void RecvAmMessage::callback(void* request, ucs_status_t status) | ||
{ | ||
_request->_buffer = _buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can
_request
be used for something else during the lifetime ofthis
? if not, why not set up the_request->_buffer
pointer in the constructor ofRecvAmMessage
, if yes, then this seems potentially racy.
It shouldn't be used for anything else. The reason I wrote the code in this way is to prevent the user from calling getRecvBuffer
before isCompleted() == true && getStatus() == UCS_OK
and get a proper Buffer
that has invalid data. Do you think it would be better to handle it differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wence- for looking at it again. I think I've addressed all your comments, but please let me know if I missed something.
|
||
void RecvAmMessage::callback(void* request, ucs_status_t status) | ||
{ | ||
_request->_buffer = _buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, done in 6eb5f95.
Thanks, not sure what went on in the tests though |
For some reason the `posix` transport isn't available in CI, thus replace it with `self`, given the exact transport is not the object of `test_check_transport`.
This reverts commit d7dcea0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very minor comment.
// delayed to allow the worker progress thread to set its status, and more | ||
// importantly the Python future later on, so that we don't need the GIL here. | ||
req->_worker->registerDelayedSubmission( | ||
req, std::bind(std::mem_fn(&Request::populateDelayedSubmission), req.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this needs to be moved from the constructor because we need the shared_ptr
to this
which isn't available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not the friendliest design, but it is the best we can do here (I think).
@@ -35,26 +35,25 @@ void DelayedSubmissionCollection::process() | |||
toProcess = std::move(_collection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does std::move
do to _collection
? Does it just drain the vector, leaving it "as-if" it were empty again? I guess so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, that is the standard behavior for the move constructor and operator.
Required until progressing the worker is not necessary within the call anymore.
Co-authored-by: Lawrence Mitchell <[email protected]>
Follow the default of other tests for now, relying on the default progress mode or that specified via environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wence- , responded and addressed your suggestion.
@@ -35,26 +35,25 @@ void DelayedSubmissionCollection::process() | |||
toProcess = std::move(_collection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, that is the standard behavior for the move constructor and operator.
// delayed to allow the worker progress thread to set its status, and more | ||
// importantly the Python future later on, so that we don't need the GIL here. | ||
req->_worker->registerDelayedSubmission( | ||
req, std::bind(std::mem_fn(&Request::populateDelayedSubmission), req.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not the friendliest design, but it is the best we can do here (I think).
All tests pass now, I'll leave this to be merged Monday in case you have any last comments @wence- , thanks again for reviewing! |
Thanks @wence- and @robertmaynard for reviews and approvals. |
/merge |
Introduce new
ucxx::RequestAm
class to allow transferring via the Active Messages UCX API.