[Tutorial] [Updated] How to install OpenCL support

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

[Tutorial] [Updated] How to install OpenCL support

Post by MikeNovember »

Hi,

A tutorial to show how to install OpenCL support for NVIDIA, Intel and AMD GPUs under Ubuntu / Linux Mint; a specific paragraph addresses OpenCL support for microprocessors and virtual machines guests.

What is OpenCL? "OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators".

So, OpenCL can use the processing power of all your hardware, including GPUs. Apps need to be designed for OpenCL and eventually set-up for its use. An example: when you select OpenCL in LibreOffice preferences, Calc will use it and will perform large calculations faster.

Wikipedia has a list of applications using OpenCL: https://en.wikipedia.org/wiki/List_of_O ... plications

Disclaimer: the author does not assume any responsibility about any damages on your computer occurring when following this tutorial. Users are strongly encouraged to backup their system before applying this tutorial in order to recover former system functioning if anything wrong occurred.

1) Identifying your GPU(s):

If you don't know what GPU is inside your computer you can:

- Refer to the manufacturer specification.

- Use lspci, example below

Code: Select all

$ lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b5)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port Mobile SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
01:00.0 VGA compatible controller: NVIDIA Corporation GF116M [GeForce GT 560M] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1)
03:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
04:00.0 USB controller: Fresco Logic FL1000G USB 3.0 Host Controller (rev 04)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
Here the computer is equipped with a NVIDIA GF116M [GeForce GT 560M]

Or, just for GPU output:

Code: Select all

lspci -nnk | grep -EA3 "3D|VGA"
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF116M [GeForce GT 560M] [10de:1251] (rev a1)
Subsystem: ASUSTeK Computer Inc. GF116M [GeForce GT 560M] [1043:204a]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
- Use inxi; you should first update it:

Code: Select all

sudo inxi -U
then,

Code: Select all

$ inxi -G

Code: Select all

Graphics:
  Device-1: NVIDIA GF116M [GeForce GT 560M] driver: nvidia v: 390.144
  Device-2: IMC Networks Integrated Webcam type: USB driver: uvcvideo
  Display: x11 server: X.Org 1.20.11 driver: loaded: nvidia
  unloaded: fbdev,modesetting,nouveau,vesa resolution: 1920x1080~60Hz
  OpenGL: renderer: GeForce GTX 560M/PCIe/SSE2 v: 4.6.0 NVIDIA 390.144
You get more information than with lspci: driver is nvidia, OpenGL version is 4.6, rendered by the GeForce GTX 560M using NVIDIA 390.144 drivers.


2) NVIDIA GPUs:

NVIDIA GPUs video drivers and OpenCL are normally installed during Linux Mint installation, if you accepted to install third-party software by selecting "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media" (this, in accordance with Linux Mint Installation Guide https://linuxmint.com/documentation.php; on most recent versions of Linux Mint, they might be installed anyway).

They can be also installed after installation, using Control center / Drivers manager; Drivers manager will offer to install NVIDIA driver or free Xorg one, and will indicate the latest available NVIDIA driver as the recommended one.

It may arrive that recent NVIDIA drivers, when released, do not appear in drivers repository before weeks.

To use recent drivers as soon as released, the simplest way is to use a ppa: https://launchpad.net/~graphics-drivers ... ubuntu/ppa

To install this ppa:

Code: Select all

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
The command clinfo is used to check that OpenCL is installed. If not already installed, install it with:

Code: Select all

sudo clinfo
NB: clinfo output is a long, verbose one; at the beginning you should read something like this:

Code: Select all

number of platforms                               1
  Platform Name                                   NVIDIA CUDA
  Platform Vendor                                 NVIDIA Corporation
  Platform Version                                OpenCL 1.2 CUDA 9.1.84
  Platform Profile                                FULL_PROFILE
and at the end:

Code: Select all

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.11
  ICD loader Profile                              OpenCL 2.1

3) Intel GPUs:

Intel OpenSource graphics drivers are part of the kernel and are installed during Linux Mint installation.

