CUDA error: fatal error: cub/cub.cuh: No such file or directory的解决方案 + 单独安装 CUB解决

错误信息

在这里插入图片描述

(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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值