GPU activation

This installation is for ubuntu 20.04

First open a terminal and write nvidia-smi to check if gpu is on.

If you see this, then do: sudo nvidia-smi -pm 1. This will change the off to on.

Now set the required packages for the GPU:

sudo apt install nvidia-cuda-toolkit

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/

lspci -nn with this line you can find the port that gpu uses. In my case the port was:

:01\:00.0

Then write

sudo nano /sys/bus/pci/devices/0000\:01\:00.0/numa_node

and change the value from -1 to 0.

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt-get update
sudo apt-get install libcudnn8=8.2.4.*
sudo apt-get install libcudnn8-dev=8.2.4.*
sudo apt autoremove

Check your GPU now:
python3 -c 'import tensorflow as tf; print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))'


	

Leave a comment

Your email address will not be published. Required fields are marked *