There are two possible OpenCL installations. (See https://linuxreviews.org/OpenCL)

Beignet:

Beignet is a Intel-iGPU specific OpenCL implementation developed by Intel China in 2013. It was maintained until around 2017 before it was abandoned in favor of Intel's Neo OpenCL library. Beignet can be used to do OpenCL 1.2 on Ivy Bridge processors a higher and it will provide limited OpenCL 2.0 support on Skylake and newer processors.

In order to enable OpenCL with Beignet, you have to install two packages (and their dependencies) and clinfo to check:

Code: Select all

sudo apt-get install beignet-opencl-icd ocl-icd-libopencl1 clinfo
Reboot, then check that OpenCL installation is OK with clinfo.

Source for this procedure: http://hansekbrand.se/code/OpenCL.html

Neo:

NEO is a OpenCL implementation from Intel, for Intel graphics only, with OpenCL 3.0 support on all Intel chips going back to Broadwell since version 20.40.18075. Earlier versions are limited to OpenCL 1.2, 2.1 or 3.0 depending on what CPU/iGPU you have chip. Intel has begun calling it "Intel(R) Graphics Compute Runtime for oneAPI Level Zero and OpenCL(TM) Driver". The NEO GitHub page states that: "NEO is the shorthand name for Compute Runtime contained within this repository. It is also a development mindset that we adopted when we first started the implementation effort for OpenCL."

Intel is only releasing Ubuntu packages for Neo. See https://github.com/intel/compute-runtime/releases for a table of Neo OpenCL support versus micro architecture and follow the installation procedure.

Then install clinfo to check all is OK:

Code: Select all

sudo apt-get install clinfo

4) AMD GPUs:

AMD OpenSource graphics drivers are part of the kernel and installed during Mint installation.

AMD provides proprietary Linux drivers and OpenCL support for a reduced set of references only. These AMD proprietary drivers are not available from Ubuntu / Linux Mint repositories.

a) GPU with AMD proprietary drivers for Linux:

At the time of this writing (December 2021), this page gives the links to download AMD Radeon Software for Linux and a compatibility table: https://www.amd.com/en/support/kb/relea ... ux-21-40-1.

(More generally, users should look for the most recent version at AMD support page https://www.amd.com/en/support)

If your AMD GPU is in the compatibility list, the preferred solution to have both graphics drivers and OpenCL support is to download and install AMD Radeon Software for Linux (choose Ubuntu 20.04 version for Linux Mint 20.x and Ubuntu 18.04 version for Linux Mint 19.x).

Detailed installation instructions are here, to be read carefully: https://amdgpu-install.readthedocs.io/en/21.40/

Note that some users want to use OpenSource graphics drivers and OpenCL support from AMD; they download AMD software, extract OpenCL files and install them. This installation method is out of the scope of this tutorial.

AMD also offers AMD ROCm technology for a limited number of GPUs, and for Ubuntu 18.04.5 / kernel 5.4.0-71-generic or Ubuntu 20.04.3HWE / kernel 5.8.0-48-generic. Installation procedures and documentation here: https://github.com/RadeonOpenCompute/ROCm.


b) GPU without AMD proprietary support for Linux:

If your GPU is not mentioned in the compatibility list, you will be let with the OpenSource graphics driver, and with an OpenSource OpenCL support.

WARNING: the following procedure is experimental

This applies to the GPUs taken into account by libclc-12 or by libclc-amdgcn.
libclc is an open implementation of the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. This package (libclc-12) contains support for the amdgcn (AMD GPU), PTX and r600 platforms.
libclc is an open implementation of the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. This package (libclc-amdgcn) contains support for the amdgcn (AMD GPU) platform. Supported GPU families: Southern Islands and newer.
The list of files included in each of these libraries shows the GPU technologies taken into account.

For libclc-12:

Code: Select all

