gpt4 book ai didi

python - 如何让 CUDA 与 python 3.5 和 numba 一起工作

转载 作者:行者123 更新时间:2023-12-01 03:58:43 25 4
gpt4 key购买 nike

通过运行代码:

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?我最近刚刚安装了 CUDA 工具包 7.5 以及 python 3.5 中最新的 numba 和 numpy。

最佳答案

尝试如下:

“...”是“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'

关于python - 如何让 CUDA 与 python 3.5 和 numba 一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36974968/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com