Skip to content

Setup native CUDA Toolkit for Qurator tools on Ubuntu 18.04

Stefan Weil edited this page Jun 21, 2023 · 7 revisions

Several of the tools provided by the Qurator-SPK project ship with OCR-D interfaces, such as

All of these benefit from improved processing speed when a GPU and CUDA are used. However, since the above tools require tensorflow-gpu version 1.15.x from PyPI, which is compatible only with a specific CUDA Toolkit version (10.0), here is a short guide on how to setup the CUDA Toolkit installation natively on Ubuntu 18.04 x86_64 with the correct versions required by the Qurator-SPK tools.

1. Installation of nvidia-driver

As a first step, the current version of the proprietary nvidia-driver needs to be installed.

Running

ubuntu-drivers devices

returns a list with suitable drivers and indicates which one is recommended.

Now you can install the recommended nvidia-driver-{version} with

sudo apt-get install nvidia-driver-{version}

If the installation completes successfully, it is recommended to perform a reboot now.

To check if the installation succeeded, run

nvidia-smi

which should indicate the version of the nvidia-driver installed.

2. Installation of CUDA Toolkit 10.0

For this step, it is necessary to first create an account for the Nvidia Developer Zone, in order to be able to download the CUDA Toolkit.

Next, download the deb (local) version of CUDA 10.0

wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64

and follow the installation procedure

sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda-toolkit-10-0

It is important here to specify sudo apt-get install cuda-toolkit-10-0 rather than sudo apt-get install cuda because CUDA will otherwise install a different version of the nvidia-driver, which can cause issues and instabilities with the operating system.

To verify whether the installation succeeded, run

nvcc --version

which should return the correct CUDA version (10.0).

3. Installation of CuDNN

Next the correct CuDNN libraries version 7.6 for CUDA 10.0 need to be installed. For this, three packages in total need to be downloaded

wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.0_20191031/Ubuntu18_04-x64/libcudnn7_7.6.5.32-1%2Bcuda10.0_amd64.deb
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.0_20191031/Ubuntu18_04-x64/libcudnn7-dev_7.6.5.32-1%2Bcuda10.0_amd64.deb
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.0_20191031/Ubuntu18_04-x64/libcudnn7-doc_7.6.5.32-1%2Bcuda10.0_amd64.deb

Install each of them by running

sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.0_amd64.deb

4. Post installation action

Finally, to ensure the PATH is correctly set, follow the Post-installation actions by adding /usr/local/cuda-10.0/bin to the PATH variable like this

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}

Welcome to the OCR-D wiki, a companion to the OCR-D website.

Articles and tutorials
Discussions
Expert section on OCR-D- workflows
Particular workflow steps
Recommended workflows
Workflow Guide
Videos
Section on Ground Truth
Clone this wiki locally