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

Time:11-25

I wrote the following python code

import tvm

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

The output is

ctx:  False

However, I install cuda and cuda driver. The nvidia-smi result is,

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

I use lspci -vnn | grep VGA to check whether there is a GPU. The result is

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])

And my system is Linux PowerEdge-R740 5.4.0-90-generic #101~18.04.1-Ubuntu.My python version is 3.6.

I don't know why tvm cannot find the correct device.

CodePudding user response:

One possible source of error could be that you did not enable CUDA backend support when installing TVM.

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, …).

Please refer to: https://tvm.apache.org/docs/install/from_source.html#install-from-source

(I would have commented, but not enough reputation)

  • Related