Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple CUDA versions #33

Merged
merged 6 commits into from
Jun 29, 2021
Merged

Support multiple CUDA versions #33

merged 6 commits into from
Jun 29, 2021

Conversation

pmeier
Copy link
Owner

@pmeier pmeier commented Jun 27, 2021

Fixes #30. In #31 support for installing PyTorch for the latest CUDA version the driver supports was added. With this PR light-the-torch now supports installing PyTorch with all versions supported by the driver.

@pmeier
Copy link
Owner Author

pmeier commented Jun 28, 2021

@fepegar could you run your use case against this branch with pip install git+https://github.com/pmeier/light-the-torch@support-multiple-cudas? With that you should now be able to install wheels for all supported CUDA versions. In your case ltt install "torch<1.3" should fall back to CUDA 10.0. Is that correct?

If yes, I'm going to merge this and push a release.

@fepegar
Copy link
Contributor

fepegar commented Jun 28, 2021

should fall back to CUDA 10.0. Is that correct?

It didn't. It tried the CPU version.

This is what I got.

$ ltt install "torch<1.3"                                                                         

Collecting torch==1.2.0+cpu
  Downloading https://download.pytorch.org/whl/cpu/torch-1.2.0%2Bcpu-cp36-cp36m-manylinux1_x86_64.whl (103.9 MB)
     |████████████████████████████████| 103.9 MB 79 kB/s 
Collecting numpy
  Using cached numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
Installing collected packages: numpy, torch
Successfully installed numpy-1.19.5 torch-1.2.0+cpu
WARNING: You are using pip version 20.2.4; however, version 21.1.2 is available.
You should consider upgrading via the '/home/fernando/miniconda3/envs/test/bin/python -m pip install --upgrade pip' command.
/bin/sh: 1: cannot open 1.3: No such file
Traceback (most recent call last):
  File "/home/fernando/miniconda3/envs/test/bin/ltt", line 8, in <module>
    sys.exit(main())
  File "/home/fernando/miniconda3/envs/test/lib/python3.6/site-packages/light_the_torch/cli/__init__.py", line 19, in main
    cmd.run(pip_install_args)
  File "/home/fernando/miniconda3/envs/test/lib/python3.6/site-packages/light_the_torch/cli/commands.py", line 23, in run
    self._run(pip_install_args)
  File "/home/fernando/miniconda3/envs/test/lib/python3.6/site-packages/light_the_torch/cli/commands.py", line 110, in _run
    subprocess.check_call(cmd, shell=True)
  File "/home/fernando/miniconda3/envs/test/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'python -m pip install torch<1.3' returned non-zero exit status 2.

Then I ran these:

$ python -m pip install torch<1.3                                                                      
zsh: no such file or directory: 1.3
$ python -m pip install "torch<1.3"                                                                       
Requirement already satisfied: torch<1.3 in ./miniconda3/envs/test/lib/python3.6/site-packages (1.2.0+cpu)
Requirement already satisfied: numpy in ./miniconda3/envs/test/lib/python3.6/site-packages (from torch<1.3) (1.19.5)
WARNING: You are using pip version 20.2.4; however, version 21.1.2 is available.
You should consider upgrading via the '/home/fernando/miniconda3/envs/test/bin/python -m pip install --upgrade pip' command.

@pmeier
Copy link
Owner Author

pmeier commented Jun 29, 2021

@fepegar Thanks for trying. Indeed the ordering was buggy and it was not tested properly. Should be fixed now. Could you retry?

@fepegar
Copy link
Contributor

fepegar commented Jun 29, 2021

Success!

$ ltt install "torch<1.3"                                                                                                                  ✔  08:46:46
Collecting torch==1.2.0
  Downloading https://download.pytorch.org/whl/cu100/torch-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (748.8 MB)
     |███████████▏                    | 260.2 MB 12.0 MB/s eta 0:00:41^C

@pmeier
Copy link
Owner Author

pmeier commented Jun 29, 2021

Just to make sure ltt install torch still gives you torch==1.8.1+cu101, correct?

@fepegar
Copy link
Contributor

fepegar commented Jun 29, 2021

Oops, no:

$ ltt install torch
Collecting torch==1.9.0+cpu
  Downloading https://download.pytorch.org/whl/cpu/torch-1.9.0%2Bcpu-cp36-cp36m-linux_x86_64.whl (175.5 MB)
     |█████████████▊                  | 75.4 MB 38.6 MB/s eta 0:00:03^C

@pmeier
Copy link
Owner Author

pmeier commented Jun 29, 2021

Argh. Let me look into that ...

@fepegar
Copy link
Contributor

fepegar commented Jun 29, 2021

Looking good.

$ ltt install torch
Collecting torch==1.8.1+cu101
  Using cached https://download.pytorch.org/whl/cu101/torch-1.8.1%2Bcu101-cp36-cp36m-linux_x86_64.whl (763.6 MB)
$ ltt install "torch<1.3"
Collecting torch==1.2.0
  Downloading https://download.pytorch.org/whl/cu100/torch-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (748.8 MB)

@pmeier
Copy link
Owner Author

pmeier commented Jun 29, 2021

What happened was that the version of the package was prioritized over the computation backend. Thus, (1.9.0, cpu) > (1.8.1, cu101). By reversing it, you now get the intended behavior.

@fepegar
Copy link
Contributor

fepegar commented Jun 29, 2021

I see. Yes, I think it's better this way. Good job!

@pmeier pmeier merged commit 73e8fc8 into master Jun 29, 2021
@pmeier pmeier deleted the support-multiple-cudas branch June 29, 2021 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The found PyTorch version is too old
2 participants