CUDA, OpenCL and GPU programming in general are hot topic in today’s IT world.

Main reason for that is a rise of Data Science, Artificial Intelligence and Deep Science, and many new technologies that relies on it like self driving cars, robotics etc.

Traditionally main consumers of graphical cards are:

  • gaming industry
  • video editing professionals
  • graphical designers

Today, on nVidia web you can barely find something about classical consumer video cards, as the whole site aim at Data Science (Artificial Intelligence / Machine Learning / Deep Learning) and High Performance Computing (e.g. simulations) industry.

The article on the following link (taken from the ZDNet) describes nVidia’s plans in detail:

https://www.zdnet.com/article/nvidia-looking-to-surf-data-science-wave-into-the-datacentre/

With a boom in Data Science space, graphical cards are usual guest in all modern Data Centers around the world.

All big names in a server/data center market have already certified their products with powerful graphical card manufacturers.

In addition, all top 10 Supercomputers are based on GPU processing power, and all Cloud vendors are offering GPU instances in their portfolio.

Mainly due to inertia, it is expected that the same trend will follow enterprises in their Data Centers.

nVidia is one of the pioneers in exposing GPU power to developers, while other two manufacturers (AMD and Intel) are on the same path.

Although OpenCL (Open Computing Language) is an open, hardware agnostic approach (works on all – nVidia, AMD and Intel GPU while CUDA works only on nVidia GPU), mainly due to a maturity of nVidia drivers, developer tools, better support and performances, I’ll give a slight advantage to their CUDA technology.

To programming with CUDA, you need to know C, C++ or Python language (API is only available for those three languages).

In this article: How to install nvidia driver on Ubuntu, I’ll explain how to setup nvidia driver on Ubuntu to start your CUDA tuning journey.

First decision you should make is about the operating system.

If you are planning to use CUDA for Data Science stuff, I suggest to use Ubuntu as it’s dominant platform on server side computing in a Cloud.

See more at the following two links:

https://thecloudmarket.com/stats#/by_platform_definition

and

https://www.zdnet.com/article/ubuntu-linux-continues-to-rule-the-cloud/

If you enable “install third party proprietary drivers” option during the Ubuntu installation, Ubuntu nvidia drivers should already be installed on your system and there is nothing else to do.

In case you miss to do that or you are installing Ubuntu Server without GUI, it’s easy to install drivers later by executing the following command:

#1. Delete installed Nvidia drivers

sudo apt-get purge nvidia*

#2. Head to the following page to check the latest driver version: 
https://www.nvidia.com/object/unix.html

#Linux x86_64/AMD64/EM64T
#Latest Long Lived Branch Version: 418.56

#3. Update your system 
sudo apt-get update && apt-get upgrade

#3. Check the latest driver
ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001436sv0000103Csd00008275bc03sc00i00
vendor   : NVIDIA Corporation
model    : GM206GLM [Quadro M2200 Mobile]
driver   : nvidia-driver-418 - third-party free recommended
driver   : nvidia-driver-390 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

#5. Install appropriate nvidia driver: 
sudo ubuntu-drivers autoinstall

#6. Check if your system is using nouveau open source driver: 
lsmod | grep nouveau


#If nouveau is in use, you need to disable it before reboot. 

#Nouveau disabling 
user@hostname:/etc/modprobe.d# bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
user@hostname:/etc/modprobe.d# bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

user@hostname:/etc/modprobe.d# cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0



#7. Reboot
reboot


#8. Check your driver installation: 

nvidia-smi

#or 

lsmod | grep nvidia

In case you’ll need to find out driver version of your nVidia card, this is how you can check it:

user@hostname:~>nvidia-smi 
Fri Mar 22 08:20:39 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro M2200        Off  | 00000000:01:00.0  On |                  N/A |
| N/A   45C    P0    N/A /  N/A |   1654MiB /  4043MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1925      G   /usr/libexec/Xorg                             89MiB |
|    0      2108      G   /usr/bin/gnome-shell                          44MiB |
|    0      2486      G   /usr/libexec/Xorg                            776MiB |
|    0      2611      G   /usr/bin/gnome-shell                         323MiB |
|    0      2861      G   ...are/jetbrains-toolbox/jetbrains-toolbox   401MiB |
|    0      2876      G   cairo-dock                                    12MiB |
+-----------------------------------------------------------------------------+

#or you can use the following command 
user@hostname:~>cat /proc/driver/nvidia/version 
NVRM version: NVIDIA UNIX x86_64 Kernel Module  418.43  Tue Feb 19 01:12:11 CST 2019
GCC version:  gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC) 

#third option to get the driver details
user@hostname:~>modinfo nv

In case you still don’t have desired version of the driver installed, you can use the following commands:


#1. Delete installed Nvidia drivers

sudo apt-get purge nvidia*

#2. Head to the following page to check the latest driver version: 
https://www.nvidia.com/object/unix.html

#Linux x86_64/AMD64/EM64T
#Latest Long Lived Branch Version: 418.56

#3. Add nVidia repo
sudo add-apt-repository ppa:graphics-drivers

#4. Update your system 
sudo apt-get update

#5. Install appropriate nvidia driver: 
sudo ubuntu-drivers autoinstall

#6. Reboot
reboot

#7. Check if desired version of your driver is installed
nvidia-smi
or 
cat /proc/driver/nvidia/version 

 

This is the first part of CUDA-GPU tuning series I’ll use extensively as a basis for future articles.

In the next post I’ll describe how to install nVidia Toolkit to have your system ready for a Data Science tasks.



Get notified when a new post is published!

Loading

Comments

There are no comments yet. Why not start the discussion?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.