-
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 Kokkos::all_libs
alias target for compatibility with TriBITS/Trilinos
#6157
Conversation
@dalg24, you need both an ALIAS target and an exported IMPORTED target (the former is for users that pull in Kokkos with |
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.
This does not provide a Kokkos::all_libs
IMPORTED target in the generated KokkosConfig.cmake
file (see for yourself).
I don't understand. The configured file |
I can confirm that both |
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 looked over this too fast. This adds the Kokkos::all_libs
target to both the current CMake project and the KokkosConfig.cmake
file. But note this only addresses part of PR #6138. The other part is setting missing vars like Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
in the KokkosConfig.cmake
file (see #6138 (comment)).
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.
Maybe add a comment that we do this for Trilinos
/TriBITS
.
This part has been (mostly) addressed by #6142 |
# CMake Error at <prefix>/lib/cmake/Kokkos/KokkosConfigCommon.cmake:10 (ADD_LIBRARY): | ||
# ADD_LIBRARY cannot create ALIAS target "Kokkos::all_libs" because target | ||
# "Kokkos::kokkos" is imported but not globally visible. | ||
IF(CMAKE_VERSION VERSION_LESS "3.18") |
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 did I determine the cmake version?
When I submitted the original version, I had tested with my local setup that has v3.25.
I was able to reproduce the CI failures with cmake-3.16 (in the CUDA RDC build that does Kokkos_INSTALL_TESTING).
After reading https://discourse.cmake.org/t/alias-and-not-globally-visible-targets/6305 I tried 3.23.5 and it did not yield an error. Then I arbitrarily picked 3.18.0 which also worked followed by 3.17.0 that did not.
I expect this entry from the cmake 3.18 changelog is what resolved the issue.
- The add_library() and add_executable() commands learned to create Alias Targets referencing non-GLOBAL Imported Targets.
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.
Looks OK to me.
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.
Looks good to me.
…ilinos (kokkos#6157) * Add Kokkos::all_libs alias target for compatibility with Trilinos * Add comments and fixup for cmake version less than 3.18
Proposed alternative to #6138
@bartlettroscoe is there a good reason
Kokkos::all_libs
cannot be an alias target?