How to set up Nvidia GPGPU computing using just the official Debian 11 repos

If you don’t know if or how your Nvidia GPU is supported by Debian, try running nvidia-detect from the nvidia-detect package.

For supported chips, setting up Nvidia GPGPU computing is as simple as installing the nvidia-opencl-icd package (from the non-free component). This will pull in a large swathe of recommended packages like the non-free, proprietary Nvidia graphics driver, libcuda1, nvidia-smi, etc. See:

apt install nvidia-opencl-icd

The following additional packages will be installed:
  glx-alternative-mesa glx-alternative-nvidia glx-diversions libcuda1 libnvidia-cfg1 libnvidia-compiler libnvidia-ml1 libnvidia-ptxjitcompiler1 libpci3 nvidia-alternative
  nvidia-installer-cleanup nvidia-kernel-common nvidia-kernel-dkms nvidia-kernel-support nvidia-legacy-check nvidia-modprobe nvidia-opencl-common nvidia-persistenced nvidia-smi
  nvidia-support ocl-icd-libopencl1 pci.ids pciutils update-glx
Suggested packages:
  libgl1-mesa-glx | libgl1 nvidia-driver | nvidia-driver-any nvidia-cuda-mps wget | curl | lynx-cur
Recommended packages:
  libcuda1:i386
The following NEW packages will be installed:
  glx-alternative-mesa glx-alternative-nvidia glx-diversions libcuda1 libnvidia-cfg1 libnvidia-compiler libnvidia-ml1 libnvidia-ptxjitcompiler1 libpci3 nvidia-alternative
  nvidia-installer-cleanup nvidia-kernel-common nvidia-kernel-dkms nvidia-kernel-support nvidia-legacy-check nvidia-modprobe nvidia-opencl-common nvidia-opencl-icd
  nvidia-persistenced nvidia-smi nvidia-support ocl-icd-libopencl1 pci.ids pciutils update-glx
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Need to get 50.1 MB of archives.
After this operation, 157 MB of additional disk space will be used.

Now you need to reboot so that the proprietary Nvidia driver will be loaded.

Now you can list general information about your card by running nvidia-smi from the nvidia-smi package, or OpenCL capabilities by running clinfo from the clinfo package. This also works on headless machines.

Also see my related code repository: https://github.com/michaelfranzl/image_debian-gpgpu

Donating computing power to Science: How to run containerized BOINC with OpenCL and VirtualBox

Containerized, hardware accelerated, and virtualized!

Don’t you want to do something more useful with your silicon and electricity than producing low entropy outputs of hash functions?

There is a way. From Wikipedia:

The Berkeley Open Infrastructure for Network Computing (BOINC, pronounced /bɔɪŋk/ – rhymes with “oink”) is an open-source middleware system for volunteer computing and grid computing.

From the official BOINC website:

BOINC lets you help cutting-edge science research using your computer. The BOINC app, running on your computer, downloads scientific computing jobs and runs them invisibly in the background. It’s easy and safe.

The security conscientious will raise an eyebrow when they read that some closed source binary blobs are automatically downloaded from somewhere in the internet and then executed on your machine. But not to worry! One of the purposes of containers was to isolate programs. Again from Wikipedia:

OS-level virtualization is an operating system paradigm in which the kernel allows the existence of multiple isolated user space instances. Such instances, called containers […] may look like real computers from the point of view of programs running in them. A computer program running on an ordinary operating system can see all resources (connected devices, files and folders, network shares, CPU power, quantifiable hardware capabilities) of that computer. However, programs running inside of a container can only see the container’s contents and devices assigned to the container.

So I set out to develop a container image which allows running BOINC with full hardware power (AMD and Nvidia GPGPU computation, virtualization via VirtualBox), but in complete isolation of the host system.

The result is at https://github.com/michaelfranzl/image_boinc-client

Happy ‘crunching’!

How to install FOSS OpenCL for AMD GPU on Debian 11 (Bullseye)

It is very easy to set up free-and-open-source OpenCL computing support if you have an AMD GPU and Debian 11:

apt install ocl-icd-libopencl1 mesa-opencl-icd

Then use clinfo (from the package clinfo) to display information about your platform.

You can now use /dev/dri and the files in /etc/OpenCL to run OpenCL applications.

(Many thanks to the author of this blog post.)