Reputation: 61
I am trying to use PyTorch with GPU in my Ubuntu 18.04. The GPU is a GeForce GTX 1070.
nvidia-smi:
| NVIDIA-SMI 460.67 Driver Version: 460.67 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 1070 Off | 00000000:0B:00.0 Off | N/A |
| 21% 49C P2 60W / 180W | 4598MiB / 8119MiB | 17% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GTX 1070 Off | 00000000:42:00.0 Off | N/A |
| 0% 48C P8 7W / 180W | 20MiB / 8117MiB | 0% Default |
| | | N/A |
nvcc --version:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
.bashrc file:
export PATH="/usr/local/cuda-10.2/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH"
I installed pytorch using the command below (from here):
pip install torch torchvision torchaudio
Torch version:
PyTorch Version: 1.8.0
Python version:
Python 3.8.7
gcc/g++ versions:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
If I try to get the GPU, I get the following:
>>> import torch
>>> print(torch.cuda.is_available())
False
Can anyone advice me please
Upvotes: 3
Views: 2567
Reputation: 108
If you look at pytorch page, they advise to use special command to install torch with cuda, so probably, you would like to use this one:
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
Upvotes: 2