How to specify GPU usage?

related but how do I check which GPU is being used if nvidia-smi is not working for me?

This would sound a bit concerning, as it could indicate that your driver installation is broken, so I would expect PyTorch would also not be able to detect GPUs.

is there a pytorch recommended way to install gpus in linux ubuntu?

This is my current way:

apt update;
apt install build-essential;

sudo add-apt-repository ppa:graphics-drivers
sudo apt install ubuntu-drivers-common
ubuntu-drivers devices
sudo apt-get install nvidia-driver-460
sudo reboot now

to uninstall things I’ve done:

# ubuntu-drivers list
# sudo apt-get --purge remove nvidia-driver-460
# sudo apt-get --purge remove nvidia-driver*
# modinfo nvidia
#sudo apt-get install nvidia-driver-450

when trying to start from scratch on my ubuntu vm

I don’t think there is a “PyTorch recommended way” to install the drivers/CUDA and I would stick to an approach, which works for you. Personally, I use the .run files to install the drivers and/or CUDA toolkit, but I’m also reinstalling it quite often (e.g. to test new bringup versions etc.), so I don’t really care for stability.

something like this:

apt update;
apt install build-essential;
wget https://us.download.nvidia.com/tesla/460.73.01/NVIDIA-Linux-x86_64-460.73.01.run;
chmod +x NVIDIA-Linux-x86_64-460.73.01.run;
sudo ./NVIDIA-Linux-x86_64-460.73.01.run

I’ve tried it too and it didn’t work :frowning:

Yes, this would be my approach to install the drivers alone.
If you want to install the CUDA toolkit with the drivers, you could use e.g. cuda_11.3.0_465.19.01_linux.run.