English 中文(简体)
Tensorflow cannot detect CUDA enabled device
原标题:

I have an RTX 4070 on my Dell XPS laptop that also comes with an Intel IRIS Xe Graphics card. I am using Windows 11.

I have NVIDIA Graphics Driver Version 535.98 installed on my system and has support for CUDA versions up to 12.2. I need to use CUDA 11.2 and that s what I have installed on my system.

Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0

is what I get with nvcc --version.

I am working on a project that produces an exe upon compilation. The project exe expects multiple dlls including tensorflow_cc.dll since the neural network code is based out of tensorflow. Upon running the application, I receive the following error.

E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

and then application proceeds to run successfully from there on (although a lot slower since it is running on the CPU).

I am able to run the DeviceQuery sample from NVIDIA successfully. DeviceQuery detects 1 CUDA capable device (Device0 = NVIDIA GeForce RTX 4070 Laptop GPU) with CUDA Driver Version 12.2 and CUDA Runtime Version 11.2 as expected.

I have tried everything I could to debug this issue - renistalled CUDA 11.2 as well as the NVIDIA drivers but with no success. I know that this question has been asked and answered multiple times before but nothing works for me. I have already set the CUDA_VISIBLE_DEVICES environment variable as 0.

In order to debug further, I tried GPUtil. getAvailable() which returns [0] (Device 0 detected as GPU) when run on a Python interpreter. I wanted to try running torch.cuda.is_available() as an additional test to debug but I am just unable to install a GPU supporting version torch with pip. Installation of torch for me always results in a +cpu version. I have tried installing all kinds of previous and current torch versions from the pytorch website with +cu110, +cu111, +cu113, +cu115, +cu116, +cu117, etc but it fails each time with the following error:

pip install torch==1.10.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu111 (from versions: 2.0.0, 2.0.0+cpu, 2.0.0+cu117, 2.0.0+cu118, 2.0.1, 2.0.1+cpu, 2.0.1+cu117, 2.0.1+cu118)
ERROR: No matching distribution found for torch==1.10.0+cu111

The same with torchvision or torchaudio. All I can pip install are +cpu versions. Until 2021, pytorch did not offer support for CUDA 11.2 and I could have probably ascribed my CUDA version to be the issue but not anymore - Pytorch does offer support till CUDA 11.7 now.

TL;DR

With CUDA 11.2 installed on my system, tensorflow is unable to find a CUDA enabled device even when I have an RTX 4070. I can even find it successfully under display adapters in Device Manager.

问题回答

暂无回答




相关问题
Why won t OpenCV compile in NVCC?

I am trying to integrate CUDA and openCV in a project. Problem is openCV won t compile when NVCC is used, while a normal c++ project compiles just fine. This seems odd to me, as I thought NVCC ...

error in CUDA compilation

I m getting this error while trying to run sample codes in CUDA SDK. I have CUDA 2.3 and Visual studio 2008 LINK : fatal error LNK1181: cannot open input file cutil32D.lib Any pointers how to ...

CUDA Memory Allocation accessible for both host and device

I m trying to figure out a way to allocate a block of memory that is accessible by both the host (CPU) and device (GPU). Other than using cudaHostAlloc() function to allocate page-locked memory that ...

热门标签