src / cpp / cuda.hpp:14:10:致命错误:cuda.h:没有这样的文件或目录

时间:2018-09-06 02:20:00

标签: cuda gpu pycuda

当我通过以下说明安装pycuda时:

pip install pycuda

但是有一个错误:

src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory

但是我已经安装了cuda工具包。这是nvcc -V的结果

[root@localhost include]# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:07:04_CDT_2018
Cuda compilation tools, release 9.2, V9.2.148

这是从https://developer.nvidia.com/cuda-downloads下载了安装rpm的结果

[root@localhost include]# sudo dnf install cuda
Last metadata expiration check: 0:05:09 ago on Wed 05 Sep 2018 10:08:35 PM EDT.
Package cuda-1:9.2.148.1-2.fc28.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!

4 个答案:

答案 0 :(得分:8)

这就是我在Jetson NANO上解决问题的方式:

sudo pip3 install --global-option=build_ext --global-option="-I/usr/local/cuda-10.0/targets/aarch64-linux/include/" --global-option="-L/usr/local/cuda-10.0/targets/aarch64-linux/lib/" pycuda

答案 1 :(得分:2)

您可能需要指定CUDA的路径:

export C_INCLUDE_PATH=${CUDA_HOME}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${CUDA_HOME}/lib64:$LIBRARY_PATH

请确保echo ${CUDA_HOME}确实提供了一些合理的输出。

答案 2 :(得分:1)

就我而言,我遇到了两个问题:

-lcurand not found

src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory

导出C_INCLUDE_PATH并没有帮助我。相反,我需要导出C_INCLUDE_PATH的常规版本- CPATH

export CPATH=$CPATH:/usr/local/cuda/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64

答案 3 :(得分:0)

使用以下命令查找系统中Cuda的安装位置 find / - type d - name cuda 2>/dev/null

使用或在哪个位置找到CUDA

export PATH=/usr/local/cuda-VERSION/bin:$PATH

然后

pip install pycuda