Pytorch 1.4 cannot find my cuda

I am running ubuntu 16.04 and have cuda 10.1 installed. The output from nvcc --version is:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

I also have the latest drivers installed. The output from nvidia-smi is:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.64       Driver Version: 430.64       CUDA Version: N/A      |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:05:00.0 Off |                  N/A |
| 25%   61C    P0    64W / 250W |      0MiB / 11176MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 108...  Off  | 00000000:06:00.0 Off |                  N/A |
| 27%   55C    P0    62W / 250W |      0MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   2  GeForce GTX 108...  Off  | 00000000:09:00.0 Off |                  N/A |
| 23%   51C    P0    54W / 250W |      0MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   3  GeForce GTX 108...  Off  | 00000000:0A:00.0 Off |                  N/A |
| 18%   37C    P0    53W / 250W |      0MiB / 11178MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

I am running python 3.7 and installed pytorch in a new conda environment as:

conda create --name testcuda python=3.7
conda activate testcuda
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

I also verify that the correct python version is being used.

import torch
torch.version.cuda  # returns 10.1
torch.cuda.is_available()  # return False

I tried uninstalling, reinstalling and all that and sort of out of ideas.

Does anyone have any suggestions on what else I could try?

Try restarting your PC and immediately check if cuda is available. For me, if I use my laptop for long enough without using/checking for cuda, then PyTorch is unable to find it. So, I need to restart my pc.

  1. Restart PC
  2. conda activate testcuda
  3. import torch
  4. torch.cuda.is_available()

Try this and see if it works. :slight_smile:

So for some reason it started working after I downgraded my driver to 418.87.00. Not sure what has happened but sorry for the noise. I need to move to Docker.