Linux Galaxy

ROCm OpenCL Runtime for Slackware64

Posted on Mar 04, 2024 by kingbeowulf



A while ago, I had started beating on the ROCm build system to try to get a "simple" set of packages for those of us that only need basic OpenCL runtime support on Slackware64. AMD's ROCm includes that but also includes various tools to build HIP and OpenCL GPU compute programs. My prior efforts were the legacy OpenCL binary Ubuntu packages which wasn't very stable due to being compiled on Ubuntu. I had to take a pause due to a few health issues and only recently started looking into this again.

Recently, a post on the Slackbuilds.org mailing list completed what I could not: a set of slackbuild scripts for ROCm-5.5.1

https://github.com/414n/slackbuilds.org/blob/rocm-5.5.1

A big thanks to 414n to sift through and sort all the various ROCm bits and pieces. Much appreciated!

Now that I had a set of build scripts, and nice READMEs for which one does what and a workable build order, I dug up my notes to see which packages are needed to have OpenCL runtime support. AMD sure did not make this easy on package maintainers!

Prerequisites for Slackware 64-15.0 Stable

To start, grab a few packages from Slackbuilds.org that are external dependencies:

For rocminfo: numactl

For rocblas (optional package):
python3-wheel
msgpack-c
python3-virtualenv

For rocsolver (optional package):
fmt

Optional (utility):
clinfo
(or use the one provided with ROCm)

Before you build any of these packages, take note of the information and build order below. Rocblas and rocsolver are not required for the OpenCL runtime.

Annotated Build Order

As I mentioned, I sifted through the packages to get a better idea of the build order for ROCm. What follows is the result.

B = build time dependency only
R = OpenCL runtime dependency
U = ROCm/OpenCL utility

The compile/build order in each Build stanza is optional.

Build 1st

rocm-llvm (B)
hsakmt-roct (R)
rocm-cmake (B)
python3-cppheaderparser (B) - included in 414n's git repository ROCm branch.

Build 2nd

rocm-device-libs (R)

Build 3rd

rocm-compiler-support (R)
hsa-roc (R)

build 4th

rocminfo (U)
rocm-smi-lib (U)
rocm-opencl-runtime (R)

The remaining packages are optional and are not required for basic OpenCL support. This includes the HIP runtime and various headers and libraries to build HIP and OpenCL programs.

Build 5th - Optional

rocm-clang-ocl [deprecated Dec 2023 for newer ROCm] (B)
hip-runtime-amd (B,R)

hsa-amd-aqlprofile-bin (optional, binary blob).
A code profiling/analysis binary blob library that is needed only for development and to suppress silly library missing errors.

Build 6th - Optional
in approximate build order

rocrand
rocblas
rocm-core
rocprim
hipcub
rocsparse
hipsparse
rocsolver
hipblas
composable-kernel
half - included in 414n's git repository ROCm branch.
miopengemm
miopen-hip
rocfft
hipfft
rocthrust
hipsolver
hipify-clang
rccl
roctracer

Core OpenCL Runtime

Once the the packages are built, which ones are necessary for just the OpenCL runtime? For basic ROCm OpenCL support:

numactl (for rocminfo)
hsa-rocr
hsakmt-roct
rocm-compiler-support
rocm-device-libs
rocm-opencl-runtime
rocm-smi-librocminfo

That's it!

Closing Thoughts

The following utilities are provided in /opt/rocm/bin that provide

clinfo - OpenCL platform information
rocminfo - ROCm HSA agent information
rocm-smi - GPU status and control

The OpenCL ICD loader may have difficulty locating the correct OpenCL ICD and therefore the correct OpenCL library locations. If this happens (for example BOINC), either move or rename

etc/OpenCL/vendors/mesa.icd

So far, OpenCL works for BOINC and phoronix-test-suite with benchmarks hashcat and clpeak.


Return to blog

King Beowulf's Linux Adventures


Contact:

  • kingbeowulf@linuxgalaxy.org
  • mumble.linuxgalaxy.org:64738
  • Libera.chat IRC
    • ##slackware, #slackbuilds, #linuxgalaxy

Screamin' and a-streamin' !

  • https://twitch.tv/kngbwlf
  • https://www.youtube.com/@mylinuxgalaxy

Advertisement

Try a nice upgrade from EVGA and get a discount!

Tired of Steam, Epic and other rip-off game "stores"? Check out Humble Bundle for your digital download needs! A portion of your hard-earned gaming cash goes to charity.

King Beowulf's Humble Bundle Referral Code

Citizen Science!