2017-01-23 4 views
1

ich kürzlich installierten NVIDIA CUDA und Test einen Code ausführen:Wie CUDA PATH Fehler zu lösen?

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

Aber ich habe diesen Fehler in ubuntu 16.0.4. Wie kann ich diesen Fehler beheben:

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

Antwort

1

Versuchen folgenden Variablen

export NUMBAPRO_NVVM=/home/cuda-7.5/nvvm/lib64/libnvvm.so 
export NUMBAPRO_LIBDEVICE=/home/cuda-7.5/nvvm/libdevice/ 

in Ihre .bashrc einzuführen, die in der Regel in home/username befindet/ die Pfade oben sollten In Ihrem Fall korrigiert werden in Übereinstimmung mit Ihren Cuda Installationspfaden. Beachten Sie, dass selbst wenn Sie nur umba, nicht numbapro verwenden, die Namen der Variablen wie oben gezeigt sein sollten.