Cuda: library nvvm not found

喜夏-厌秋 提交于 2019-12-31 12:12:13

问题


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/

  1. Open anaconda navigator in Terminal: anaconda-navigator
  2. In anaconda navigator select Environments
  3. search for cudatoolkit
  4. select cudatoolkit
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!