计算机各配置版本信息:
cuda:9.0
cudnn:7.4.2
python:3.5
pycuda安装:
pip install pycuda==2017.1.1
安装后运行报错:FileNotFoundError: [Errno 2] No such file or directory: ‘nvcc’
修改compiler.py文件中的compile_plain()函数如下得以解决,如下:
def compile_plain(source, options, keep, nvcc, cache_dir, target=“cubin”):
from os.path import join
assert target in [“cubin”, “ptx”, “fatbin”]
nvcc = ‘/usr/local/cuda/bin/’+nvcc
if cache_dir:
checksum = new_md5()
参考链接: https://codeday.me/bug/20190321/796820.html
之后又出现另一个问题:
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpr0d7p_uv/kernel.cu failed
我通过参考博客: https://blog.youkuaiyun.com/weixin_38730719/article/details/90320632
将compiler.py文件中的arch = "sm%d%d"改成arch = 'sm_70’即可
同时推荐一本pycuda的学习教材:“GPU-Accelerated Computer Vision with Opencv and CUDA”