Search This Blog

Sunday, 12 February 2023

CUDA 12.0 for Ubuntu 22.04 LTS

 I will  start from the beginning again so we don't have to reread past posts

Checking your version of Ubuntu

lsb_release -a

Download the latest version of Ubuntu at

https://ubuntu.com/download/desktop

Do the USB stick to make your installation, follow this link as a guide

https://ubuntu.com/tutorials/create-a-usb-stick-on-ubuntu#1-overview

Once you have the USB stick, insert the usb and  choose  Try Ubuntu instead of Installing ubuntu

When you are in the system, open Gparted from show applications and manage the memory given your necessities. Don't forget to mount the root.  After this reboot and do the real installation. 

run the command whoami to know or remember your username, you will be in a command line mode and not been able to know. 



Installing Nvidia Driver

 

Check the version of your card

lspci | grep VGA

Download the Nvidia driver from

https://www.nvidia.com/Download/index.aspx?lang=en-us 

sudo chmod 777 -R NVIDIA-Linux-x86_64-*.run

sudo apt-get update
sudo apt-get upgrade

Install all these libraries

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglu1-mesa glew-utils mesa-utils

Modify the next file

sudo gedit /etc/modprobe.d/blacklist.conf

write down at the end of the file the next list

blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

save and close the file and then type:

sudo apt-get remove --purge nvidia*
sudo apt-get remove --purge xserver-xorg-video-nouveau
sudo reboot

After that

CTRL ALT F5

check your login using whoami command

Enter your login and pass and then type

sudo telinit 3

enter your pass again.
After this the driver has to start, choose yes for everything except for the last question about the Xorg file.

When this finishes, get in to the graphic mode with


sudo telinit 5

If everything goes right you can go for CUDA. Download the toolkit from

https://developer.nvidia.com/cuda-downloads

Pick the version that is convenient for you

In case of Ubuntu 22 the link is:

https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local

Run a terminal and type

sudo gedit .bashrc

for 32 bits include these lines:
export PATH=/usr/local/cuda-12.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.0/lib:$LD_LIBRARY_PATH

and for 64 bits:
export PATH=/usr/local/cuda-12.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.0/lib:/usr/local/cuda-12.0/lib64:$LD_LIBRARY_PATH

and save the changes.

 

Run a sample to test your installation

Download the samples using

git clone https://github.com/NVIDIA/cuda-samples.git

once installed go to 

cuda-samples/Samples/1_Utilities/deviceQuery

make

If everything goes well then your installation is ready to go.

No comments:

Post a Comment