ExecError: error invoking 'nvcc --version': [Errno 2] No such file or directory: 'nvcc': 'nvcc'
ExecError: error invoking 'nvcc --version': [Errno 2] No such file or directory: 'nvcc': 'nvcc'
我正在我的 spyder(python3) 上尝试这段代码。
import pycuda.autoinit
import pycuda.driver as drv
import numpy
from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
const int i = threadIdx.x;
dest[i] = a[i] * b[i];
}
""")
multiply_them = mod.get_function("multiply_them")
a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)
dest = numpy.zeros_like(a)
multiply_them(
drv.Out(dest), drv.In(a), drv.In(b),
block=(400,1,1), grid=(1,1))
print (dest-a*b)
但无法 运行 代码。
ExecError: error invoking 'nvcc --version': [Errno 2] No such file or
directory: 'nvcc': 'nvcc'
我的 nvcc -- 版本是
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
哪个nvcc
/usr/local/cuda-8.0/bin/nvcc
哪个间谍
/home/anaconda3/bin/spyder
$哪个康达
/home/anaconda3/bin/conda
设备查询:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce 940MX"
CUDA Driver Version / Runtime Version 9.0 / 8.0
回显 $PATH
/home/anaconda3/bin:/usr/local/cuda-8.0/bin:/home/bin:/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
我已经尝试 运行在终端上输入代码。然后是 运行ning ,但从 sourceModule 行本身显示错误。
"/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/compiler.py", line 255, in compile
return compile_plain(source, options, keep, nvcc, cache_dir, target)
File "/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/compiler.py", line 137, in compile_plain
stderr=stderr.decode("utf-8", "replace"))
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpbdkxu33o/kernel.cu failed
[command: nvcc --cubin -arch sm_50 -I/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/cuda kernel.cu]
[stderr:
In file included from /usr/local/cuda-8.0/bin/..//include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda-8.0/bin/..//include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
]
我也在我的 Jupiter 笔记本和其他安装了 Cuda 的系统上进行了尝试。但无法确定问题所在。任何帮助都是可观的。
它正在通过终端在 python2 虚拟环境中工作。
我正在我的 spyder(python3) 上尝试这段代码。
import pycuda.autoinit
import pycuda.driver as drv
import numpy
from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
const int i = threadIdx.x;
dest[i] = a[i] * b[i];
}
""")
multiply_them = mod.get_function("multiply_them")
a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)
dest = numpy.zeros_like(a)
multiply_them(
drv.Out(dest), drv.In(a), drv.In(b),
block=(400,1,1), grid=(1,1))
print (dest-a*b)
但无法 运行 代码。
ExecError: error invoking 'nvcc --version': [Errno 2] No such file or directory: 'nvcc': 'nvcc'
我的 nvcc -- 版本是
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
哪个nvcc
/usr/local/cuda-8.0/bin/nvcc
哪个间谍
/home/anaconda3/bin/spyder
$哪个康达
/home/anaconda3/bin/conda
设备查询:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce 940MX"
CUDA Driver Version / Runtime Version 9.0 / 8.0
回显 $PATH
/home/anaconda3/bin:/usr/local/cuda-8.0/bin:/home/bin:/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
我已经尝试 运行在终端上输入代码。然后是 运行ning ,但从 sourceModule 行本身显示错误。
"/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/compiler.py", line 255, in compile
return compile_plain(source, options, keep, nvcc, cache_dir, target)
File "/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/compiler.py", line 137, in compile_plain
stderr=stderr.decode("utf-8", "replace"))
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpbdkxu33o/kernel.cu failed
[command: nvcc --cubin -arch sm_50 -I/home/anaconda3/lib/python3.6/site-packages/pycuda-2017.1-py3.6-linux-x86_64.egg/pycuda/cuda kernel.cu]
[stderr:
In file included from /usr/local/cuda-8.0/bin/..//include/cuda_runtime.h:78:0,
from <command-line>:0:
/usr/local/cuda-8.0/bin/..//include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
#error -- unsupported GNU version! gcc versions later than 5 are not supported!
^~~~~
]
我也在我的 Jupiter 笔记本和其他安装了 Cuda 的系统上进行了尝试。但无法确定问题所在。任何帮助都是可观的。
它正在通过终端在 python2 虚拟环境中工作。