运行代码:
import numba
numba.cuda.api.detect()
我收到错误:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
numba.cuda.api.detect()
File "C:\Users\Wakasuki\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numba\cuda\api.py", line 257, in detect
print('Found %d CUDA devices' % len(devlist))
File "C:\Users\Wakasuki\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numba\cuda\cudadrv\devices.py", line 49, in __len__
return len(self.lst)
File "C:\Users\Wakasuki\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numba\cuda\cudadrv\devices.py", line 26, in __getattr__
numdev = driver.get_device_count()
File "C:\Users\Wakasuki\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numba\cuda\cudadrv\driver.py", line 269, in get_device_count
self.cuDeviceGetCount(byref(count))
File "C:\Users\Wakasuki\AppData\Local\Programs\Python\Python35-32\lib\site-packages\numba\cuda\cudadrv\driver.py", line 218, in __getattr__
self.initialization_error)
numba.cuda.cudadrv.error.CudaSupportError: Error at driver init:
CUDA disabled by user:
如何在numba中启用CUDA?我刚刚在python 3.5中安装了CUDA工具包7.5和最新的numba和numpy。
答案 0 :(得分:2)
尝试如下:
'...'是“nvvm64_31_0.dll”和“libdevice”的CUDA工具包7.5的安装路径
import os
os.environ['NUMBAPRO_NVVM']=r'C:\NVIDIA GPU Computing Toolkit\CUDA\v8.0\nvvm\bin\nvvm64_31_0.dll'
os.environ['NUMBAPRO_LIBDEVICE']=r'C:\NVIDIA GPU Computing Toolkit\CUDA\v8.0\nvvm\libdevice'