Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use GPU in pytorch?

I tried following steps at: https://pytorch.org/get-started/locally/

First I created a conda environment as:

conda create -n facenet37_2 python=3.7

Then on above site I selected:

PyTorch Build: Stable (1.4)
OS: Linux (I am using Ubuntu 18.04)
Package: conda
Language: python
CUDA: 10.1

and it asked me to run following command:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

But after that when I opened python and typed:

import torch
torch.cuda.is_available()

I get False

I have GeForce GT 630M (computeCapability: 2.1). But it is not getting detected. Why? Is it too old and no longer supported? How can I fix the issue?

Edit: Why did I get a negative vote?

like image 957
user1953366 Avatar asked Oct 24 '25 18:10

user1953366


1 Answers

The GeForce GT 630M has compute capability 2.1 and therefore only supports up to CUDA 8.

  • PyTorch binaries dropped support for compute capability <= 5.0 in PyTorch 0.3.1. It's not clear to me if compute capability 2.1 was ever included in the binaries.
  • The PyTorch codebase dropped CUDA 8 support in PyTorch 1.1.0.

Due to the second point there's no way short of changing the PyTorch codebase to make your GPU work with the latest version. Your options are:

  • Install PyTorch without GPU support.
  • Try compiling PyTorch < 1.1.0 from source (instructions). Make sure to checkout the v1.0.1 tag. This will produce a binary with support for your compute capability.
  • If acceptable you could try installing a really old version: PyTorch < 0.3.1 using conda or a wheel and see if that works. It may have compute capability 2.1 support though I can't verify this. See pytorch.org for information. Though it looks like the link to https://download.pytorch.org/whl/cu80/torch_stable.html is broken.
like image 113
jodag Avatar answered Oct 26 '25 08:10

jodag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!