/usr/lib/clc/amdgcn--amdhsa.bc
/usr/lib/clc/aruba-r600--.bc
/usr/lib/clc/barts-r600--.bc
/usr/lib/clc/bonaire-amdgcn--.bc
/usr/lib/clc/caicos-r600--.bc
/usr/lib/clc/carrizo-amdgcn--.bc
/usr/lib/clc/cayman-r600--.bc
/usr/lib/clc/cedar-r600--.bc
/usr/lib/clc/cypress-r600--.bc
/usr/lib/clc/fiji-amdgcn--.bc
/usr/lib/clc/gfx900-amdgcn--.bc
/usr/lib/clc/gfx902-amdgcn--.bc
/usr/lib/clc/gfx904-amdgcn--.bc
/usr/lib/clc/gfx906-amdgcn--.bc
/usr/lib/clc/hainan-amdgcn--.bc
/usr/lib/clc/hawaii-amdgcn--.bc
/usr/lib/clc/hemlock-r600--.bc
/usr/lib/clc/iceland-amdgcn--.bc
/usr/lib/clc/juniper-r600--.bc
/usr/lib/clc/kabini-amdgcn--.bc
/usr/lib/clc/kaveri-amdgcn--.bc
/usr/lib/clc/mullins-amdgcn--.bc
/usr/lib/clc/nvptx--.bc
/usr/lib/clc/nvptx--nvidiacl.bc
/usr/lib/clc/nvptx64--.bc
/usr/lib/clc/nvptx64--nvidiacl.bc
/usr/lib/clc/oland-amdgcn--.bc
/usr/lib/clc/palm-r600--.bc
/usr/lib/clc/pitcairn-amdgcn--.bc
/usr/lib/clc/polaris10-amdgcn--.bc
/usr/lib/clc/polaris11-amdgcn--.bc
/usr/lib/clc/redwood-r600--.bc
/usr/lib/clc/stoney-amdgcn--.bc
/usr/lib/clc/sumo-r600--.bc
/usr/lib/clc/sumo2-r600--.bc
/usr/lib/clc/tahiti-amdgcn--.bc
/usr/lib/clc/tonga-amdgcn--.bc
/usr/lib/clc/turks-r600--.bc
/usr/lib/clc/verde-amdgcn--.bc
For libclc-amdgcn:

Code: Select all

/usr/lib/clc/amdgcn--amdhsa.bc
/usr/lib/clc/bonaire-amdgcn--.bc
/usr/lib/clc/bonaire-amdgcn--amdhsa.bc
/usr/lib/clc/bonaire-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/carrizo-amdgcn--.bc
/usr/lib/clc/carrizo-amdgcn--amdhsa.bc
/usr/lib/clc/carrizo-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/fiji-amdgcn--.bc
/usr/lib/clc/fiji-amdgcn--amdhsa.bc
/usr/lib/clc/fiji-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/gfx900-amdgcn--.bc
/usr/lib/clc/gfx900-amdgcn--amdhsa.bc
/usr/lib/clc/gfx900-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/gfx902-amdgcn--.bc
/usr/lib/clc/gfx902-amdgcn--amdhsa.bc
/usr/lib/clc/gfx902-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/gfx904-amdgcn--.bc
/usr/lib/clc/gfx904-amdgcn--amdhsa.bc
/usr/lib/clc/gfx904-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/gfx906-amdgcn--.bc
/usr/lib/clc/gfx906-amdgcn--amdhsa.bc
/usr/lib/clc/gfx906-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/hainan-amdgcn--.bc
/usr/lib/clc/hainan-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/hawaii-amdgcn--.bc
/usr/lib/clc/hawaii-amdgcn--amdhsa.bc
/usr/lib/clc/hawaii-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/iceland-amdgcn--.bc
/usr/lib/clc/iceland-amdgcn--amdhsa.bc
/usr/lib/clc/iceland-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/kabini-amdgcn--.bc
/usr/lib/clc/kabini-amdgcn--amdhsa.bc
/usr/lib/clc/kabini-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/kaveri-amdgcn--.bc
/usr/lib/clc/kaveri-amdgcn--amdhsa.bc
/usr/lib/clc/kaveri-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/mullins-amdgcn--.bc
/usr/lib/clc/mullins-amdgcn--amdhsa.bc
/usr/lib/clc/mullins-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/oland-amdgcn--.bc
/usr/lib/clc/oland-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/pitcairn-amdgcn--.bc
/usr/lib/clc/pitcairn-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/polaris10-amdgcn--.bc
/usr/lib/clc/polaris10-amdgcn--amdhsa.bc
/usr/lib/clc/polaris10-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/polaris11-amdgcn--.bc
/usr/lib/clc/polaris11-amdgcn--amdhsa.bc
/usr/lib/clc/polaris11-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/stoney-amdgcn--.bc
/usr/lib/clc/stoney-amdgcn--amdhsa.bc
/usr/lib/clc/stoney-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/tahiti-amdgcn--.bc
/usr/lib/clc/tahiti-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/tonga-amdgcn--.bc
/usr/lib/clc/tonga-amdgcn--amdhsa.bc
/usr/lib/clc/tonga-amdgcn-mesa-mesa3d.bc
/usr/lib/clc/verde-amdgcn--.bc
/usr/lib/clc/verde-amdgcn-mesa-mesa3d.bc
Now, the difficulty is in selecting the good library; you can use Wikipedia https://en.wikipedia.org/wiki/Radeon.

