pyTorch not working with an old NVidia card

I am trying to set up the tutorials locally.
OS: Ubuntu 16.04
GPU: GeForce GTX 760

I made sure that the GPU supports CUDA; as it actually has over 1000 CUDA cores as listed here.
I have also ensured that both CUDA and CuDNN are installed properly as both of these commands return “True”:

torch.cuda.is_available()
torch.backends.cudnn.enabled

Nevertheless, when I execute the first main block of code in lesson 1 that is:

arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

I get the following warning:

UserWarning:
Found GPU0 GeForce GTX 760 which is of cuda capability 3.0.
PyTorch no longer supports this GPU because it is too old.

warnings.warn(old_gpu_warn % (d, name, major, capability[1]))

Then a runtime error appears:

RuntimeError: cuda runtime error (48) : no kernel image is available for execution on the device at /opt/conda/conda-bld/pytorch_1518244421288/work/torch/lib/THC/generic/THCTensorMath.cu:15

Is it possible to set up pyTorch with this GPU?
Any help is much appreciated.

3 Likes

Solved by compiling pyTorch from source. Here is how to do so in details:
1- Activate the virtual env:

source activate fastai

2- Uninstall pyTorch

conda uninstall pytorch

3- Clone pyTorch repo:

git clone --recursive https://github.com/pytorch/pytorch

4- Checkout to the latest branch (so that we install pytorch 0.3.1)

cd pytorch
git checkout v0.3.1

5- Sort out dependencies (I only needed cmake):

git submodule update --init
sudo apt install cmake

6- Install, this is were compiling takes place (took nearly 30 minutes):

python setup.py install
11 Likes

Just curious, is your pytorch working with your old nvidia card… did you check by running code on GPU? I have a machine with an old 940MX card with 5.0 compute power and would like to use it for prototyping.

AFAIK, v0.3.1 dropped support for old cards… correct me if I am wrong…

It would help if you let us know which CUDA version and CUDNN version you had installed at the time of building pytorch. Thanks!

P.S. I have been able to get 0.3.0 working with CUDA 9.0 on my card, just wondering if there’s a way to get 0.3.1 working.

2 Likes

could you please help by explaining a bit more on how to compile pytorch from source.
i am new to deep learning and only familiar with anaconda prompt commands.
i shall be grateful.

Did you solve the error ?

Yes, pyTorch 0.3.1 is working with my old GPU (GTX 760), just follow my steps above.
For Cuda I used this package:
http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
And for CuDNN I used:
http://files.fast.ai/files/cudnn-9.1-linux-x64-v7.tgz

2 Likes

Did you follow the steps in my first reply, I explained in details how to solve this? If yes, at what point did you face a problem?

Yes I did, follow the steps in my first reply if you are facing the same problem.

i am getting stuck in the last 6th step.It shows setup.py is not found ,however it is there.(i am using windows 10)
Will installing cpu version of pytorch atleast run the code without errors?

Are you using bash inside windows? Could you ls the directory you are standing on and paste the output, also could you paste the error message you are getting ?

$ python setup.py install
bash: python: command not found
(when using git bash)

running install
running build_deps
error: [WinError 2] The system cannot find the file specified
(when using anaconda prompt)

1 Like

Hello,

I have the same problem with step 6. Maybe you could help solve this issue?

When I try to run the setup.py I receive an error:
python setup.py install
running install
running build_deps
error: [WinError 2] The system cannot find the file specified

I have navigated to the correct folder “~\Fast_AI\Github material\fastai\pytorch”, when I list the files I can see setup.py, but it does not allow to run.

Files in pytorch folder:
2018-04-25 11:53 AM .
2018-04-25 11:53 AM …
2018-04-25 11:42 AM 10 .dockerignore
2018-04-25 11:53 AM 972 .gitignore
2018-04-25 11:53 AM 312 .gitmodules
2018-04-25 11:53 AM 1,202 .travis.yml
2018-04-25 11:53 AM cmake
2018-04-25 11:53 AM 6,775 CONTRIBUTING.md
2018-04-25 11:53 AM 1,600 Dockerfile
2018-04-25 11:53 AM docs
2018-04-25 11:53 AM 2,249 LICENSE
2018-04-25 11:53 AM 12,158 README.md
2018-04-25 11:53 AM 8 requirements.txt
2018-04-25 11:53 AM 24,736 setup.py
2018-04-25 11:53 AM test
2018-04-25 11:53 AM third_party
2018-04-25 12:08 PM tools
2018-04-25 11:53 AM torch
2018-04-25 11:53 AM 169 tox.ini
11 File(s) 50,191 bytes
8 Dir(s) 64,394,248,192 bytes free

I have downloaded pytorch not from local source, but .tar.bz2 and installed via conda with conda install path to file/file name

Pytorch installations for windows: https://drive.google.com/drive/folders/0B-X0-FlSGfCYdTNldW02UGl4MXM

Got help from Joschka: Unable install Pytorch from source for older GPU card

For anyone still facing the old card issue, the latest pytorch added support for old cards as many people were facing the same issue. https://discuss.pytorch.org/t/pytorch-no-longer-supports-this-gpu-because-it-is-too-old/13803/26

I have installed pytorch 0.4 in fastai library using normal pip install, and it’s been running fine without any issues on my 940MX with GPU capability 5.0. I have nvidia 390 proprietary drivers installed on ubuntu 18.04 with CUDA 9.0 and CUDNN 7.0.

2 Likes

I’m trying to get my GTX 760 to run on Fedora 28. I tried to find the corresponding installs for the Ubuntu fixes listed above, but no luck so far.

Anyone have any suggestions?

ubuntu or windows? I have the Same GPU configuration with you.

If i understand correctly, CUDNN is not required and isn’t supported in Fast.ai, correct although it’ll make things even faster?

Ubuntu.

CUDNN is a library of primitives which are used in CUDA if they’re present. It’s at a lower level than pytorch - on which fastai is written over. And it’s not required to have, but having them makes many computations run faster. And as you might have guessed by now, fastai runs with or without them.

Ive done exactly these steps. I can successfully build it but i still get the message,

Found GPU0 GeForce GTX 680 which is of cuda capability 3.0.
PyTorch no longer supports this GPU because it is too old.

warnings.warn(old_gpu_warn % (d, name, major, capability[1]))
Traceback (most recent call last):
File “generate.py”, line 154, in
main()
File “generate.py”, line 135, in main
model.load_state_dict(torch.load(args.model))
File “/home/server/miniconda2/envs/env123/lib/python3.5/site-packages/torch/nn/modules/module.py”, line 522, in load_state_dict
.format(name))
KeyError: ‘unexpected key “rnn_0.weight_ih_l0” in state_dict’

what can i do else ?

1 Like