Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can both the GPU and CPU versions of PyTorch be installed in the same Conda environment?

The PyTorch installation web page shows how to install the GPU and CPU versions of PyTorch:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

and

conda install pytorch torchvision cpuonly -c pytorch

Can both version be installed in the same Conda environment?

In case you might ask why would this be needed, it's because I would like a single Conda environment which I can use on computers which have a GPU and those which don't.

like image 463
user3731622 Avatar asked Mar 04 '23 06:03

user3731622


1 Answers

The GPU version of PyTorch is actually a superset of the CPU PyTorch. You can use the GPU PyTorch on a CPU, but you cannot use the CPU PyTorch on a GPU. So in your case, installing just the GPU version of PyTorch would be sufficient.

like image 127
Maurits van Altvorst Avatar answered Apr 28 '23 05:04

Maurits van Altvorst