As an example, if you have an AMD Radeon 530, this board is from 2017; Southern Islands has been issued in 2012; so this board is supported by libclc-amdgcn, said compatible with Southern Islands and newer.

There is however a trick; 1st step is to install OpenCL without libclc-12 or libclc-amdgcn.

Code: Select all

sudo apt-get install ocl-icd-libopencl1 mesa-opencl-icd ocl-icd-opencl-dev clinfo
then reboot; after reboot, execute clinfo command; the output will show an error; example:

Code: Select all

fatal error: cannot open file '/usr/local//usr/lib/clc/iceland-amdgcn-mesa-mesa3d.bc': No such file or directory
You can check that "iceland-amdgcn-mesa-mesa3d.bc" file is part of libclc-amdgcn. Now install it:

Code: Select all

sudo apt-get install libclc-amdgcn
Were the needed file part of libclc-12, you should have installed instead:

Code: Select all

sudo apt-get install libclc-12
A new check with clinfo will show all is OK!

This installation procedure derives from: http://hansekbrand.se/code/OpenCLAgain.html with my own complements.

NB: Christmas gifts list
It would be nice if Linux Mint would install automatically OpenCL support for Intel and AMD GPUs (with proprietary or OpenSource support for AMD depending on the GPU model).


5) OpenCL support for microprocessors and virtual machines guests:

This part concerns system without a performing GPU, or virtual machines guests with no GPU pass through (with VM software such as VMware Workstation, VMware Workstation Player; or with Oracle Virtual Box...).
[In these VMs, GPU is simulated through software and, as a consequence, no OpenCL support can be installed for the GPU. However, OPenCL support can be installed for the microprocessor.]

a) Linux Mint / Ubuntu systems or VM guests:

OpenCL support for microprocessor can be simply done by installing libopcl2, and clinfo to check after installation:

Code: Select all

sudo apt-get install libpocl2 clinfo
Users with Intel microprocessors might prefer the use of "Intel CPU Runtime for OpenCL", that can be downloaded from this page (free registration needed): https://www.intel.com/content/www/us/en ... rview.html
(choose Linux version)

b) Windows VM guests:

Intel provides a CPU runtime for its microprocessors, while AMD has dropped support for its OpenCL SDK, leaving its microprocessors without any OpenCL support.

Intel CPU Runtime for OpenCL can be downloaded from this page (free registration needed): https://www.intel.com/content/www/us/en ... rview.html (choose Windows version)

On Windows 10 guests, an alternative solution is to install the "OpenCL and OpenGL Compatibility Pack" from the Windows Store.
This compatibility pack allows more of your favorite OpenCL™ and OpenGL® apps to run on a Windows 10 PC that doesn't have OpenCL and OpenGL hardware drivers installed by default. If a DirectX 12 driver is installed, supported apps will run with hardware acceleration for better performance. This package supports apps that use OpenCL version 1.2 and earlier and OpenGL version 3.3 and earlier.
(see this tutorial to know how to have DirectX in VMware guests: viewtopic.php?f=42&t=362350)

