我正在 Ubuntu 18.04 上构建支持 GPU 的 XGBoost,遵循安装指南. 在此阶段cmake .. -DUSE_CUDA=ON
它失败了make[1]: execvp: /usr/local/cuda/bin: Permission denied
。
完整输出如下。
-- CMake version 3.17.1
-- xgboost VERSION: 1.2.0
-- Configured CUDA host compiler: /usr/bin/c++
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: /usr/local/cuda/bin
-- Check for working CUDA compiler: /usr/local/cuda/bin - broken
CMake Error at /usr/local/share/cmake-3.17/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
"/usr/local/cuda/bin"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/tassadar/lib/xgboost/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_2db63/fast && /usr/bin/make -f CMakeFiles/cmTC_2db63.dir/build.make CMakeFiles/cmTC_2db63.dir/build
make[1]: Entering directory '/home/tassadar/lib/xgboost/build/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_2db63.dir/main.cu.o
/usr/local/cuda/bin -ccbin=/usr/bin/c++ -x cu -c /home/tassadar/lib/xgboost/build/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_2db63.dir/main.cu.o
make[1]: execvp: /usr/local/cuda/bin: Permission denied
CMakeFiles/cmTC_2db63.dir/build.make:85: recipe for target 'CMakeFiles/cmTC_2db63.dir/main.cu.o' failed
make[1]: *** [CMakeFiles/cmTC_2db63.dir/main.cu.o] Error 127
make[1]: Leaving directory '/home/tassadar/lib/xgboost/build/CMakeFiles/CMakeTmp'
Makefile:141: recipe for target 'cmTC_2db63/fast' failed
make: *** [cmTC_2db63/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:95 (enable_language)
-- Configuring incomplete, errors occurred!
See also "/home/tassadar/lib/xgboost/build/CMakeFiles/CMakeOutput.log".
See also "/home/tassadar/lib/xgboost/build/CMakeFiles/CMakeError.log".
的权限/usr/local/cuda/bin
如下。
total 59288
drwxrwxrwx 3 tassadar tassadar 4096 чер 4 15:55 .
drwxr-xr-x 18 root root 4096 чер 4 15:55 ..
-rwxrwxrwx 1 root root 80576 чер 4 15:55 bin2c
lrwxrwxrwx 1 root root 4 чер 4 15:55 computeprof -> nvvp
drwxrwxrwx 2 root root 4096 чер 4 15:55 crt
-rwxrwxrwx 1 root root 4833904 чер 4 15:55 cudafe++
-rwxrwxrwx 1 root root 8890248 чер 4 15:55 cuda-gdb
-rwxrwxrwx 1 root root 581744 чер 4 15:55 cuda-gdbserver
-rwxrwxrwx 1 root root 800 чер 4 15:55 cuda-install-samples-10.2.sh
-rwxrwxrwx 1 root root 397480 чер 4 15:55 cuda-memcheck
-rwxrwxrwx 1 root root 931664 чер 4 15:55 cuda-uninstaller
-rwxrwxrwx 1 root root 212224 чер 4 15:55 cuobjdump
-rwxrwxrwx 1 root root 195600 чер 4 15:55 fatbinary
-rwxrwxrwx 1 root root 219 чер 4 15:55 nsight
-rwxrwxrwx 1 root root 1580 чер 4 15:55 nsight_ee_plugins_manage.sh
-rwxrwxrwx 1 root root 444 чер 4 15:55 nsight-sys
-rwxrwxrwx 1 root root 512 чер 4 15:55 nsys
-rwxrwxrwx 1 root root 533 чер 4 15:55 nsys-exporter
-rwxrwxrwx 1 root root 229504 чер 4 15:55 nvcc
-rwxrwxrwx 1 root root 417 чер 4 15:55 nvcc.profile
-rwxrwxrwx 1 root root 23034280 чер 4 15:55 nvdisasm
-rwxrwxrwx 1 root root 8092008 чер 4 15:55 nvlink
-rwxrwxrwx 1 root root 2583 чер 4 15:55 nv-nsight-cu
-rwxrwxrwx 1 root root 2801 чер 4 15:55 nv-nsight-cu-cli
-rwxrwxrwx 1 root root 5094688 чер 4 15:55 nvprof
-rwxrwxrwx 1 root root 97168 чер 4 15:55 nvprune
-rwxrwxrwx 1 root root 285 чер 4 15:55 nvvp
-rwxrwxrwx 1 root root 7955808 чер 4 15:55 ptxas
我究竟做错了什么?
答案1
检查您是否以 sudo 身份运行该命令。否则请检查文件权限。运行chmod +x /usr/local/cuda/bin
以获取可执行文件访问权限。
答案2
CMAKE 变量 CMAKE_CUDA_COMPILER 错误地设置为目录(/usr/local/cuda/bin),而不是编译器可执行文件的完整路径(/usr/local/cuda/bin/nvcc)。