Score:0

the ways to install nvidia driver and cuda

tm flag

I want to install nvidia driver and cuda and cuDNN. I am using ubuntu 18.04.6 LTS. I'd like to run deep learning algorithms. I am a little confused with the ways of installation. Could you help me with that to make sure I do the right thing.

  1. First way is to follow the steps provided here for installing cuda 11.2 on Ubuntu 20.04. As follows:
sudo apt-get update
sudo apt-get upgrade

# install other import packages
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

# first get the PPA repository driver
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

# install nvidia driver with dependencies
sudo apt install libnvidia-common-470
sudo apt install libnvidia-gl-470
sudo apt install nvidia-driver-470
  1. But If I want to install cuda toolkit in this link, as far as I know, this itself can install drivers too.

My questions are:

A) I'd like to know what the difference is between these two methods? and which one is more preferable?

B) Can I run sudo ubuntu-drivers autoinstall instead of the three last commands? If it's the latest driver is 470, are both the same?

C) In what way can I avoid reinstalling driver after every kernel update?

I'd appreciate it if someone clarify these for me.

ChanganAuto avatar
us flag
After installing the correct driver version (from the repositories) you can install cuda also from the repositories, it's this simple.
karel avatar
sa flag
Does this answer your question? [Are PPAs safe to add to my system and what are some "red flags" to watch out for?](https://askubuntu.com/questions/35629/are-ppas-safe-to-add-to-my-system-and-what-are-some-red-flags-to-watch-out-for) This 3-in-1 question is also possibly too broad.
Mar z avatar
tm flag
@ChanganAuto Could you help me how?
Mar z avatar
tm flag
@karel I think it is about adding PPA, not installing cuda.
ChanganAuto avatar
us flag
No, the PPA only has newer drivers versions and often not necessary to add it. It may be for 18.04 if you're using a brand new Nvidia card but other than that no, it isn't. Installing cuda should be as simple as `sudo apt install nvidia-cuda-toolkit`
Mar z avatar
tm flag
@ChanganAuto But what are these commands [link](https://gist.github.com/Mahedi-61/2a2f1579d4271717d421065168ce6a73#:~:text=sudo%20apt%2Dkey,install%20cuda%2D11%2D2) for?
ChanganAuto avatar
us flag
Commands seem correct, your idea with the "autoinstall" works too in the same way. No, you don't need to reinstall the driver, that only happens when installing the driver from the Nvidia binaries, when installing from the repositories the driver is rebuilt for newer kernels.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.