【问题标题】:When using python tvm, No CUDA-capable device is detected使用 python tvm 时,未检测到支持 CUDA 的设备
【发布时间】:2022-01-01 15:42:18
【问题描述】:

我写了下面的python代码

import tvm

ctx = tvm.device("cuda", 0)
print("ctx: ", ctx.exist)

输出是

ctx:  False

但是,我安装了 cuda 和 cuda 驱动程序。 nvidia-smi 结果是,

NVIDIA-SMI 495.44       Driver Version: 495.44       CUDA Version: 11.5

我使用lspci -vnn | grep VGA 来检查是否有GPU。结果是

03:00.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. Integrated Matrox G200eW3 Graphics Controller [102b:0536] (rev 04) (prog-if 00 [VGA controller])
3b:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1e04] (rev a1) (prog-if 00 [VGA controller])
af:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1e04] (rev a1) (prog-if 00 [VGA controller])
d8:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1e04] (rev a1) (prog-if 00 [VGA controller])

我的系统是Linux PowerEdge-R740 5.4.0-90-generic #101~18.04.1-Ubuntu。我的python版本是3.6。

我不知道为什么 tvm 找不到正确的设备。

【问题讨论】:

  • 这可能是 tvm 所需的任何 CUDA 版本(无论 tvm 是什么)与您选择安装的 CUDA 版本不匹配。他们必须匹配。这本身不是一个 CUDA 编程问题

标签: python python-3.x tensorflow cuda nvidia


【解决方案1】:

一个可能的错误来源是您在安装 TVM 时没有启用 CUDA 后端支持。

编辑 build/config.cmake 以自定义编译选项。 将 set(USE_CUDA OFF) 更改为 set(USE_CUDA ON) 以启用 CUDA 后端。对您要为其构建的其他后端和库(OpenCL、RCOM、METAL、VULKAN...)执行相同的操作。

请参考:https://tvm.apache.org/docs/install/from_source.html#install-from-source

(我会评论,但没有足够的声誉)

【讨论】:

    猜你喜欢
    • 2012-10-31
    • 2023-01-04
    • 1970-01-01
    • 1970-01-01
    • 2012-10-14
    • 1970-01-01
    • 2014-05-28
    • 2021-09-15
    • 2019-07-01
    相关资源
    最近更新 更多