Conda Numba Cuda:找不到libNVVM

如何解决Conda Numba Cuda:找不到libNVVM

我的开发环境是:Ubuntu 18.04.5 LTS,Python3.6,我已经通过conda(numba和cudatoolkit)安装了。 cuda支持的Nvidia GPU GeForce GTX 1050 Ti。

conda和numba的安装似乎可以按预期工作,因为我可以在python3.6脚本中导入numba。

该问题的情况似乎与此处提出的问题相同:Cuda: library nvvm not found 但是所提出的解决方案似乎都不适合我,并且我不确定如何正确突出我的处境(我无法通过其他线程的回答来做到这一点...)。如果提出该问题的副本不适当,请指导我进行适当的行为。

当我尝试运行下面的代码时,出现以下错误: numba.cuda.cudadrv.error.NvvmSupportError:找不到libNVVM。做conda install 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,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数据。我对这些出口尝试了许多变体,但均未成功。这也许是解决方案所在的地方,但是如果是这样,那么解决方案将从通用化中受益。

有人对此问题有任何最新的或广义的解决方案吗?

编辑:从终端输出中添加信息(感谢您提示编辑问题的提示)

> 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

还添加来自numba -s的输出:https://pastebin.com/raw/6u1MUkxg

可能原因的想法(尚未确认):我在numba -s输出中注意到它指定了Python Version: 3.8.3,在终端中我已经明确使用python3.6,因为简单地使用python通常意味着使用python2.7。但是,我检查了一下,现在我的系统使用带有python命令的Python 3.8.3和带有python3.6的Python 3.6.9。当使用python运行代码时,我得到了一个语法错误,这是一个好兆头:raise ValueError(missing_launch_config_msg)

我将尝试修复语法错误并确认代码可以正常工作,然后在此报告情况。

解决方法

解决方案的确认:在终端中使用python代替python3.6解决了该问题。根本原因是用户。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-