Once installed, OpenCL presence can be tested with "GPU Caps Viewer", downloaded from https://www.geeks3d.com/dl/show/657


Feel free to comment or complete this tutorial.

Regards,

MN
Last edited by MikeNovember on Tue Dec 07, 2021 10:30 am, edited 13 times in total.
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [Tutorial] [Completed] How to install OpenCL support

Post by SMG »

MikeNovember wrote: Fri Dec 03, 2021 10:19 am1) Identifying your GPU(s):

- Use lspci, example below
If you use lspci -nnk | grep -EA3 "3D|VGA" you will specifically get the GPU information.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am2) NVIDIA GPUs:

NVIDIA GPUs video drivers and OpenCL are normally installed during Linux Mint installation, if you accepted to install third-party software by selecting "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media".
I believe this only applies to specific older versions of Mint. The latest versions of Mint (definitely LM20.2 and possibly LM20.1) automatically install the open-source nouveau driver on computers with Nvidia GPUs without having to select anything.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am3) Intel GPUs:

Intel does not provide any graphics drivers or OpenCL support for Linux.
This was not correct when you posted it in the other topic and it is still not correct.

I think you may be assuming the drivers for Intel and AMD hardware are made in a similar manner to drivers for Nvidia hardware. That is not true.

For Nvidia hardware there are two separate driver development efforts. There are the drivers made by Nvidia engineers and there are the drivers made through freedesktop.org (nouveau). The Nvidia efforts are close-source and proprietary while the nouveau efforts are open-source.

When I said in the other topic that Intel drivers were in the kernel, I meant that literally. For Intel hardware, Intel engineers create the drivers used in Linux-based distros. They create and update the i915 driver and pass it to the kernel developers who include it in the kernel. When there was a problem this past spring, Intel engineers worked with Canonical (Ubuntu) engineers to get patches for the i915 driver into the 5.10-oem kernel.

There is no open-source effort similar to nouveau for the Intel driver. It is not needed. That is why there are no Intel iGPU drivers in Driver Manager and none available on a website somewhere. They are right in the kernel.

Similarly, there is no open-source effort for AMD drivers. The amdgpu driver included in the kernel for AMD hardware is created and maintained by AMD engineers.

Here is the Intel GPU Compute Software forum and here are the links for:
MikeNovember wrote: Fri Dec 03, 2021 10:19 am AMD does not provide Linux drivers and OpenCL for all its GPUs, but for a reduced set of references only.
AMD provides Linux drivers for all its GPUs. The drivers in the kernel which install automatically are from AMD. Just because they are available in the kernel (and thus open-source) does not mean they are not official AMD drivers. They are. That is why I said in the other topic that the AMD drivers were installed.

AMD proprietary drivers (which is a subset of the drivers available from AMD) are available for select GPUs. You can get a summary of the differences between the two in this post.
MikeNovember wrote: Fri Dec 03, 2021 10:19 amAt the time of this writing (December 2021), this page gives the links to download AMD Radeon Software for Linux and a compatibility table: https://www.amd.com/en/support/kb/relea ... inux-21-30.
That is not the latest drivers available as of this time. The 20.40.1 driver was released in November. To get the latest drivers, one should go to AMD Support and use the drop-down boxes to make sure they are getting the correct drivers for their GPU.

Additionally, one has to be careful about what version driver they are using with what kernel version. Not all the AMD driver versions work for all kernels. We have already run into this issue on the forum because some of the kernels available through Mint are higher than the kernel version which can be used with the driver downloaded from the AMD website.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am b) GPU without AMD support for Linux:
The only GPUs without AMD support are a very few very old CPUs for which there are no open-source drivers at all. All the rest do have AMD support for Linux. Please do not spread rumors that the drivers in the kernel are not from AMD. They are.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am It would be nice if:
- Linux Mint had in its repositories AMD Radeon proprietary drivers,
It would be more likely to cause a mess because people might think they need to use them and most people do not. AMD provides the drivers in the kernels. Most people can get newer drivers than what is available on the AMD website by just upgrading the kernel they are using. Most people do not need the proprietary components of the drivers on the AMD website.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: [Tutorial] [Completed] How to install OpenCL support

