Request for "CUDA_COMPILER_LAUNCHER"
ccache support for nvcc is coming (https://github.com/ccache/ccache/pull/145). It works great - not sure yet when/if it will be merged.
If I try to set the CUDA_NVCC_EXECUTABLE
variable to use ccache like this:
cmake .. -DCUDA_NVCC_EXECUTABLE='/usr/local/bin/ccache /usr/local/cuda/bin/nvcc'
then I get a very unhelpful error:
CMake Error at /usr/local/share/cmake-3.8/Modules/FindCUDA.cmake:702 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
Call Stack (most recent call first):
cmake/Cuda.cmake:172 (find_package)
cmake/Dependencies.cmake:285 (include)
CMakeLists.txt:72 (include)
CMake Error at /usr/local/share/cmake-3.8/Modules/FindCUDA.cmake:703 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
Call Stack (most recent call first):
cmake/Cuda.cmake:172 (find_package)
cmake/Dependencies.cmake:285 (include)
CMakeLists.txt:72 (include)
-- Could NOT find CUDA: Found unsuitable version ".", but required is at least "7.0" (found /usr/local/cuda)
Turns out this command fails when CUDA_NVCC_EXECUTABLE
is not a simple path to an executable:
https://gitlab.kitware.com/cmake/cmake/blob/v3.8.2/Modules/FindCUDA.cmake#L701
Either of these flags solves the issue:
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0
-DCUDA_VERSION=8.0
Alternatively, I can create a symlink named nvcc
which points to the ccache
binary, and use THAT as my CUDA_NVCC_EXECUTABLE
, but then I have to make sure nvcc
is on my path (which is not usually necessary when building with CMake).
The more complete approach would be to add support for something like CUDA_COMPILER_LAUNCHER
, in the spirit of 698f7597.