SDB:GPGPU

Jump to: navigation, search

GPGPU = General-purpose computing on graphics processing units, means using GPUs for common computations.

Preface

Using GPU for computing can give you huge speed-up – 3x, 10x, 100x, or even more. We can describe modern GPU as a set of many (100 – 10000) rather simple CPUs, connected to very fast dedicated RAM. To use this power you need drivers, which support some compute standards – OpenCL, CUDA, Vulkan, or something else.

You don’t need OpenCL for desktop acceleration, web browsers and other ordinary tasks, you need only 3D drivers for that: OpenGL, sometimes Vulkan. For hardware acceleration Firefox Webrender requires OpenGL 3.0, KDE requires OpenGL 3.1.

You can get some acceleration in some applications with your GPU(s) after installing needed drivers. For instance, you can use GPU acceleration in Darktable or Blender after changing appropriate settings. Also you can use GPU to accelerate archivers (such as KDE Ark) after installing middleware drivers. For some applications you need additional tuning, for AMD read chapter SDB:AMD_GPGPU#Special_Cases for details.

Volume of available video RAM is critical: often 1-2 GiB is a bare minimum, for complex tasks you may need 6 GiB or more. You can adjust available video RAM for built-in graphics via BIOS settings.


Vendors

There are three main vendors for GPGPU: Nvidia, AMD, Intel.

Nvidia

Nvidia holds about 90% market share for GPGPU. While it supports OpenCL, main instrumentation is CUDA. To use it uninstall nouveau drivers, taboo them, install Nvidia's proprietary drivers. You may add CUDA runtime for full support. General info about Nvidia products is here.
For drivers Nvidia provides 10 years of main support plus 2 years of maintenance support.

AMD

AMD uses open drivers and supports OpenCL, HIP, CUDA via HIP translator, Vulkan, and other standards. General info about AMD GPU products is here. General info about AMD APU products is there.
Read SDB:AMD_GPGPU page for details.

Intel

Intel uses open drivers and supports OpenCL, oneAPI, SYCL, Vulkan, and other standards. It provides decent support level. But Intel consumer graphic cards lack FP64 support (link1, link2). General info about Intel GPU products is here.

Biren

Wiki info, website. Unknown wonders from China.

Huawei

Huawei Ascend 910B. Unknown wonders from China.

Moore Threads

Moore Threads MTT S4000. Unknown wonders from China.


Dedicating GPU for GPGPU

With GPGPU you can easily get 100% GPU load, so your desktop windows can stutter, web browser may hang. To avoid this behaviour dedicate one GPU (the simplest one, such as built-in) for desktop usage, and use other(s) for GPGPU acceleration. Also this solution will free some video RAM in accelerator for calculations.
Main rule for dedicating GPU for GPGPU: do not attach video cables to card(s) which you select for computations.
Reverse dedication: you can use graphic card for general usage and built-in GPU for GPGPU.


Testing GPGPU

Here is list of some useful tests and utilities for checking GPGPU (mainly OpenCL) capabilities.

  1. You can check supported OpenCL extensions with clinfo utility (clinfo package from Main repository), measure speed with clpeak utility (clpeak package).
  2. For AMD use package radeontop to watch GPU utilization.
  3. Luxmark, download page.
  4. FAHBench. It works OK with Leap 15.4 and older ones, for Leap 15.5 to run FAHBench-gui disable library FAHBench_folder/lib/libstdc++.so.6, which comes with tar archive by renaming it to libstdc++.so.6-disabled.
  5. Indigo Bench.
  6. Blender supports CPU, CUDA, OptiX (best for Nvidia RTX), AMD HIP (HIP RT since 3.6 for Windows only, for Linux use Blender 4.0 & newer), Intel oneAPI (oneAPI RT since 3.6). Sample files for tests and comparison are here (news), newer editions - there. Check requirements to run Blender here. GPGPU has additional requirements: GPU rendering. To test OpenCL use version 2.x (select in Previous versions). Blender doesn’t support Terascale chips since 2.91, needs GCN 1 and newer just to run (however, may work with software emulation - LLVMpipe). For Terascale 2 & 3 try using Blender 2.90 (albeit not supported, it might still work).


Converting CUDA and HIP to OpenCL and Level Zero - chipStar

ChipStar is a tool for compiling and running HIP/CUDA on SPIR-V via OpenCL or Level Zero APIs. ChipStar enables porting HIP and CUDA applications to platforms which support SPIR-V as the device intermediate representation. It supports OpenCL and Level Zero as the low-level runtime alternatives. More at https://github.com/CHIP-SPV/chipStar.


Hints

  1. You can install and use more than one OpenCL driver after configuring installed drivers with icd files located in "/etc/OpenCL/vendors/".
  2. You can use CPU(s) as OpenCL device after installing PoCL. Package is here. Another option is in using LLVMpipe + Rusticl.
  3. You can run calculations on GPU and on CPU together.