Post by MikeNovember »

Hi,

Thanks for your comments.
SMG wrote: Sun Dec 05, 2021 9:25 pm
MikeNovember wrote: Fri Dec 03, 2021 10:19 am1) Identifying your GPU(s):

- Use lspci, example below
If you use lspci -nnk | grep -EA3 "3D|VGA" you will specifically get the GPU information.
OK, I will update the tuto.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am2) NVIDIA GPUs:

NVIDIA GPUs video drivers and OpenCL are normally installed during Linux Mint installation, if you accepted to install third-party software by selecting "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media".
I believe this only applies to specific older versions of Mint. The latest versions of Mint (definitely LM20.2 and possibly LM20.1) automatically install the open-source nouveau driver on computers with Nvidia GPUs without having to select anything.
What I wrote is in accordance with the official Linux Mint installation guide. If it is wrong, the guide should be updated.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am3) Intel GPUs:

Intel does not provide any graphics drivers or OpenCL support for Linux.
This was not correct when you posted it in the other topic and it is still not correct.

I think you may be assuming the drivers for Intel and AMD hardware are made in a similar manner to drivers for Nvidia hardware. That is not true.

For Nvidia hardware there are two separate driver development efforts. There are the drivers made by Nvidia engineers and there are the drivers made through freedesktop.org (nouveau). The Nvidia efforts are close-source and proprietary while the nouveau efforts are open-source.

When I said in the other topic that Intel drivers were in the kernel, I meant that literally. For Intel hardware, Intel engineers create the drivers used in Linux-based distros. They create and update the i915 driver and pass it to the kernel developers who include it in the kernel. When there was a problem this past spring, Intel engineers worked with Canonical (Ubuntu) engineers to get patches for the i915 driver into the 5.10-oem kernel.

There is no open-source effort similar to nouveau for the Intel driver. It is not needed. That is why there are no Intel iGPU drivers in Driver Manager and none available on a website somewhere. They are right in the kernel.

Similarly, there is no open-source effort for AMD drivers. The amdgpu driver included in the kernel for AMD hardware is created and maintained by AMD engineers.

Here is the Intel GPU Compute Software forum and here are the links for:
OK for graphics driver, but OpenCL support is not installed by default in LM for Intel or for AMD; I will rewrite this part, limiting it to OpenCL.
MikeNovember wrote: Fri Dec 03, 2021 10:19 am AMD does not provide Linux drivers and OpenCL for all its GPUs, but for a reduced set of references only.
AMD provides Linux drivers for all its GPUs. The drivers in the kernel which install automatically are from AMD. Just because they are available in the kernel (and thus open-source) does not mean they are not official AMD drivers. They are. That is why I said in the other topic that the AMD drivers were installed.

AMD proprietary drivers (which is a subset of the drivers available from AMD) are available for select GPUs. You can get a summary of the differences between the two in this post.
OK, I will speak of AMD proprietary drivers.
MikeNovember wrote: Fri Dec 03, 2021 10:19 amAt the time of this writing (December 2021), this page gives the links to download AMD Radeon Software for Linux and a compatibility table: https://www.amd.com/en/support/kb/relea ... inux-21-30.
That is not the latest drivers available as of this time. The 20.40.1 driver was released in November. To get the latest drivers, one should go to AMD Support and use the drop-down boxes to make sure they are getting the correct drivers for their GPU.

