Skip to content

Fixes for compilation with Clang

Jonas Hahnfeld requested to merge clang-cuda into master

CUDA support in Clang is a bit more pedantic than nvcc, see the individual commits for explanations. While this merge request resolves many errors, there are still a bunch of problems:

  • It appears Clang cannot mark destructors as __host__ __device__ (or there is a different problem in that context). If so, that's something to be fixed in the compiler (which I might or might not try).
  • I think Clang doesn't support __managed__ which is used in test/cuda/GeometryTest.cu, but I have to double-check. There are probably ways to rewrite that test, but I'm not interested to work on this right now.
  • Clang sometimes has problems to resolve min and max functions, preventing compilation of UnplacedBooleanVolume.cu. Requires some deeper investigation what's going on.
  • The build system currently cannot leverage Clang to compile CUDA sources. This will be solved by !822 (closed) and using CMake's first class support of CUDA (plus at least CMake 3.19 to support relocatable device code compilation with Clang; which is how I tested all the changes in here).

P.S.: Requires https://github.com/root-project/veccore/pull/19 with a similar treatment of VecCore.

Edited by Jonas Hahnfeld

Merge request reports