-
Notifications
You must be signed in to change notification settings - Fork 67
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
Initial Python Interface for cufile Async IO #376
Conversation
In this implementation, cuda stream's pointer is passed into the Python interface, which can be retrieved from the stream object in pycuda, cuda-python, torch. The stream objects in the three packages are interoperable as well. You may check the following gist on how to create a stream object based on another from another package and retrieve the address from these objects. https://gist.github.com/K-Wu/178703e4803716d61c94df8938c3da9b |
/ok to test |
The failing tests in conda-python-tests are caused by torch being not installed. How shall I fix it? Maybe adding some flags to indicate this test requires Nvidia GPU and pytorch? Instead of pytorch, pycuda or cuda-python can also do the job. |
If we only need pytorch to create a new stream, I suggest that we use |
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 @K-Wu, nice work!
@madsbk Hi Mads, thanks for this very quick response and detailed review! I will address your comments tonight. Best Regards, |
/ok to test |
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.
Looks good, I only have some minor suggestions
python/tests/test_async_io.py
Outdated
with pytest.raises(RuntimeError, match="unsupported file open flags"): | ||
f.raw_read_async(a, stream.ptr).check_bytes_done() |
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.
with pytest.raises(RuntimeError, match="unsupported file open flags"): | |
f.raw_read_async(a, stream.ptr).check_bytes_done() | |
future_stream = f.raw_read_async(a, stream.ptr) | |
with pytest.raises(RuntimeError, match="unsupported file open flags"): | |
# The exception is raised when we check for completion. | |
future_stream.check_bytes_done() |
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.
Comments addressed. However, the exception is actually raised when .raw_read_async was triggered. I added in the comment that this is the expected behavior.
Hi @madsbk, thanks for the review! Please let me know if further actions need to be done. Also, shall I update the branch by clicking the "Update branch" button? It seems this repo used squash merge to deal with PRs so it seems okay. I know some people prefer rebase when pulling the main branch. |
/ok to test |
my bad
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.
Nitpick
/ok to test |
Done addressing the comments |
/ok to test |
@madsbk Hi Mads, thank you for your further reviews and edits! |
Thanks @K-Wu |
/merge |
Thank you! @madsbk |
Hi there,
Thanks for this great repository! I want to use the cuFile async IO in my research project and noticed this kvikio repo. However, the initial support has been done in #259 and tracked in #204, but the Python interface hasn't been done yet. So I exported the write_async and read_async to the CuFile Python class and added test case. This will be very helpful for my project where I want to do the PyTorch training computation and simultaneously load tensors from the SSDs. I created this PR because hopefully, it could be helpful for your repository as well as keeping the Python interface current.
Please let me know your thoughts. Thank you.
Best Regards,
Kun