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

kai*_*_sk 6 cuda gpu pycuda

当我按照此说明安装 pycuda 时:

pip install pycuda
Run Code Online (Sandbox Code Playgroud)

但有一个错误:

src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

但我已经安装了 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
Run Code Online (Sandbox Code Playgroud)

这是在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!
Run Code Online (Sandbox Code Playgroud)

Iva*_*aev 10

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

-lcurand not found
Run Code Online (Sandbox Code Playgroud)

src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

导出 C_INCLUDE_PATH 对我没有帮助。相反,我需要导出 C_INCLUDE_PATH - CPATH 的通用版本:

export CPATH=$CPATH:/usr/local/cuda/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64
Run Code Online (Sandbox Code Playgroud)


Ste*_*nko 10

这就是我在 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
Run Code Online (Sandbox Code Playgroud)


use*_*260 5

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

export C_INCLUDE_PATH=${CUDA_HOME}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${CUDA_HOME}/lib64:$LIBRARY_PATH
Run Code Online (Sandbox Code Playgroud)

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