使用 python tvm 时,未检测到支持 CUDA 的设备

When using python tvm, No CUDA-capable device is detected

我写了下面的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 后端支持。

Edit build/config.cmake to customize the compilation options. Change set(USE_CUDA OFF) to set(USE_CUDA ON) to enable CUDA backend. Do the same for other backends and libraries you want to build for (OpenCL, RCOM, METAL, VULKAN, …).

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

(我会评论的,但是声望不够)