-
Notifications
You must be signed in to change notification settings - Fork 48
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
Compile as cmake language #555
base: main
Are you sure you want to change the base?
Conversation
Looks like we need something like diff --git a/cmake/KokkosConfigCommon.cmake.in b/cmake/KokkosConfigCommon.cmake.in
index d3ac39ffa..fe021199e 100644
--- a/cmake/KokkosConfigCommon.cmake.in
+++ b/cmake/KokkosConfigCommon.cmake.in
@@ -33,6 +33,9 @@ ENDFOREACH()
IF(Kokkos_ENABLE_CUDA)
SET(Kokkos_CUDA_ARCHITECTURES @KOKKOS_CUDA_ARCHITECTURES@)
+ IF(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
+ SET(CMAKE_CUDA_ARCHITECTURES @KOKKOS_CUDA_ARCHITECTURES@)
+ ENDIF()
ENDIF()
IF(Kokkos_ENABLE_HIP)
@@ -300,8 +303,8 @@ FUNCTION(kokkos_compilation)
# set the properties if defined
IF(COMP_${_TYPE})
# MESSAGE(STATUS "Using ${COMP_COMPILER} :: ${_TYPE} :: ${COMP_${_TYPE}}")
- SET_PROPERTY(${_TYPE} ${COMP_${_TYPE}} PROPERTY RULE_LAUNCH_COMPILE "${Kokkos_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}")
- SET_PROPERTY(${_TYPE} ${COMP_${_TYPE}} PROPERTY RULE_LAUNCH_LINK "${Kokkos_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}")
+ SET_PROPERTY(${_TYPE} ${COMP_${_TYPE}} PROPERTY LANGUAGE ${Kokkos_COMPILE_LANGUAGE})
+ SET_PROPERTY(${_TYPE} ${COMP_${_TYPE}} PROPERTY CUDA_ARCHITECTURES ${Kokkos_CUDA_ARCHITECTURES})
ENDIF()
ENDFOREACH()
ENDIF() for this to be usable with |
The challenge is basically that we should set |
@cedricchevalier19 - this entry is relevant to 7144, |
Jakob clearly states in the description that this work is a proposed resolution for that very issue so yes it is (hopefully) relevant |
|
@@ -49,6 +49,20 @@ There are numerous device backends, options, and architecture-specific optimizat | |||
```` | |||
which activates the OpenMP backend. All the options controlling device backends, options, architectures, and third-party libraries (TPLs) are given in [CMake Keywords](../keywords). | |||
|
|||
## Separate Compilation via CMake Language |
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 know it is now from you, but I am wondering why "separate compilation"?
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.
It's technically "separable compilation" and was introduced in kokkos/kokkos#3136 with meaning such as "the compilation settings can be different for every target; they are separable".
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 have no hard feelings about this. My line of reasoning was: Currently we don't offer the possibility to separate the compilation but rather we kind of force the separation when Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE=ON
, as the source files and targets that use kokkos will require to have properties set by cmake manually or might not compile
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 understand, but most people will read this as "it is the way to do libraries." Separable
is slightly better.
I agree with your assessment, I ended at the same places in the cmake files. |
Sure. I was just suggesting a more incremental approach. First, document the current behavior of |
|
Co-authored-by: Cédric Chevalier <[email protected]>
* * ``Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE`` | ||
* Enables Kokkos behaving like a CMake language, see `Separate Compilation <building.html#separate-compilation-via-cmake-language>`_. | ||
* ``OFF`` | ||
|
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.
* * ``Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE`` | |
* Use native CMake language support | |
* Analogous to CUDA/HIP as CMake language | |
* ``OFF`` |
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 must be three lines not four for rendering the table correctly.
Some documentation for the Kokkos as CMake language that
Kokkos
already provides and that solve the problem described in kokkos/kokkos#7144Will stay a draft for now as we might need to update the example in core and add stuff to the tutorial