Additionally, one has to be careful about what version driver they are using with what kernel version. Not all the AMD driver versions work for all kernels. We have already run into this issue on the forum because some of the kernels available through Mint are higher than the kernel version which can be used with the driver downloaded from the AMD website.
OK, I will update the tuto. (21.40.1, not 20.40.1)
MikeNovember wrote: Fri Dec 03, 2021 10:19 am b) GPU without AMD support for Linux:
The only GPUs without AMD support are a very few very old CPUs for which there are no open-source drivers at all. All the rest do have AMD support for Linux. Please do not spread rumors that the drivers in the kernel are not from AMD. They are.
OK, I will update the tuto "GPU without AMD proprietary support for Linux".
MikeNovember wrote: Fri Dec 03, 2021 10:19 am It would be nice if:
- Linux Mint had in its repositories AMD Radeon proprietary drivers,
It would be more likely to cause a mess because people might think they need to use them and most people do not. AMD provides the drivers in the kernels. Most people can get newer drivers than what is available on the AMD website by just upgrading the kernel they are using. Most people do not need the proprietary components of the drivers on the AMD website.
It would be still nice if OpenCL support was automatically installed for Intel and AMD GPUs, with OPenSource drivers or with proprietary ones.
OpenCL is more and more used in apps, as an example calculations on large spreadsheets are much faster with OpenOffice Calc when OpenCL support is installed and set in OpenOffice preferences.

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [Tutorial] [Completed] How to install OpenCL support

Post by SMG »

MikeNovember wrote: Mon Dec 06, 2021 5:52 am
SMG wrote: Sun Dec 05, 2021 9:25 pm
MikeNovember wrote: Fri Dec 03, 2021 10:19 am2) NVIDIA GPUs:

NVIDIA GPUs video drivers and OpenCL are normally installed during Linux Mint installation, if you accepted to install third-party software by selecting "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media".
I believe this only applies to specific older versions of Mint. The latest versions of Mint (definitely LM20.2 and possibly LM20.1) automatically install the open-source nouveau driver on computers with Nvidia GPUs without having to select anything.
What I wrote is in accordance with the official Linux Mint installation guide. If it is wrong, the guide should be updated.
Do you have a link to what you saw? I seem to recall what you are describing was part of early versions of LM19, but I do not see it on the Linux Mint Installation Guide: Install Linux Mint and the next link about Hardware drivers indicates to use Driver Manager. However, maybe there is another guide in a different location. The guide to which I linked is the one linked from the Linux Mint website.
MikeNovember wrote: Mon Dec 06, 2021 5:52 am It would be still nice if OpenCL support was automatically installed for Intel and AMD GPUs, with OPenSource drivers or with proprietary ones.
At this point, many people have an option of which one they might want to use (one of the key advantages to Linux-based distros). Perhaps if its use becomes more widespread that will be something added in the future.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: [Tutorial] [Completed] How to install OpenCL support

Post by MikeNovember »

SMG wrote: Mon Dec 06, 2021 4:20 pm
MikeNovember wrote: Mon Dec 06, 2021 5:52 am
SMG wrote: Sun Dec 05, 2021 9:25 pmI believe this only applies to specific older versions of Mint. The latest versions of Mint (definitely LM20.2 and possibly LM20.1) automatically install the open-source nouveau driver on computers with Nvidia GPUs without having to select anything.
What I wrote is in accordance with the official Linux Mint installation guide. If it is wrong, the guide should be updated.
Do you have a link to what you saw? I seem to recall what you are describing was part of early versions of LM19, but I do not see it on the Linux Mint Installation Guide: Install Linux Mint and the next link about Hardware drivers indicates to use Driver Manager. However, maybe there is another guide in a different location. The guide to which I linked is the one linked from the Linux Mint website.
Hi,

This is the link: https://linuxmint-installation-guide.re ... stall.html, see "4. If you are connected to the Internet, tick the box to install the multimedia codecs" and, in the screen capture the case to select "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media".
MikeNovember wrote: Mon Dec 06, 2021 5:52 am It would be still nice if OpenCL support was automatically installed for Intel and AMD GPUs, with OPenSource drivers or with proprietary ones.
At this point, many people have an option of which one they might want to use (one of the key advantages to Linux-based distros). Perhaps if its use becomes more widespread that will be something added in the future.
I would reverse your phrase: "Perhaps if it was automatically installed, more people would use it".

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [Tutorial] [Completed] How to install OpenCL support

