A few months ago, I installed chemprop via Visual Studio Code, Windows 10 64 bit).
The installation instructions say:
“on machines with GPUs, you may need to manually install a GPU-enabled version of PyTorch by following the instructions here”, where here links to the PyTorch Start Locally page.
I have a Nvidia GeForce RTX 3050 Ti laptop GPU.
At the time, the PyTorch pip installation code was:
pip3 install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio===0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
which I used, and it worked. The basic tests in python said that cuda was available, and:
torch.__version__
'1.11.0+cu113'
torch.cuda.get_arch_list()
['sm_37', 'sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'compute_37']
Chemprop also correctly called the GPU/cuda when necessary.
It is actually weird that this worked, because this post seems to say that my python output points to a 10.2 ‘runtime’, whatever that means (no idea, sorry, not an IT expert).
Plus, my current GPU driver is a bit old, and nvidia-smi says the max supported cuda is 11.2.
But OK, I only know that it works, somehow.
Now, a new version of chemprop came out, so I installed it (in a new conda environment), went back to PyTorch Start Locally find the installation code, and now it looks like this:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
Thinking that it was better to use the up-to-date pip installation code, I went ahead and ran it.
And the GPU was never again seen or used by torch or by chemprop (in the new environment; in the old one it still worked, luckily).
torch.__version__
'1.11.0+cu113'
but:
torch.cuda.is_available()
False
I looked at a lot of posts, some arguing that one should update the GPU driver, some describing incredibly complicated developer installations of separate packages, etc.:
[sorry, I am manually breaking the links otherwise your system says I cannot post as a new user]
ttps://stackoverflow.com/questions/69204737/torch-cuda-is-available-returns-false-why
ttps://stackoverflow.com/questions/60987997/why-torch-cuda-is-available-returns-false-even-after-installing-pytorch-with/61034368#61034368
ttps://stackoverflow.com/questions/70831932/cant-connect-to-gpu-when-building-pytorch-projects
Having no expertise whatsoever and not wanting to risk breaking my system, I simply tried removing the new conda environment, repeating the installation of chemprop, and then running the above old pip installation code for PyTorch.
This seemed to work. Now the tests are giving again the expected answers.
Does anybody know what may be going on?
Why is the new pip installation code not working, whereas the old one does, despite the apparent runtime conflict?
I have sort of resolved my issue, but I thought it may be useful to post this, in case my solution is not good/stable, and/or there is a better way to handle this.
E.g. in the above PyTorch discussion I linked, the user ends up saying “You were right. The env I was using had an incorrect version. Thanks go it working.”.
That’s very nice, but from my point of view as a non-expert, I have absolutely no idea how I can decide what ‘version’ my ‘env’ is using: I just run the code that is provided on the website and sort of hope it does the job… so maybe if someone could please explain what needs to be done, it would be great.
Thanks!