Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Torch.cuda.is_available() keeps switching to False

Tags:

pytorch

torch

I have tried several solutions which hinted at what to do when the CUDA GPU is available and CUDA is installed but the Torch.cuda.is_available() returns False. They did help but only temporarily, meaning torch.cuda-is_available() reported True but after some time, it switched back to False. I use CUDA 9.0.176 and GTX 1080. What should I do to get the permanent effect?

I tried the following methods:

https://forums.fast.ai/t/torch-cuda-is-available-returns-false/16721/5 https://github.com/pytorch/pytorch/issues/15612

Note: When torch.cuda.is_available() works fine but then at some point switches to False, then I have to restart the computer and then it works again (for some time).

like image 550
cerebrou Avatar asked Apr 16 '19 23:04

cerebrou


2 Answers

Also with torch.cuda.is_available () had false.
But when installing the Nvidia driver to the most updated version 436.48, True is displayed. I previously updated Pytorch to 1.2.0. I have windows 10 and Anaconda.

enter image description here

like image 161
Joe Llerena Avatar answered Sep 21 '22 00:09

Joe Llerena


  1. Install CUDA 9.1 using apt-get, following the instructions in this link:

https://cryptoandcoffee.com/mining-gems/cuda-9-0-install-ubuntu-16-04-apt-get/

  1. Installed PyTorch using pip:

    pip install torchvision ( this will install both torch and torchvision )
    
  2. Rebooted

Now try it:

~$ python -c 'import torch; print torch.cuda.is_available()'
like image 43
srilekha palepu - Intel Avatar answered Sep 21 '22 00:09

srilekha palepu - Intel