How to use GPU of MX150 with Tensorflow 1.8 CUDA 9.2 (Phase 1: Installation of the NVIDIA Driver on Ubuntu 18.04)
Reading Time: 3 minutes
In the preview post, “How to use GPU of MX150 with Tensorflow 1.8 CUDA 9.2 (Introduction)”, I expressed my interest in using the CUDA cores of my graphical card (MX150) for the acceleration of the calculation of the DNN. In this context, I use Python 3 and the high level neural network Keras with Tensorflow as backend.
The objective of this post is the installation of the proprietary driver of NVIDIA which is compatible with CUDA 9.2
In July 2018, Ubuntu version 18.04 doesn’t provide a driver which is compatible with the version 9.2 of CUDA. Furthermore, when I made this exercise, NVIDIA has released a new package which was not compatible with the version of the driver (396 instead of 390). It seems that today the situation has changed. I see on the driver page https://www.nvidia.com/object/unix.html a new driver (version 396,54 which was released the 28/08/2018).
Installing a nvidia driver on Lubuntu 18.04 (version light of Ubuntu 18.04) is not simple and you need to structurally proceed. I learnt this approach by reading the excellent post of Dr Donald Kinghorn which gives the clues to solve my issue : https://www.pugetsystems.com/labs/hpc/How-to-install-CUDA-9-2-on-Ubuntu-18-04-1184/
Firstly, you need to install the last proprietary NVIDIA display driver by adding the the graphics driver ppa repository on the apt Ubuntu repository. This is well maintained and you will be able to get the latest driver
The command to add graphics-drivers ppa is:
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update
Before you install the driver it is good to be certain dkms (dynamic kernel module support) and build-essentials is installed. This is because whenever the system kernel is updated dkms will automatically rebuild the NVIDIA driver module for the new kernel. It needs build tools and the kernel headers for this which will be installed with build-essential.
sudo apt-get install dkms build-essential
Secondly, to install the NVIDIA driver, don’t use the apt-get install, you will have multiple issues, prefer to use the “Additional Drivers” in Menu > Preferences which will make easier this installation. For the bash “purist” the command is : /usr/bin/software-properties-gtk –open-tab=4 that you can find in the file: /usr/share/applications/software-properties-drivers.desktop that you can open with your best text editor (example: vi)
The execution of this command opens this windows:
Select the option “Using NVIDIA driver metapackage from nvidia-driver-396 (open source) and click on the button “Apply Change”. The OS will installed the new driver and will ask a new key to enter it in DKMS. This key (password) will be use to link the new module to the kernel at the next boot. If the password failed, you need to redo the procedure.
If you are on Azerty, don’t forget that you are on qwerty when the pc boots; so use character in the middle on the keyboard.
Once the pc booted, you can open the nvidia-setting windows via the menu “System Tools > Nvidia X server Settings” or using the command : nvidia-settings on the bash (root not required) and you obtain this window
You see on the Nvidia driver version the version that you have installed.
Good ! we have the driver NVIDIA correctly installed, The next step is the installation and the configuration of CUDA 9.2, CUDNN (for the deep Neural Network library using CUDA) and the configuration of CUPTI and the validation of the good working.
Let’s start now with the Phase 2!
Feel free to give comments or ask questions and I will try to answer you.
If you find this post valuable, Rate it ! This helps me to improve it. For comments, you need to register with your LinkedIn account.
When I write an article, I always give the references I used because I believe in intellectual property and I know how many times you need to write a valuable article: