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

Stream sync before calling cufile #437

Merged

Conversation

madsbk
Copy link
Member

@madsbk madsbk commented Aug 15, 2024

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.

@madsbk madsbk added bug Something isn't working non-breaking Introduces a non-breaking change labels Aug 15, 2024
@madsbk madsbk force-pushed the stream_sync_when_calling_cufile branch from 822a40f to 63f750f Compare August 15, 2024 07:55
@madsbk madsbk marked this pull request as ready for review August 15, 2024 08:23
@madsbk madsbk requested a review from a team as a code owner August 15, 2024 08:23
@madsbk madsbk added improvement Improves an existing functionality and removed bug Something isn't working labels Aug 15, 2024
@@ -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
Copy link
Contributor

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

Copy link
Member Author

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.

@madsbk madsbk requested a review from bdice August 19, 2024 12:29
Copy link
Contributor

@bdice bdice left a 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).

@madsbk
Copy link
Member Author

madsbk commented Aug 19, 2024

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.

@madsbk
Copy link
Member Author

madsbk commented Aug 19, 2024

/merge

@rapids-bot rapids-bot bot merged commit aa3fd11 into rapidsai:branch-24.10 Aug 19, 2024
48 checks passed
@madsbk madsbk deleted the stream_sync_when_calling_cufile branch August 20, 2024 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants