如何解决CUDA PATH错误?

时间:2017-01-23 17:21:37

标签: nvidia ubuntu-16.04

我最近安装了NVIDIA CUDA并测试运行代码:

from numba import cuda
from numba import *
import numpy as np
from pylab import imshow, show
from timeit import default_timer as timer

但是我在ubuntu 16.0.4中遇到了这个错误。如何解决此错误:

@cuda.jit(argtypes=[f8, f8, f8, f8, uint8[:,:], uint32])
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/decorators.py", line 92, in kernel_jit
    kernel.bind()
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/compiler.py", line 489, in bind
    self._func.get()
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/compiler.py", line 366, in get
    cuctx = get_context()
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 194, in get_context
    return _runtime.get_or_create_context(devnum)
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 162, in get_or_create_context
    return self.push_context(self.gpus[devnum])
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 40, in __getitem__
    return self.lst[devnum]
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 26, in __getattr__
    numdev = driver.get_device_count()
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/driver.py", line 307, in get_device_count
    self.cuDeviceGetCount(byref(count))
  File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/driver.py", line 248, in __getattr__
    self.initialization_error)
CudaSupportError: Error at driver init: 

CUDA driver library cannot be found.
If you are sure that a CUDA driver is installed,
try setting environment variable NUMBA_CUDA_DRIVER
with the file path of the CUDA driver shared library.

1 个答案:

答案 0 :(得分:2)

尝试引入以下变量

export NUMBAPRO_NVVM=/home/cuda-7.5/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/home/cuda-7.5/nvvm/libdevice/
你的.bashrc文件中的

通常位于home / username / 在您的情况下,应根据您的cuda安装路径更正上述路径。请注意,即使您只使用umba,也不使用numbapro,变量的名称应如上所示。