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

[REVIEW] Explicitly set legacy or per-thread default stream in JNI [skip ci] #6690

Merged
merged 7 commits into from
Nov 7, 2020

Conversation

rongou
Copy link
Contributor

@rongou rongou commented Nov 6, 2020

This should make nvcomp use the correct cuda stream.

@jlowe @abellina

@rongou rongou requested a review from a team as a code owner November 6, 2020 00:31
@GPUtester
Copy link
Collaborator

Please update the changelog in order to start CI tests.

View the gpuCI docs here.

@@ -39,9 +45,9 @@
protected boolean cleanImpl(boolean logErrorIfNotClean) {
boolean neededCleanup = false;
long origAddress = stream;
if (stream != 0) {
if (stream != defaultStream()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check for any stream that shouldn't be cleaned up which includes implicit default stream (0), legacy default stream (1), and per-thread default stream (2).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

destroyStream(stream);
stream = 0;
stream = defaultStream();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably simplest to keep using 0 as an indicator the stream has been cleaned, that way we don't have to compute anything and it's consistent how custom streams look cleaned regardless of PTDS setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 33 to 35
private static long defaultStream() {
return isPtdsEnabled() ? CUDA_STREAM_PER_THREAD : CUDA_STREAM_LEGACY;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be a function, since it's never going to change value. This should be computed once so we avoid the JNI call each time.

Suggested change
private static long defaultStream() {
return isPtdsEnabled() ? CUDA_STREAM_PER_THREAD : CUDA_STREAM_LEGACY;
}
private static long DEFAULT_STREAM_ID = isPtdsEnabled() ? CUDA_STREAM_PER_THREAD : CUDA_STREAM_LEGACY;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@abellina abellina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit.

java/src/main/java/ai/rapids/cudf/Cuda.java Outdated Show resolved Hide resolved
@jlowe jlowe added the Java Affects Java cuDF API. label Nov 6, 2020
@abellina
Copy link
Contributor

abellina commented Nov 6, 2020

@rongou I am going to test your change with my setup, since I saw this issue originally.

@abellina
Copy link
Contributor

abellina commented Nov 7, 2020

@rongou I have tried your change and I have not seen the same issue with nvcomp. Thanks for doing this.

@jlowe jlowe merged commit aac682b into rapidsai:branch-0.17 Nov 7, 2020
@rongou rongou deleted the explicit-default-stream branch November 23, 2021 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Affects Java cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants