[CMake] Modern CMake + CUDA + Clang

Stephen McDowell sjm324 at cornell.edu
Sun Mar 11 23:10:59 EDT 2018


Hello!

I stumbled across the new 3.8+ CUDA as a language capabilities, and am very excited about this!

1. Does anybody know when CMAKE_CUDA_COMPILER_ID and CMAKE_CUDA_COMPILER_VERSION were fixed?

With cmake 3.9.4 some of the cuda compiler variables were unset:

   message("CXX compiler stuff:")
   message(STATUS "CMAKE_CXX_COMPILER:         ${CMAKE_CXX_COMPILER}")
   message(STATUS "CMAKE_CXX_COMPILER_ID:      ${CMAKE_CXX_COMPILER_ID}")
   message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
   message("CUDA compiler stuff:")
   message(STATUS "CMAKE_CUDA_COMPILER:         ${CMAKE_CUDA_COMPILER}")
   message(STATUS "CMAKE_CUDA_COMPILER_ID:      ${CMAKE_CUDA_COMPILER_ID}")
   message(STATUS "CMAKE_CUDA_COMPILER_VERSION: ${CMAKE_CUDA_COMPILER_VERSION}")
   message(FATAL_ERROR "bye bye")

CMAKE_CUDA_COMPILER was set, but COMPILER_ID and COMPILER_VERSION were not.  I just updated to 3.10.2 and they were giving values I would expect.  I dug around under the diffs on Modules but got really turned around.

I would like to set my minimum required version to whenever this was introduced, as I would like to wield it.

2. Is there any existing work / discussion on the new world order (CUDA as a full-fledged language) and Clang?  I noticed that the following happens:

   if(CMAKE_CUDA_COMPILER_ID)
     include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
   endif()

leaving room for a Compiler/Clang-CUDA.cmake to be created.  Is there an eventual goal to write this?  I think I can maybe help get a prototype working if that was the goal for this setup.

3. Supposing CMake + Clang + CUDA was working, the working assumption would be that a user sets CUDACXX to clang++, right?  I’m trying to understand if Clang as a cuda compiler already works and I have bad local configurations, or if they are needing to be written.

Thanks for any thoughts!

-Stephen



More information about the CMake mailing list