Python Conda Numba Cuda:找不到libnvm
我的开发环境是:Ubuntu18.04.5LTS,Python3.6,我已经通过conda(numba和cudatoolkit)安装。Nvidia GPU GeForce GTX 1050 Ti,由cuda支持 conda和numba的安装似乎按照预期工作,因为我可以在python3.6脚本中导入numba 问题似乎与此处提出的问题相同: 但是,在我的情况下,所有建议的解决方案似乎都不起作用,我也不确定如何正确地突出我的情况(我无法通过另一个线程中的答案来完成…)。如果提出问题的副本是不合适的,那么请引导我采取正确的行为 当我尝试运行下面的代码时,会出现以下错误:numba.cuda.cudadrv.error.nvmsupporterror:libnvm找不到。执行Python Conda Numba Cuda:找不到libnvm,python,cuda,anaconda,conda,numba,Python,Cuda,Anaconda,Conda,Numba,我的开发环境是:Ubuntu18.04.5LTS,Python3.6,我已经通过conda(numba和cudatoolkit)安装。Nvidia GPU GeForce GTX 1050 Ti,由cuda支持 conda和numba的安装似乎按照预期工作,因为我可以在python3.6脚本中导入numba 问题似乎与此处提出的问题相同: 但是,在我的情况下,所有建议的解决方案似乎都不起作用,我也不确定如何正确地突出我的情况(我无法通过另一个线程中的答案来完成…)。如果提出问题的副本是不合适的,
conda安装cudatoolkit
:未找到库nvvm
from numba import cuda, float32
#Controls threads per block and shared memory usage.
#The computation will be done on blocks of TPBxTPB elements.
TPB = 16
@cuda.jit
def fast_matmul(A, B, C):
# Define an array in the shared memory
# The size and type of the arrays must be known at compile time
sA = cuda.shared.array(shape=(TPB, TPB), dtype=float32)
sB = cuda.shared.array(shape=(TPB, TPB), dtype=float32)
x, y = cuda.grid(2)
tx = cuda.threadIdx.x
ty = cuda.threadIdx.y
bpg = cuda.gridDim.x # blocks per grid
if x >= C.shape[0] and y >= C.shape[1]:
# Quit if (x, y) is outside of valid C boundary
return
# Each thread computes one element in the result matrix.
# The dot product is chunked into dot products of TPB-long vectors.
tmp = 0.
for i in range(bpg):
# Preload data into shared memory
sA[tx, ty] = A[x, ty + i * TPB]
sB[tx, ty] = B[tx + i * TPB, y]
# Wait until all threads finish preloading
cuda.syncthreads()
# Computes partial product on the shared memory
for j in range(TPB):
tmp += sA[tx, j] * sB[j, ty]
# Wait until all threads finish computing
cuda.syncthreads()
C[x, y] = tmp
import numpy as np
matrix_A = np.array([[0.1,0.2],[0.1,0.2]])
按照建议执行操作并运行conda install cudatoolkit
不起作用。我已经尝试了很多我在网上发现的版本,但都没有用
在另一篇博文中,一个似乎对许多人都有效的解决方案是在主目录的.bashrc
文件中添加关于环境变量的行。不过,这些建议是指/usr
目录中存在的文件,因为我是通过conda安装的,所以在该目录中没有cuda数据。我在这些出口产品上尝试了许多变化,但都没有成功。这也许是解决方案所在,但如果是这样,那么解决方案将受益于推广
有人对这个问题有什么最新的或通用的解决方案吗
编辑:从终端输出中添加信息(感谢编辑问题的提示)
还添加来自numba-s
的输出:
可能原因的想法(尚未确认):我注意到在numba-s
输出中,它指定了Python版本:3.8.3
,我一直在终端中明确使用python3.6
,因为简单地使用Python
通常意味着使用python2.7
。但是我检查了,我的系统现在使用Python 3.8.3和Python
命令,使用Python 3.6.9和python3.6
。当使用python
运行代码时,我得到了一个语法错误,这是一个好迹象:raisevalueerror(missing\u launch\u config\u msg)
我将尝试修复语法错误并确认代码正常工作,之后我将在此报告情况。解决方案确认:在终端中使用
python
而不是python3.6
解决了问题。根本原因是用户。可能会引起兴趣。运行conda list numba
和conda list cudatoolkit
的结果是什么?你不必把结果塞进评论中,你可以编辑你的问题。
> conda list numba
# packages in environment at /home/tobka/anaconda3:
#
# Name Version Build Channel
numba 0.51.2 py38h0573a6f_1
> conda list cudatoolkit
# packages in environment at /home/tobka/anaconda3:
#
# Name Version Build Channel
cudatoolkit 11.0.221 h6bb024c_0