Ubuntu 20.04 AMDGPU Pro drivers (RX580) and OpenCL (ethminer related) (PARTIALLY SOLVED)

Heyya.
(SOLVED IN TERMS OF RUNNING BINARY)

Note from several updates - this is more turning up to be a oddball connected to the build methods of ethminer - with the combination of oddball of the AMD GPU PRO and OpenCL implementation connected to it…

(Converting this to a trial-and-error-thread-please-assist-if-you-want-thread, in case someone else ends up with the same issues…)

Been trying this morning and over lunch to smack the AMD GPU PRO drivers with OpenCL onto my Ubuntu 20.04 machine (Yes… I need that or at least something that fires off OpenCL). Reason, running ethminer.

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

Backstory would be that I want to play with mining. I’ve targeted ethermine since it was a breeze to get running with my Nvidia-cards and CUDA.

However, it’s not a walk in the park with the AMD portion.

Standard packages, even adding on some that’s already in the standard repo will error out (well, ethminer 0.18/0.19 will -

input.cl:321:9: error: implicit declaration of function 'amd_bitalign' is invalid in OpenCL
input.cl:180:9: note: expanded from macro 'KECCAK_PROCESS'
input.cl:99:60: note: expanded from macro 'KECCAKF_1600_RND'
input.cl:87:24: note: expanded from macro 'ROTL64_1'
input.cl:433:5: error: implicit declaration of function 'amd_bitalign' is invalid in OpenCL
input.cl:180:9: note: expanded from macro 'KECCAK_PROCESS'
input.cl:99:60: note: expanded from macro 'KECCAKF_1600_RND'
input.cl:87:24: note: expanded from macro 'ROTL64_1'

 X 17:09:04 cl-0     OpenCL kernel build error (-11):
clBuildProgram
SIGSEGV encountered ...
stack trace:
backtrace() returned 7 addresses
./ethminer() [0x422af9]
/lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f4696527210]
./ethminer() [0x6e0a61]
./ethminer() [0x4baff6]
./ethminer() [0x773aaf]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7f4696846609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f4696603293]
pure virtual method called
terminate called without an active exception
Aborted

So, of course I did some google-foo, and ended up with the ‘latest’ AMD driver for my RX580. (20.45 at time of writing) - actual install-params was headless and pro…

https://www.amd.com/en/support/graphics/radeon-500-series/radeon-rx-500-series/radeon-rx-580

However, compiling the dkms-component explodes… (usually, all explodes but dkms-components triggers it…)

$ uname -r
5.8.0-43-generic

After som mashing - I’ve managed to “partially” get it right, (it’s a looong time banging on it and ended up removing for no real reason most of the other stale kernels and reinstalling 5.8.0-43

apt-get install --reinstall linux-image-$(uname -r) linux-modules-$(uname -r) linux-modules-extra-$(uname -r) linux-headers-$(uname -r)

Now, it got a bit more happy - but, the first error is back (instead of just "can’t find a proper gpu to use…).

$ dkms status
amdgpu, 5.6.20.906316-1188099: added

There’s a long threat I found that goes back a while with the 5.4 Kernel of Ubuntu 20.04,

Last entry confused me quite a bit…

In short - does anyone sit on any kind of pointers? :wink:
I thought the fighting drivers-days were over, but … wrong I was…

(OpenCL … really… this much trouble?)

Odd part - clinfo does print out statements… Perhaps it’s just the software I am trying to run that has the real issues?

clinfo
Number of platforms                               2
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3188.4)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.2.6
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (3188.4)
  Driver Version                                  3188.4
  Device OpenCL C Version                         OpenCL C 1.2
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX 580 Series
  Device Topology (AMD)                           PCI-E, 09:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               36
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1386MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     36
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes
    char                                                 4 / 4
    short                                                2 / 2
    int                                                  1 / 1
    long                                                 1 / 1
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1
    double                                               1 / 1        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     No
    Infinity and NANs                             No
    Round to nearest                              No
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              8584028160 (7.994GiB)
  Global free memory (AMD)                        8360936 (7.974GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           16
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           7072877363 (6.587GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        16384 (16KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   256 bytes
    Pitch alignment for 2D image buffers          256 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        7072877363 (6.587GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        No
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1613486669118414579ns (Tue Feb 16 15:44:29 2021)
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  2
    Max real-time compute queues (AMD)            0
    Max real-time compute units (AMD)             0
    SPIR versions                                 1.2
  printf() buffer size                            4194304 (4MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     Radeon RX 580 Series (POLARIS10, DRM 3.38.0, 5.8.0-43-generic, LLVM 11.0.0)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.2.6
  Driver Version                                  20.2.6
  Device OpenCL C Version                         OpenCL C 1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               36
  Max clock frequency                             1386MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              64
  Preferred / native vector sizes
    char                                                16 / 16
    short                                                8 / 8
    int                                                  4 / 4
    long                                                 2 / 2
    half                                                 0 / 0        (n/a)
    float                                                4 / 4
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              8589934592 (8GiB)
  Error Correction support                        No
  Max memory allocation                           6871947673 (6.4GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       32768 bits (4096 bytes)
  Global Memory cache type                        None
  Image support                                   No
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        2147483392 (2GiB)
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        No
    Profiling                                     Yes
  Profiling timer resolution                      0ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64


NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [AMD]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere

Starting to look very much like the build of the binary I am trying to run has some serious issues and has hard AMD OpenCL binary that creates the scenario - I am trying to put my head into building it myself and will either kill this thread if I can figure out that it is the cause, or just see if it’s a joint issue…

(ethminer project link;
Release ethminer 0.18.0 · ethereum-mining/ethminer · GitHub )

Issue created at;

Issue cleared, as far as compiling and running it goes.

As always - thank you Arch Linux users, your documentation is amazing.

https://wiki.archlinux.org/index.php/AMDGPU

This means that after cloning the ethminer repo, and not just downloading the “source” compressed files, compiling works. What I used what to kill off the AMD binary included (and turned off CUDA).

So far final words:

I see this still as a problem but not actively looked at. There’s major issues with AMDGPU Pro as we know. Resolving this lies in the hands of AMD.

Developers going the partially great and partially lazy-turtle route will make things really hard. Including other git repos and forcing an init on those repos before building is just for me awkward. The AMD binary includes (to be dug out as far as I am capable) is an issue for ethminer.

I hope you all can get some useful information from all this.

Thank you for reading :).

1 Like

Thanks for sharing this. Sadly, after spending a stupid amount of time trying to get OpenCL working with a 6900XT, I’ve remained unsuccessful. clinfo still shows 0 devices. I ended up passing it through to my Windows 10 VM for mining, and even then, it required a registry tweak to get ethminer working. The only thing I don’t really care for about this setup is that I can’t have ethminer running in a tmux session for convenient remote monitoring.

edit By purging all existing “stuff” from amdgpu-pro and rocm, installing kernel 5.9.10, installing amdgpu-pro --opencl=rocr, then doing the rocm user-level install (which bypasses the ROCk kernel driver), I was able to get ethminer (and clinfo) to recognize the card, but it reports 0.00 h. Also having the same issue of clinfo hanging reported here.

1 Like