Post by SMG »

MikeNovember wrote: Tue Dec 07, 2021 8:58 amThis is the link: https://linuxmint-installation-guide.re ... stall.html, see "4. If you are connected to the Internet, tick the box to install the multimedia codecs" and, in the screen capture the case to select "Install third-party software for graphics and Wi-Fi hardware, Flash, mp3 and other media".
I believe the screenshot may be from LM19 which is still available to download. The text as listed is correct for both LM19 and LM20.
MikeNovember wrote: Tue Dec 07, 2021 8:58 am I would reverse your phrase: "Perhaps if it was automatically installed, more people would use it".
The more software which is added to an open-source product is the more software which must be tested to make sure it is working properly. That not only increases the workload of those volunteering their time to provide an open-source product, but also requires a variety of hardware on which to do the testing. That latter point is often a reason why some bugs are never fixed; the developers do not have the hardware on which to test the software/changes.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
LEFTERIS733
Level 1
Level 1
Posts: 14
Joined: Sat Jul 16, 2022 2:53 am

Re: [Tutorial] [Updated] How to install OpenCL support

Post by LEFTERIS733 »

i followed the instructions of the first post (number 4, for amd gpu) and after running: sudo apt-get install libclc-amdgcn i got the following:

Code: Select all

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libclc-15-dev : Breaks: libclc-dev but 0.2.0+git20190827-8 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Any help?
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: [Tutorial] [Updated] How to install OpenCL support

Post by MikeNovember »

Hi,
You have some broken packages, and this prevents the installation of new ones.
You can solve this by using Synaptic.

Regards,
MN

PS: this tutorial, two years old, might be outdated.
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
LEFTERIS733
Level 1
Level 1
Posts: 14
Joined: Sat Jul 16, 2022 2:53 am

Re: [Tutorial] [Updated] How to install OpenCL support

Post by LEFTERIS733 »

I checked synaptic but there weren't any broken packages

also i ran:

Code: Select all

$ sudo apt-get check
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

Code: Select all

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: [Tutorial] [Updated] How to install OpenCL support

Post by MikeNovember »

Hi,

1) As I said, this post could be outdated. And I precised that the procedure is experimental, though successfully tested by some forumers.

2) I said in point 4: "This applies to the GPUs taken into account by libclc-12 or by libclc-amdgcn". So, I don't understand why apt tries to install "libclc-15-dev"...

3) As apt said:
"Some packages could not be installed. This may mean that you have
requested an impossible situation
or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming."

So, if no package was broken, it is just that it is not possible to install libclc-amdgcn on your system.

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
User avatar
warriorofthelight
Level 3
Level 3
Posts: 114
Joined: Wed Jan 20, 2016 6:04 am

Re: [Tutorial] [Completed] How to install OpenCL support

Post by warriorofthelight »

MikeNovember wrote: Mon Dec 06, 2021 5:52 am It would be still nice if OpenCL support was automatically installed for Intel and AMD GPUs, with OPenSource drivers or with proprietary ones.
At this point, many people have an option of which one they might want to use (one of the key advantages to Linux-based distros). Perhaps if its use becomes more widespread that will be something added in the future.
I know it's an old thread, but I want to ditto that request. OpenCL was a niche thing years ago, now it becomes more and more common, especially with the spread of AI applications. It would be SO NICE to not have to deal with the mess of the proprietary drivers from AMD (I don't know how NVidia handles this issue...). Just failed miserably at trying to use a 6700XT on Mint 20.3 and 21.1 ... despite all efforts, questions and answers from this forum (and from you SMG), from another forum (Katago-developer), different kernels, uncountable reinstalls and deinstalls and alternative ways ... no luck. The old card runs fine with OpenCL, the 6700XT just isn't recognized.

I think the time to include OpenCL as a standard feature is here. There are so many old devices and services shipped with Linux that are barely used by anyone, but a key feature for all AI and HPC applications is not...
Post Reply

Return to “Tutorials”