HomeComputer VisionMachine LearningAI DeploymentOther PostsAbout
Machine Learning
Configure integrated GPU for rendering and NVIDIA GPU for CUDA works in Ubuntu 18.04
Viet Anh Ng.
January 01, 2020
2 min

In fact, besides CUDA tasks (which could be deep neural network training), our operating system also consumes a decent amount of memory for graphic rendering. This article will guide you to use onboard graphic card for display, thereby saving a considerable amount of GPU VRAM for model training. It’s especially useful when you have an NVIDIA GPU with a small memory size.

  • First, you need:
    • A computer using Ubuntu or equivalent operating system. Here I use Ubuntu 18.04.
    • Your computer has an onboard graphics card (from Intel) and (of course) an NVIDIA GPU.
    • You plug the monitor cord into the graphics output port (possibly HDMI) on the mainboard instead of on the GPU card. You may need to configure the BIOS for the system to output the video to the HDMI port on the motherboard when booting.

Step 1: Install drivers for NVIDIA GPU and CUDA (optional - you can skip if you already have GPU drivers and CUDA toolkit installed)

I will guide you through these steps to install necessary drivers and CUDA packages.

First, open Terminal (Ctrl+Alt+t).

You need to delete the preinstalled CUDA PPA and nvidia-cuda-toolkit package. This will ensure that you can properly install the desired version of drivers:

Remove old driver (recommended)

Update your system packages:

Add PPA and setup key server:

Add driver repositories:

Update package database again:

And, install CUDA 10.0. Please note that, when you type the following command, the suitable driver version for GPU is also installed.

Install cudnn package (for deep learning applications):

Finnaly, you need to open ~/.profile (using Nano: nano ~/.profile) and append following content:

After this step, you will need to restart your computer and check if CUDA is installed correctly using nvcc --version.

Step 2: Configure the system to use integrated GPU card for displaying and NVIDIA GPU for CUDA works

  • Create file at /etc/X11/xorg.conf with following content (using Nano: sudo nano /etc/X11/xorg.conf):

Note that you have to change BusId (PCI:0:2:0) to your integrated GPU. List all graphic cards by following command: (Note that my Intel graphic card is 00:02.0, so I use PCI:0:2:0 for BusId.)

00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop) 01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2070] (rev a1)

  • Restart your workstation again to check the result.

Step 3: Check the result

If everything goes in the right direction, after restarting the computer, your workstation will use the onboard card for rendering and NVIDIA GPU for CUDA works. Check with the following command when you are not running any CUDA work yourself:

If you see No running processes found like following figure, your system is using integrated card for displaying. You can run a training task (or any other CUDA task) to ensure that the CUDA system can still operate properly.

nvidia-smi output
nvidia-smi output

Note that a wrong configuration in step 2 can break your system. If it happens, please reboot into recovery mode and remove /etc/X11/xorg.conf by using rm /etc/X11/xorg.conf command. Thank you for reading my post!


Tags

Viet Anh Ng.

AI Developer / Blogger

Hi! I'm a software engineer. I love AI technologies and currently, I'm using machine learning to build awesome software products.

Expertise

AI
Deep Learning
Computer Vision

Social Media

githubtwitterwebsite

Related Posts

Cấu hình iGPU cho xserver và GPU Nvidia cho tác vụ CUDA trong Ubuntu 18.04
April 17, 2019
2 min
© 2020, All Rights Reserved.

Quick Links

About this siteContact

Social Media