Install Graphics and Compute on Linux Mint

OpenGL

To use OpenGL on Linux, the X11 Input extension library, the X11 miscellaneous utility library, an OpenGL API implementation, and the OpenGL Utility library are needed.

sudo apt-get install libxi-dev libxmu-dev libgl1-mesa-dev libglu1-mesa-dev xorg-dev

The Mesa implementation by default creates a symbolic link to a nonexistent libGL.so.1.2.0; change that link to

sudo ln -s -f /usr/lib/libGL.so.<#> /usr/lib/x86_64-linux-gnu/mesa/libGL.so

The installation is now complete, but the previous step may be needed each time a proprietary driver (e.g. AMD, Nvidia, Intel) is installed because the new driver may overwrite the symbolic link.

One can also install GLEW and GLFW to make OpenGL development easier. The former uses a Makefile while the latter uses CMake and Linux’s xorg-dev library. If CMake fails to locate OpenGL, run

sudo apt-get install freeglut3-dev

Headless Rendering

EGL is an alternative way to run OpenGL headless. Its header files can be found in the registry, and the corresponding library implementation are installed with the GPU drivers. In this case, only the OpenGL headers are needed. gl.h, glx.h, and wgl.h need to be extracted from the GPU drivers e.g. –opengl-headers for Nvidia’s installation script. Within a virtualized environment, the libraries need to be installed manually.

sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev

Vulkan

Do not attempt to use OpenGL multithreading and only use multiple contexts for data streaming. The Vulkan drivers are vendor specific and are typically installed with the GPU drivers. The Vulkan header files are at the registry. The Vulkan validation layers require the use of the Vulkan SDK.

CUDA Toolkit

This is no longer necessary if nvidia-docker is used. Otherwise, prefer the .sh Linux flavor of CUDA toolkit. The most important step is to avoid installing the drivers that comes with the package: the latest proprietary Nvidia drivers should be used instead.

OpenCL

The CUDA toolkit also comes with an implementation of OpenCL. The OpenCL headers can be found at the Khronos registry.