9113303
9113303

Reputation: 872

ExecError: error invoking 'nvcc --version': [Errno 2] No such file or directory: 'nvcc': 'nvcc'

I am trying this code on my 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)

But couldn't run the code.

ExecError: error invoking 'nvcc --version': [Errno 2] No such file or directory: 'nvcc': 'nvcc'

My nvcc -- version is

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

which nvcc /usr/local/cuda-8.0/bin/nvcc
which spyder
/home/anaconda3/bin/spyder
$ which conda
/home/anaconda3/bin/conda

Device query :

./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

echo $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

I have tried running the code on terminal. Then its running , but from the sourceModule line itself it shows errors.

"/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!
  ^~~~~
]

Also i have tried on my Jupiter notebook and on other Cuda installed system. But couldn't identify the problem. Any help is appreciable.

Upvotes: 1

Views: 3562

Answers (1)

9113303
9113303

Reputation: 872

Its working on python2 virtual environment through terminal.

Upvotes: 1

Related Questions