错误信息
(base) cifi@cifi-666666:~$ nvcc -o softmax softmax.cu -lcudart
softmax.cu:4:10: fatal error: cub/cub.cuh: No such file or directory
#include <cub/cub.cuh>
^~~~~~~~~~~~~
compilation terminated.
-
从 CUDA 11.0 开始,
CUB
已经集成在 CUDA Toolkit 中,我安装了toolkit$sudo apt install nvidia-cuda-toolkit
-
fatal error: cub/cub.cuh: No such file or directory 升级到 cuda 8的方法并不起作用
-
我也没在include文件夹下找到相关文件:
(base) cifi@cifi-666666:/usr/include$ ls -ahl | grep cub
-rw-r--r-- 1 root root 206K 8月 10 2019 cublas_api.h
-rw-r--r-- 1 root root 33K 8月 10 2019 cublas.h
-rw-r--r-- 1 root root 45K 8月 10 2019 cublasLt.h
-rw-r--r-- 1 root root 11K 8月 10 2019 cublas_v2.h
-rw-r--r-- 1 root root 41K 4月 11 2020 cublasXt.h
- 所以选择单独安装的解决方案:
安装 CUB
git clone https://github.com/NVlabs/cub.git
- 在编译时添加
-I
选项,解决错误:
nvcc -I ./cub -o softmax softmax.cu