Difference between revisions of "Install Nvidia graphics card driver on Ubuntu along with cuda libraries"
From Notes_Wiki
m (Saurabh moved page Install Nvidia P100 graphics card driver on Ubuntu 16.04 to Install Nvidia graphics card driver on Ubuntu along with cuda libraries: Improving article and also making it more generic) |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[Ubuntu]] > [[Install Nvidia | [[Main Page|Home]] > [[Ubuntu]] > [[Install Nvidia graphics card driver on Ubuntu along with cuda libraries]] | ||
# Download drivers from nvidia site ( http://www.nvidia.com/download/driverResults.aspx/118962/en-us ) Example driver download link http://us.download.nvidia.com/tesla/375.66/nvidia-diag-driver-local-repo-ubuntu1604_375.66-1_amd64.deb | # First determine the version of Ubuntu using: | ||
# dpkg -i <driver>.deb | #:<pre> | ||
# apt-get update | #:: cat /etc/*release | ||
# apt-get upgrade | #:</pre> | ||
# apt-get install cuda-drivers | # Then determine the Nvidia card installed on machine using one of the below methods: | ||
## Using lspci | |||
##:<pre> | |||
##:: sudo lspci | grep -i --color 'vga\|3d\|2d' | |||
##:</pre> | |||
## To to System > Preferences > Hardware information and check card information | |||
## Install and use hardinfo to get information about card | |||
##:<pre> | |||
##:: sudo apt-get install hardinfo | |||
##:: hardinfo | |||
##:</pre> | |||
#: Refer https://www.cyberciti.biz/faq/linux-tell-which-graphics-vga-card-installed/ | |||
# Download drivers from nvidia site ( http://www.nvidia.com/download/driverResults.aspx/118962/en-us ) | |||
#: Example driver download link http://us.download.nvidia.com/tesla/375.66/nvidia-diag-driver-local-repo-ubuntu1604_375.66-1_amd64.deb | |||
# Install the downloaded driver, update and upgrade OS, Install cuda drivers using: | |||
#:<pre> | |||
#:: dpkg -i <driver>.deb | |||
#:: apt-get update | |||
#:: apt-get upgrade | |||
#:: apt-get install cuda-drivers | |||
#:</pre> | |||
# In some cases before installing cuda drivers we may have to setup cuda-keyring using: | |||
## Install required kernel headers: | |||
##:<pre> | |||
##:: sudo apt-get install linux-headers-$(uname -r) | |||
##:</pre> | |||
## Download required keyring deb file and install using: | |||
##:<pre> | |||
##:: distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g') | |||
##:: wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb | |||
##:: sudo dpkg -i cuda-keyring_1.0-1_all.deb | |||
##:</pre> | |||
#: Refer https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html. | |||
# Reboot the machine and test | |||
# After reboot if screen is blank edit /etc/default/grub and append nomodeset option to GRUB_CMDLINE_LINUX_DEFAULT. Do not remove existing options append with space bar. | # After reboot if screen is blank edit /etc/default/grub and append nomodeset option to GRUB_CMDLINE_LINUX_DEFAULT. Do not remove existing options append with space bar. | ||
#:<pre> | #:<pre> | ||
#:: GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" | #:: GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" | ||
#:</pre> | #:</pre> | ||
# Run | # Run below and verify that output contains information about installed graphics card. | ||
#:<pre> | |||
#:: /usr/local/cuda/bin/nvcc --version | |||
#:: nvidia-smi | |||
Refer: | #:</pre> | ||
#: Refer https://stackoverflow.com/questions/9727688/how-to-get-the-cuda-version | |||
# If setup is not working then as per https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html there is combination of OS, GCC, nvidia drivers, etc. that is tested for particular OS. We can validate those via | |||
#:<pre> | |||
#:: uname -a | |||
#:: gcc --version | |||
#:: ldd --version | |||
#:: nvidia-smi | |||
#:: /usr/local/cuda/bin/nvcc --version | |||
#:</pre> | |||
# If required perform following additional steps | |||
#:<pre> | |||
#:: sudo apt-get install nvidia-gds | |||
#:: sudo apt-get install cuda-drivers-515 | |||
#:: conda install cuda -c nvidia | |||
#:: cat /proc/driver/nvidia/version | |||
#:</pre> | |||
# Add below in user or system-wise bashrc files | |||
#:<pre> | |||
#:: export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}} | |||
#:</pre> | |||
# Edit /etc/ld.so.conf and append a new line: | |||
#:<pre> | |||
#:: /usr/local/cuda-11.7/lib64 | |||
#:</pre> | |||
# Update ldconfig using | |||
#:<pre> | |||
#:: sudo ldconfig | |||
#:</pre> | |||
# We can further test the installation with cuda samples from https://github.com/nvidia/cuda-samples. For that use | |||
#:<pre> | |||
#:: sudo apt-get -y install git | |||
#:: git clone https://github.com/NVIDIA/cuda-samples.git | |||
#:: cd cuda-samples | |||
#:: make | |||
#:</pre> | |||
#: All tests and compilations succeed except for 0_Introduction/simpleMPI perhaps due to missing MPI libaries. We did '<tt>rm -rf 0_Introduction/simpleMPI</tt>' to delete that sample and compile all others using make | |||
# Especially, we ran Samples/1_Utilities/deviceQuery from below path | |||
#:<pre> | |||
#:: ./bin/x86_64/linux/release/deviceQuery | |||
#:</pre> | |||
# Note after this we tried to run python based code from https://www.geeksforgeeks.org/running-python-script-on-gpu/ It did not work. Perhaps we have not installed python-cuda libraries to make the code work | |||
[[Main Page|Home]] > [[Ubuntu]] > [[Install Nvidia P100 graphics card driver on Ubuntu 16.04]] | [[Main Page|Home]] > [[Ubuntu]] > [[Install Nvidia P100 graphics card driver on Ubuntu 16.04]] |
Revision as of 07:46, 14 July 2022
Home > Ubuntu > Install Nvidia graphics card driver on Ubuntu along with cuda libraries
- First determine the version of Ubuntu using:
- cat /etc/*release
- Then determine the Nvidia card installed on machine using one of the below methods:
- Using lspci
- sudo lspci | grep -i --color 'vga\|3d\|2d'
- To to System > Preferences > Hardware information and check card information
- Install and use hardinfo to get information about card
- sudo apt-get install hardinfo
- hardinfo
- Using lspci
- Download drivers from nvidia site ( http://www.nvidia.com/download/driverResults.aspx/118962/en-us )
- Example driver download link http://us.download.nvidia.com/tesla/375.66/nvidia-diag-driver-local-repo-ubuntu1604_375.66-1_amd64.deb
- Install the downloaded driver, update and upgrade OS, Install cuda drivers using:
- dpkg -i <driver>.deb
- apt-get update
- apt-get upgrade
- apt-get install cuda-drivers
- In some cases before installing cuda drivers we may have to setup cuda-keyring using:
- Install required kernel headers:
- sudo apt-get install linux-headers-$(uname -r)
- Download required keyring deb file and install using:
- distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
- wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb
- sudo dpkg -i cuda-keyring_1.0-1_all.deb
- Install required kernel headers:
- Reboot the machine and test
- After reboot if screen is blank edit /etc/default/grub and append nomodeset option to GRUB_CMDLINE_LINUX_DEFAULT. Do not remove existing options append with space bar.
- GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
- Run below and verify that output contains information about installed graphics card.
- /usr/local/cuda/bin/nvcc --version
- nvidia-smi
- Refer https://stackoverflow.com/questions/9727688/how-to-get-the-cuda-version
- If setup is not working then as per https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html there is combination of OS, GCC, nvidia drivers, etc. that is tested for particular OS. We can validate those via
- uname -a
- gcc --version
- ldd --version
- nvidia-smi
- /usr/local/cuda/bin/nvcc --version
- If required perform following additional steps
- sudo apt-get install nvidia-gds
- sudo apt-get install cuda-drivers-515
- conda install cuda -c nvidia
- cat /proc/driver/nvidia/version
- Add below in user or system-wise bashrc files
- export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
- Edit /etc/ld.so.conf and append a new line:
- /usr/local/cuda-11.7/lib64
- Update ldconfig using
- sudo ldconfig
- We can further test the installation with cuda samples from https://github.com/nvidia/cuda-samples. For that use
- sudo apt-get -y install git
- git clone https://github.com/NVIDIA/cuda-samples.git
- cd cuda-samples
- make
- All tests and compilations succeed except for 0_Introduction/simpleMPI perhaps due to missing MPI libaries. We did 'rm -rf 0_Introduction/simpleMPI' to delete that sample and compile all others using make
- Especially, we ran Samples/1_Utilities/deviceQuery from below path
- ./bin/x86_64/linux/release/deviceQuery
- Note after this we tried to run python based code from https://www.geeksforgeeks.org/running-python-script-on-gpu/ It did not work. Perhaps we have not installed python-cuda libraries to make the code work
Home > Ubuntu > Install Nvidia P100 graphics card driver on Ubuntu 16.04