Just created a new deep learning server and am running into an issue running PyTorch code using CUDA. nvidia-smi gives seemingly correct output (below):
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.145 Driver Version: 384.145 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 TITAN Xp Off | 00000000:01:00.0 Off | N/A |
| 0% 38C P0 58W / 250W | 0MiB / 12187MiB | 2% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
However, when I run torch.cuda.is_available(), I get the following output:
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
Any ideas as to what’s wrong? System information is below.
The problem is most likely that your display driver version 384.145 is too old compare to
cuda 9.2 you are using. Update the display driver to version 396.xx (cuda 9.2 comes with
396.26) may help solve the problem (that torch.cuda.is_available() is False).
Why downgraded to CUDA 9.1? As long as you updated the display driver to 396.xx,
CUDA 9.2 should work and better than CUDA 9.1 (especially on the compatibility with gcc 7.x.x).
I assumed that I had to build PyTorch from source for CUDA 9.2 compatibility and ran into issues during the build process. I downgraded to 9.1 so that I could just use Anaconda to install the CUDA 9.1 compatible binary.
I see. Yes, if you just use Anaconda to install the CUDA 9.1 compatible binary, then use CUDA 9.1.
If you want to compile pytorch from source, using CUDA 9.2 is a better choice.
I am getting the same problem now, after upgrading to pytorch 1, CUDA 92.
(Was working fine with earlier versions of pytorch and CUDA)
torch.cuda.is_available() is FALSE
but torch.backends.cudnn.enabled is TRUE.
Nvidia-smi working fine, reports:
NVIDIA-SMI 396.37 Driver Version: 396.37
I get the same problem, too
“torch.cuda.is_available() is FALSE
but torch.backends.cudnn.enabled is TRUE”
Driver Version is 396.82
Have you solved this problem?
Which CUDA version are you using?
Based on the driver, you could only use CUDA<=9.2 as shown here.
I would recommend to update the driver and the CUDA version (if you are using an older one).
Thank you
The CUDA version is 9.0
But according to this link, driver version 396.82 seems to be OK
Additionally, when print(torch.version.cuda), the result is 9.0.176
Could you check, if nvidia-smi and nvidia-settings is working on your system and show all installed GPUs?
If so, could you create a new environment and try to install a PyTorch again?
Thank you for your assistance!
We have solved the problem.
There are two nvidia drivers.
So we delete one and reinstall pytorch, and then torch.cuda.is_available() becomes true.
Hope it’s helpful to others.
Sorry for reopening but I have the same problem. I am on Windows 10, nvidia-smi gives 417.98 and the driver version is the same, while CUDA version is 10.0 and cudnn is 7.0. It used to work properly till recently, so I suppose that something should be updated. My questions are:
What to update to make it work?
How to do it in a safest possible way?
How to proceed in future so that things get updated accordingly to latest demands?
Hi every one,
Torch.cuda.is_available() is returning False.
It used to work well until recently. I have tried to reboot the machine multiple times
I don’t remember changing the drivers in the PC anytime in between. I am on Windows 10 64 bit
Did you update PyTorch or could it have been updated/downgraded accidentally by another package?
I would recommend to create a new virtual environment and reinstall the latest PyTorch + CUDA package to check, if your current Python environment might have been broken somehow.
@ptrblck Thanks for dropping by . Its working in my dual booted Ubuntu in the same machine. As you mentioned it should work in a new virtual env. Yet to check that … Thank You.
/home/kash/pytorch/lib/python3.8/site-packages/torch/cuda/init.py:52: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
why is this error showing…i dont know im beginner
CUDA Version: 11.0
Driver Version: 450.80.02