-
Notifications
You must be signed in to change notification settings - Fork 445
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
Guard KOKKOS_ALL_COMPILE_OPTIONS if Cuda is not enabled #3387
Conversation
Unable to link with Trilinos, due to unconditional "-x cuda" compile flags
Can one of the admins verify this patch? |
Alternative might be to guard kokkos/cmake/kokkos_arch.cmake Lines 119 to 157 in 593597c
The flag is added here kokkos/cmake/kokkos_arch.cmake Line 140 in 593597c
Your solution looks fine to me but I want feedback from @jjwilke. |
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 only affects Trilinos so guarding in the Trilinos-only part looks sensible to me and mirrors what we do for a regular build in
kokkos/cmake/kokkos_tribits.cmake
Lines 269 to 282 in 03ded4e
IF (KOKKOS_ENABLE_CUDA) | |
TARGET_COMPILE_OPTIONS( | |
${LIBRARY_NAME} | |
PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_CUDA_OPTIONS}> | |
) | |
SET(NODEDUP_CUDAFE_OPTIONS) | |
FOREACH(OPT ${KOKKOS_CUDAFE_OPTIONS}) | |
LIST(APPEND NODEDUP_CUDAFE_OPTIONS -Xcudafe ${OPT}) | |
ENDFOREACH() | |
TARGET_COMPILE_OPTIONS( | |
${LIBRARY_NAME} | |
PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${NODEDUP_CUDAFE_OPTIONS}> | |
) | |
ENDIF() |
But the problematic file is |
This bug is in Trilinos right now? I.e. its in the release? |
I tested with Trilinos |
This looks fine. This is working for nvcc because KOKKOS_CUDA_OPTIONS is empty. There is one spot with clang where we add a flag to KOKKOS_CUDA_OPTIONS even if CUDA isn't enabled. This is why we haven't seen the error before (i.e. no one builds downstream Trilinos projects with clang-cuda). I'm not sure if we care about consistent behavior, i.e. should KOKKOS_CUDA_OPTIONS always be empty if CUDA is not enabled? Or should KOKKOS_CUDA_OPTIONS contain all the expected CUDA options even if CUDA is not enabled. Super picky, but nice to be clean and consistent. |
OK to test. |
Retest this please |
Guard KOKKOS_ALL_COMPILE_OPTIONS if Cuda is not enabled (cherry picked from commit 3f9d820)
I'm building trilinos, not Kokkos standalone, and I'm building with a clang compiler, where I enable OpenMP as parallel hostspace, and no device space (i.e. Cuda disabled).
Variable
KOKKOS_ALL_COMPILE_OPTIONS
is referenced in filecmake/KokkosTrilinosConfig.cmake.in
(when building with Trilinos, this triggers a bug)The installed
KokkosConfig.cmake
will contain the lines:When I want to use trilinos in another project and link to trilinos, which will pull in Kokkos::Kokkos, which adds the compile flags
-x cuda
. GuardingKOKKOS_ALL_COMPILE_OPTIONS
works fine for me.