-
Notifications
You must be signed in to change notification settings - Fork 58
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
Stream sync before calling cufile #437
Stream sync before calling cufile #437
Conversation
822a40f
to
63f750f
Compare
cpp/include/kvikio/file_handle.hpp
Outdated
@@ -314,16 +314,26 @@ class FileHandle { | |||
* @param file_offset Offset in the file to read from. | |||
* @param devPtr_offset Offset relative to the `devPtr_base` pointer to read into. | |||
* This parameter should be used only with registered buffers. | |||
* @param sync_null_stream Synchronize the CUDA null stream prior to calling cuFile. Contrary to |
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.
Do we mean "default stream" instead of "null stream" everywhere here? https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html
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.
Right, I have renamed to default stream. cuFile calls it the null stream, but I agree default stream is less confusing.
…o stream_sync_when_calling_cufile
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.
This looks good!
Would an equivalent alternative be to use the async API and pass in the default stream? Is that possible with the current design? If so, I would explain in the docs how this new option behaves compared to that alternative (or simply direct users to an async API rather than add a new parameter if it is equivalent).
Thanks @bdice, the async API comes with its own quirks so it isn't really an equivalent alternative. |
/merge |
Contrary to most of the non-async CUDA API, cuFile does not have the semantic of being ordered with respect to other work in the null stream. Since this is surprising to most users, we now synchronize on the null stream before calling cuFIle read and write by default.
See cuFile IO API Functional Specification and CUDA Concurrent Execution between Host and Device.