CLion неправильно обнаруживает clang как компилятор CUDA

#c #cmake #clion

#c #cmake #clion

Вопрос:

Я использую CMake 3.18 с CLion 2020.2.5 и хочу использовать Clang в качестве компилятора CUDA. Я делаю это со следующими двумя строками в верхней части моего CMakeLists.txt :

 set(CMAKE_CUDA_COMPILER_ID Clang)
set(CMAKE_CUDA_COMPILER ${CMAKE_CXX_COMPILER})
 

И это очень хорошо работает для кода, и мне также кажется, что CLion может работать с кодом просто отлично. Но он все еще жалуется при настройке проекта:

 -- Configuring done
-- Generating done
-- Build files have been written to: /home/mu/project

Problems were encountered while collecting compiler information:
    Unexpected compiler output. This compiler might be unsupported.
    If you are using GCC/Clang, please report the bug in https://youtrack.jetbrains.com/issues/CPP.
 

В журнале ошибок я нахожу это:

 Checking whether the CUDA compiler is NVIDIA using "" did not match "nvcc: NVIDIA (R) Cuda compiler driver":
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
 

В журнале вывода кажется, что он может идентифицировать компилятор просто отлично:

 Checking whether the CUDA compiler is Clang using "" matched "(clang version)":
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" succeeded.
Compiler: /usr/bin/clang   
Build flags: 
Id flags: --cuda-path=/usr/local/cuda;--cuda-gpu-arch=sm_52 -v

The output was:
0
clang version 11.0.0 (Fedora 11.0.0-2.fc33)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 10.0
 "/usr/bin/clang-11" -cc1 -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCUDACompilerId.cu -mrelocation-model static -mframe-pointer=all -fno-rounding-math -fno-verbose-asm -no-integrated-as -munwind-tables -aux-target-cpu x86-64 -fcuda-is-device -mlink-builtin-bitcode /usr/local/cuda/nvvm/libdevice/libdevice.10.bc -target-feature  ptx63 -target-sdk-version=10.0 -target-cpu sm_52 -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/11.0.0 -internal-isystem /usr/lib64/clang/11.0.0/include/cuda_wrappers -internal-isystem /usr/local/cuda/include -include __clang_cuda_runtime_wrapper.h -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fno-dwarf-directory-asm -fno-autolink -fdebug-compilation-dir /home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -o /tmp/CMakeCUDACompilerId-b39068.s -x cuda CMakeCUDACompilerId.cu
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/lib64/clang/11.0.0/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib64/clang/11.0.0/include/cuda_wrappers
 /usr/local/cuda/include
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward
 /usr/local/include
 /usr/lib64/clang/11.0.0/include
 /usr/include
End of search list.
 "/usr/local/cuda/bin/ptxas" -m64 -O0 -v --gpu-name sm_52 --output-file /tmp/CMakeCUDACompilerId-0e6743.o /tmp/CMakeCUDACompilerId-b39068.s
ptxas info    : 0 bytes gmem
 "/usr/local/cuda/bin/fatbinary" --cuda -64 --create /tmp/CMakeCUDACompilerId-346390.fatbin --image=profile=sm_52,file=/tmp/CMakeCUDACompilerId-0e6743.o --image=profile=compute_52,file=/tmp/CMakeCUDACompilerId-b39068.s
 "/usr/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu -target-sdk-version=10.0 -aux-triple nvptx64-nvidia-cuda -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCUDACompilerId.cu -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /usr/lib64/clang/11.0.0 -internal-isystem /usr/lib64/clang/11.0.0/include/cuda_wrappers -internal-isystem /usr/local/cuda/include -include __clang_cuda_runtime_wrapper.h -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcuda-include-gpubinary /tmp/CMakeCUDACompilerId-346390.fatbin -faddrsig -o /tmp/CMakeCUDACompilerId-4af90f.o -x cuda CMakeCUDACompilerId.cu
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux"
ignoring duplicate directory "/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/lib64/clang/11.0.0/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib64/clang/11.0.0/include/cuda_wrappers
 /usr/local/cuda/include
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c  /10/backward
 /usr/local/include
 /usr/lib64/clang/11.0.0/include
 /usr/include
End of search list.
 "/usr/bin/ld" --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/10/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/10 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/10/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/CMakeCUDACompilerId-4af90f.o -lstdc   -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/10/crtend.o /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crtn.o


Compilation of the CUDA compiler identification source "CMakeCUDACompilerId.cu" produced "a.out"

The CUDA compiler identification is Clang, found in "/home/mu/project/CMakeFiles/3.18.4/CompilerIdCUDA/a.out"
 

Как я могу решить проблему между CMake и CLion?