问题
I am trying to run the code below but an error is reported:
NvvmSupportError: libNVVM cannot be found. Do conda install
cudatoolkit
: library nvvm not found
My development environment is: Ubuntu 17.04, Spyder/Python3.5 and I have installed via conda (numba and cudatoolkit). Nvidia GPUs (GTX 1070 and 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)
Does anyone know how to solve this problem?
回答1:
What worked for me under exactly the same scenario was to include the following in the .bashrc (I'm currently using cuda-9.0). Don't be thrown off by the NUMBAPRO in the variable name - it works for numba (at least for me):
export NUMBAPRO_NVVM=/usr/local/cuda-9.0/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-9.0/nvvm/libdevice/
Update: It worked for me too. As I'm using Cuda 10.1, I have included the following lines instead of yours:
export NUMBAPRO_NVVM=/usr/local/cuda-10.1/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-10.1/nvvm/libdevice/
回答2:
One Solution is:
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'
Or if you are using PyCharm GO TO RUN > Edit Configuration
export NUMBAPRO_NVVM=/usr/local/cuda-{cuda version}/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda-{cuda version}/nvvm/libdevice/
回答3:
On Ubuntu 18.04 if you install all libraries and packages from the official repository, you need to add two information on your .bashrc
to allow numba
to find your libraries and device:
...
export NUMBAPRO_LIBDEVICE=/usr/lib/cuda/nvvm/libdevice
export NUMBAPRO_NVVM=/usr/lib/x86_64-linux-gnu/
...
NUMBAPRO_LIBDEVICE information was extracted from the package:
$ dpkg -L nvidia-cuda-toolkit
and NUMBAPRO_NVVM from:
$ dpkg -L libnvvm3
That's it.
回答4:
I solved this problem using anaconda-navigator. You can download here: https://www.anaconda.com/distribution/
- Open anaconda navigator in Terminal: anaconda-navigator
- In anaconda navigator select Environments
- search for cudatoolkit
- select cudatoolkit
- click in apply
This is my cudatoolkit installed.
This is the button to click when you select a not installed package
回答5:
In my experience, all of these CUDA (and similar driver) problems go away if you use a container from https://ngc.nvidia.com/catalog/landing.
You must ensure that you start docker with nvidia-docker
instead of docker
and it will enable GPU related drivers very effectively.
回答6:
In a Debian Stretch system:
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/
Fixed the pb..
来源:https://stackoverflow.com/questions/48385686/cuda-library-nvvm-not-found