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

[FEA] libcudf stream parameters should default to cudaStreamPerThread when compiled for PTDS #9614

Closed
jlowe opened this issue Nov 4, 2021 · 6 comments · Fixed by #11082
Closed
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code.

Comments

@jlowe
Copy link
Member

jlowe commented Nov 4, 2021

Is your feature request related to a problem? Please describe.
#9534 occurred because libcudf was using a default-value argument as the stream to use (i.e.: the stream argument in the detail APIs that is currently hidden from the public APIs) and that stream was stream 0 (the default stream). Because libcudf was compiled for PTDS, it properly interpreted 0 as cudaStreamPerThread but this concept was not conveyed to other libraries called by libcudf. When 0 was passed to these other libraries, it ended up using the default stream instead of cudaStreamPerThread. Ideally libcudf should pass the same stream it is using to external libraries that take a stream parameter. Then for libraries that are completely driven by stream parameters, those libraries don't have to be compiled with PTDS when libcudf is compiled with PTDS to avoid surprising performance pitfalls.

Describe the solution you'd like
The default value of stream arguments in libcudf should be cudaStreamPerThread when libcudf is being compiled for PTDS. This will cause libcudf to pass the same stream it is using to external libraries that take a stream This idea was proposed by @jrhemstad in an offline discussion of solutions to #9534.

Describe alternatives you've considered
A workaround is to compile all external libraries libcudf is using with PTDS when libcudf is compiled for PTDS, but this seems unnecessary for libraries like nvcomp which never uses the default stream unless directed by the application code to do so by passing the legacy default stream value as the stream to use.

Another option is to track down every place in libcudf where we pass a stream parameter to an external library and then pass cudaStreamPerThread if the stream is stream 0 and libcudf is compiled for PTDS. This seems more fragile in practice, as we have to manually locate all of these places, fix them (which may be tricky if the stream is passed into that code as a parameter), and remembering to fixup new external call sites going forward.

@jlowe jlowe added feature request New feature or request Needs Triage Need team to review and classify libcudf Affects libcudf (C++/CUDA) code. labels Nov 4, 2021
@jrhemstad
Copy link
Contributor

jrhemstad commented Nov 4, 2021

The alternative that wasn't mentioned and is what I would vastly prefer to see here is to expose streams in the public APIs of libcudf. #925

That way, a caller can specify whatever stream they like (including cudaStreamPerThread).

I'd much prefer that option to some non-standard swictheroo of defaulted function parameter values through compile time definitions.

@jlowe
Copy link
Member Author

jlowe commented Nov 5, 2021

Yes, thanks @jrhemstad for fixing my omission. Exposing the stream parameter would be great and should remove the need for libcudf to be compiled with PTDS. I filed this mostly under the assumption #925 is still a long ways off -- is that no longer the case?

@beckernick beckernick removed the Needs Triage Need team to review and classify label Nov 12, 2021
@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@github-actions
Copy link

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@jbrennan333
Copy link
Contributor

Since nvcomp-2.3 is going to be released as only shared libraries. The solution in #9534, compiling nvcomp with CUDA_API_PER_THREAD_DEFAULT_STREAM, will no longer work.

@jrhemstad
Copy link
Contributor

Filed #10864 for solution.

rapids-bot bot pushed a commit that referenced this issue Jun 22, 2022
…fault_stream_value (#11082)

Closes #10864.
Also closes #9614.

This PR is a follow-up to #10877.  It replaces all of the remaining instances of `rmm::cuda_stream_default` with `cudf::default_stream_value`.

There are a lot of replacements and addition of includes, along with some reformatting due to clang-format, but like #10877, there should be no noticeable functional change here.

Authors:
  - Jim Brennan (https://github.com/jbrennan333)

Approvers:
  - Robert (Bobby) Evans (https://github.com/revans2)
  - https://github.com/nvdbaranec
  - Nghia Truong (https://github.com/ttnghia)
  - Karthikeyan (https://github.com/karthikeyann)

URL: #11082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code.
Projects
None yet
4 participants