-
Notifications
You must be signed in to change notification settings - Fork 6
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
Introduce kokkosfft initialize #220
base: main
Are you sure you want to change the base?
Conversation
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.
Did you consider leveraging Kokkos::push_finalize_hook()
instead?
Thank you, that is interesting. At least, I can use However, we also need to call |
I overlooked that you actually acquire resources as well. You are correct, I would encourage seriously looking at alternatives. I see the introduction of |
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.
LGTM
@@ -2,15 +2,15 @@ | |||
# | |||
# SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception | |||
|
|||
add_library(fft INTERFACE) | |||
add_library(fft STATIC KokkosFFT_Core.cpp) |
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.
add_library(fft STATIC KokkosFFT_Core.cpp) | |
add_library(fft KokkosFFT_Core.cpp) |
I would not force it to be STATIC
to allow people to use BUILD_SHARED_LIBS
, https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html.
[[nodiscard]] bool KokkosFFT::is_finalized() noexcept { return g_is_finalized; } | ||
|
||
void KokkosFFT::initialize() { | ||
if (!(Kokkos::is_initialized() || Kokkos::is_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.
if (!(Kokkos::is_initialized() || Kokkos::is_finalized())) { | |
if (!Kokkos::is_initialized()) { |
Do we need to test is_finalized
?
Oh really why ? Are both functions a problem or only |
Makes sense. The alternative solution I have in mind is to rely on static local object which is called at the first time when |
Fixes #217
This PR aims at adding
KokkosFFT::initialize
andKokkosFFT::finalize
in order to correctly handle setup functions which cannot be called more than once.fftw
androcfft
inKokkosFFT::initialize
fftw
androcfft
inKokkosFFT::finalize
KokkosFFT::initialize
andKokkosFFT::finalize
can only be called when Kokkos is availableKokkosFFT::initialize
andKokkosFFT::finalize
in examples