E3SM-Project / E3SM-Project/EKAT
Scope out usage of CUDA as cmake language
- Dominant language
- C++
- Stars
- 22
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Idea: do not rely on nvcc_wrapper for the cuda-vs-host compiler magic, but use native CMake stuff (assuming cmake version is 3.18 or higher). Possible approach: set a var `CXX_LANG` which evaluates to `CXX` for non-cuda builds, and to `CUDA` for cuda builds. Then manually set the language of all src files to `${CXX_LANG}`, to force compilation with the proper compiler.
I speculate that this would also allow to get stuff like
```
target_compile_features(mylib PRIVATE cxx_constexpr)
```
to work correctly. I _think_ the nvcc_wrapper layer is somehow blocking communication between the compiler and cmake, preventing correct detection of cxx features. By using native CMake support for CUDA, I suspect this could be fixed, since cmake would invoke nvcc for compiling CUDA sources, folllowed by an invoke of the host compiler on the generated intermediate cpp source.
Contributor guide
Assessment
This issue has not been assessed yet.