-
Notifications
You must be signed in to change notification settings - Fork 34
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
Make sure that CUDA instances are destroyed prior to destroying streams #1050
Make sure that CUDA instances are destroyed prior to destroying streams #1050
Conversation
benchmarks/execution_space_instances/execution_space_instances_driver.cpp
Outdated
Show resolved
Hide resolved
47759bf
to
52f352d
Compare
52f352d
to
b19cb1c
Compare
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.
How was it not failing in the regular CI ?!
// Place the code using CUDA instance in a block to make sure the instance | ||
// is destroyed prior to destroying the stream. |
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.
What about
Kokkos::push_finalize_hook([&stream](){ cudaStreamDestroy(stream); });
instead?
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.
Would it guarantee the destroy order with the instance, though?
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.
The instance would get out of scope and destroyed first, then the kokkos execution environment scope guard destructor kicks in, calls Kokkos::finalize
which invokes all registered callbacks before releasing resources.
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.
That is "yes it would do the right thing".
I prefer that solution but I am not blocking.
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.
Alternatively, you could just move Kokkos::ScopeGuard guard(argc, argv);
inside this block so that the stream is created/destroyed before/after Kokkos is initialized/finalized.
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.
I don't think it matters whether the stream is destroyed before/after Kokkos is finalized. As long as the instance is destroyed before, that's the only thing that matters, if I understand it right. So, I would prefer to keep the current code.
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.
The change I suggested is more explicit about what needs to happen, hence more readable IMO.
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.
Sorry my suggestion was buggy
Co-authored-by: Damien L-G <dalg24@gmail.com>
2cd4715
to
d236452
Compare
HIP failed, but this PR does not include #1048. |
This indeed fixed CUDA nightlies. |
Fix #1049. Should fix nightly failures.