-
Notifications
You must be signed in to change notification settings - Fork 407
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
Add ability to set hook on Kokkos::finalize #714
Labels
Feature Request
Create new capability; will potentially require voting
Milestone
Comments
mhoemmen
added
the
Feature Request
Create new capability; will potentially require voting
label
Mar 30, 2017
3 tasks
Please add to Feb 2018 milestone (by @crtrott 's request, for Tpetra deliverable); thanks! |
I can do / help with this. |
@crtrott I'm almost done; just writing another test. Once I'm done, I'll submit a Kokkos pull request. |
crtrott
added a commit
that referenced
this issue
Jan 5, 2018
Fix #714 (add Kokkos::push_finalize_hook function & tests)
mhoemmen
pushed a commit
to trilinos/Trilinos
that referenced
this issue
Jan 5, 2018
Fix kokkos/kokkos#714 by adding a new function: Kokkos::push_finalize_hook. It lets users set function(s) to be called in Kokkos::finalize, BEFORE Kokkos finalizes anything. I also added unit tests that ensure the following: 1. Kokkos::finalize actually calls the finalize hooks. 2. Kokkos::finalize calls the functions in reverse (LIFO) order. That is, it calls them backwards from the order in which they were added, just as std::atexit does. 3. If a finalize hook throws an uncaught exception, then Kokkos::finalize calls std::terminate, just as std::atexit does. This commit patches Trilinos, using the same changes made in Kokkos pull request kokkos/kokkos#1319 . That pull request was merged into Kokkos:develop, so it will overwrite this Trilinos commit at the next Kokkos promotion into Trilinos.
9 tasks
mhoemmen
added a commit
to trilinos/Trilinos
that referenced
this issue
Jan 5, 2018
Fix kokkos/kokkos#714 by adding a new function: Kokkos::push_finalize_hook. It lets users set function(s) to be called in Kokkos::finalize, BEFORE Kokkos finalizes anything. I also added unit tests that ensure the following: 1. Kokkos::finalize actually calls the finalize hooks. 2. Kokkos::finalize calls the functions in reverse (LIFO) order. That is, it calls them backwards from the order in which they were added, just as std::atexit does. 3. If a finalize hook throws an uncaught exception, then Kokkos::finalize calls std::terminate, just as std::atexit does. This commit patches Trilinos, using the same changes made in Kokkos pull request kokkos/kokkos#1319 . That pull request was merged into Kokkos:develop, so it will overwrite this Trilinos commit at the next Kokkos promotion into Trilinos.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compare to MPI's ability to set a hook to be called at
MPI_Finalize
. The point is to have a way to free global state -- e.g., cuBLAS' handle -- before (say)Kokkos::Cuda::finalize
gets called. Hooks would imitate semantics of POSIXatexit
. All hooks would need to be called before any execution spaces, etc. get finalized.This would be handy, but it's not urgent. See discussion, e.g., here: trilinos/Trilinos#1194 . This is also related to #632.
The text was updated successfully, but these errors were encountered: