我正在尝试运行下面的代码,但报告错误:
NvvmSupportError:找不到libNVVM。 conda install
cudatoolkit
:未找到库nvvm
我的开发环境是:Ubuntu 17.04,Spyder / Python3.5和我已经通过conda(numba和cudatoolkit)安装。 Nvidia GPU(GTX 1070和GTX 1060)。
import numpy as np
from timeit import default_timer as timer
from numba import vectorize
@vectorize(["float32(float32, float32)"], target='cuda')
def VecADD(a,b):
return a+b
n = 32000000
a = np.ones (n, dtype=np.float32)
b = np.ones (n, dtype=np.float32)
c = np.zeros(n, dtype=np.float32)
start = timer()
C = VecADD(a,b)
print (timer() - start)
有谁知道如何解决这个问题?
答案 0 :(得分:18)
在完全相同的情况下对我有用的是在.bashrc中包含以下内容(我目前正在使用cuda-9.0)。不要被变量名中的NUMBAPRO抛弃 - 它适用于numba(至少对我而言):
export NUMBAPRO_NVVM=/usr/local/cuda-9.0/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-9.0/nvvm/libdevice/
更新:它对我也有用。当我使用Cuda 10.1时,我已经包含以下行而不是你的行:
export NUMBAPRO_NVVM=/usr/local/cuda-10.1/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-10.1/nvvm/libdevice/
答案 1 :(得分:1)
一种解决方案是:
import os
os.environ['NUMBAPRO_NVVM'] = r'C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v8.0\nvvm\bin\nvvm64_31_0.dll'
os.environ['NUMBAPRO_LIBDEVICE'] = r'C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v8.0\nvvm\libdevice'
或者如果您使用的是PyCharm GO TO RUN>编辑配置
export NUMBAPRO_NVVM=/usr/local/cuda-{cuda version}/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-{cuda version}/nvvm/libdevice/
答案 2 :(得分:1)
在Ubuntu 18.04上,如果您从官方存储库安装了所有库和软件包,则需要在.bashrc
上添加两个信息,以允许numba
找到您的库和设备:
...
export NUMBAPRO_LIBDEVICE=/usr/lib/cuda/nvvm/libdevice
export NUMBAPRO_NVVM=/usr/lib/x86_64-linux-gnu/
...
NUMBAPRO_LIBDEVICE信息是从软件包中提取的:
$ dpkg -L nvidia-cuda-toolkit
和NUMBAPRO_NVVM来自:
$ dpkg -L libnvvm3
就是这样。
答案 3 :(得分:0)
我使用anaconda-navigator解决了这个问题。 您可以在此处下载:https://www.anaconda.com/distribution/
答案 4 :(得分:0)
根据我的经验,如果您使用https://ngc.nvidia.com/catalog/landing中的容器,所有这些CUDA(和类似的驱动程序)问题都会消失。
您必须确保以nvidia-docker
而非docker
来启动docker,这将非常有效地启用与GPU相关的驱动程序。
答案 5 :(得分:0)
ln -s / usr / lib / x86_64-linux-gnu / / usr / lib / nvidia-cuda-toolkit / bin / nvvm / lib64
ln -s / usr / lib / nvidia-cuda-toolkit / libdevice / / usr / lib / nvidia-cuda-toolkit / bin / nvvm / libdevice
export CUDA_HOME = / usr / lib / nvidia-cuda-toolkit / bin /
修复了铅块。
答案 6 :(得分:0)
带有CUDA 10.2的Debian»Buster«(和pip3代替conda)
numba -s
…
CUDA libraries:
Finding cublas
ERROR: can't locate lib
Finding cusparse
ERROR: can't locate lib
Finding cufft
ERROR: can't locate lib
Finding curand
ERROR: can't locate lib
Finding nvvm
ERROR: can't locate lib
finding libdevice for compute_20... ERROR: can't open libdevice for compute_20
finding libdevice for compute_30... ERROR: can't open libdevice for compute_30
finding libdevice for compute_35... ERROR: can't open libdevice for compute_35
finding libdevice for compute_50... ERROR: can't open libdevice for compute_50
…
然后是手册
sudo ln -sv /usr/lib/x86_64-linux-gnu/libcublas.so.10 /usr/local/cuda/lib64/
export NUMBAPRO_CUDALIB=/usr/local/cuda/lib64/
export NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice/
export NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so
我们得到
numba -s
…
CUDA libraries:
Finding cublas
named libcublas.so.10
trying to open library... ok
Finding cusparse
named libcusparse.so.10.3.1.89
trying to open library... ok
Finding cufft
named libcufft.so.10.1.2.89
trying to open library... ok
Finding curand
named libcurand.so.10.1.2.89
trying to open library... ok
Finding nvvm
named libnvvm.so
trying to open library... ok
finding libdevice for compute_20... ok
finding libdevice for compute_30... ok
finding libdevice for compute_35... ok
finding libdevice for compute_50... ok
…
答案 7 :(得分:0)
只要其他人在类似问题上绊倒,就不再支持在其他答案中建议的提供的环境变量。已弃用,并替换为CUDA_HOME
http://numba.pydata.org/numba-doc/latest/cuda/overview.html#setting-cuda-installation-path。