-
Notifications
You must be signed in to change notification settings - Fork 0
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 section to let CMake manage the Kokkos dependency #41
base: main
Are you sure you want to change the base?
Conversation
install.md
Outdated
### As a dependency managed by CMake | ||
|
||
```cmake | ||
find_package(Kokkos CONFIG) |
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.
Two minor questions:
- Do you think it is a good practice to explicitly set
CONFIG
? - If we allow
find_package
to fail, should we put it inQUIET
?
I am still skeptical with this mixed approach though. If Kokkos is found, the options are already set. On the other hand, if it is not found, the user is responsible to select the options. We use a similar approach in DDC, with submodules instead, and I don't know if we should advertise about it.
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'm not sure about CONFIG
, to be honest. I started using it blindly when I saw it somewhere. So I tried the different options:
find_package(Kokkos)
- Kokkos installed:
-- Enabled Kokkos devices: SERIAL;CUDA -- kokkos_launch_compiler is enabled globally. C++ compiler commands with -DKOKKOS_DEPENDENCE will be redirected to the appropriate compiler for Kokkos
- Kokkos not installed:
The bunch of warnings is not helpful;
CMake Warning at CMakeLists.txt:8 (find_package): By not providing "FindKokkos.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Kokkos", but CMake did not find one. Could not find a package configuration file provided by "Kokkos" (requested version 4.3.1) with any of the following names: KokkosConfig.cmake kokkos-config.cmake Add the installation prefix of "Kokkos" to CMAKE_PREFIX_PATH or set "Kokkos_DIR" to a directory containing one of the above files. If "Kokkos" provides a separate development package or SDK, be sure it has been installed. -- Setting default Kokkos CXX standard to 17 -- Kokkos version: 4.3.1 <snip>
- Kokkos installed:
find_package(Kokkos CONFIG)
- Kokkos installed:
-- Enabled Kokkos devices: SERIAL;CUDA -- kokkos_launch_compiler is enabled globally. C++ compiler commands with -DKOKKOS_DEPENDENCE will be redirected to the appropriate compiler for Kokkos
- Kokkos not installed:
I saw tutorial attendants being confused about the first line;
-- Could NOT find Kokkos (missing: Kokkos_DIR) -- Setting default Kokkos CXX standard to 17 -- Kokkos version: 4.3.1 <snip>
- Kokkos installed:
find_package(Kokkos QUIET)
- Kokkos installed:
-- Enabled Kokkos devices: SERIAL;CUDA -- kokkos_launch_compiler is enabled globally. C++ compiler commands with -DKOKKOS_DEPENDENCE will be redirected to the appropriate compiler for Kokkos
- Kokkos not installed:
-- Setting default Kokkos CXX standard to 17 -- Kokkos version: 4.3.1 <snip>
- Kokkos installed:
So, QUIET
seems to be more appropriate.
I see your point. The subdirectory (aka submodule) approach already in the cheat sheet does not provide the "find package otherwise use a subdirectory" approach.
Initially, I wanted to give a flexible solution. Note that this is what Daniel advised Keigo Nitadori (during the last Kokkos Café) to do when using CMake. But this is not the most flexible solution, which would be too long for this cheat sheet.
Eventually, I think I can limit the section to just using FetchContent
, but I feel something would be missing. I would add a specific "Mixed approach" section which also warns about what you just said.
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.
Eventually, the Kokkos documentation proposes the 3 + 1 approaches altogether: https://kokkos.org/kokkos-core-wiki/get-started/integrating-kokkos-into-your-cmake-project.html
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.
Well, I used the approach of the documentation.
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.
In the end I don't think we should go into the details of how to use FetchContent
etc. This is largely opinionated. I would rather describe the package name, the targets and the components available. Similar to the Targets
tab in https://conan.io/center/recipes/ginkgo. We can also mention that Kokkos supports being added as a subdirectory, this implies for example that Kokkos::kokkos
also exists which is not obvious.
I don't know, I think it gives practical directions about "how to include Kokkos as a dependency to my project," which is unfortunately not trivial at this time. You cannot simply do: conan install kokkos |
Warning: this currently destroys the page layout.