AMD navi 和 polaris GPU 共存 - OpenCL 平台

AMD navi 和 polaris GPU 共存 - OpenCL 平台

我正在以下硬件中运行混合了 AMD Polaris 和 Navi GPU 的设备:

PRIME Z390-P 主板英特尔 i3 8100 CPU 8 GB RAM Ubuntu 20.04.2 内核 5.11.0-44-generic

Ubuntu 检测所有卡:

sudo lshw -C video
  *-display
       description: VGA compatible controller
       product: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:01:00.0
       version: e7
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
       configuration: driver=amdgpu latency=0
       resources: iomemory:420-41f iomemory:410-40f irq:16 memory:4200000000-43ffffffff memory:4100000000-41001fffff ioport:6000(size=256) memory:c0600000-c063ffff memory:c0000-dffff
  *-display
       description: VGA compatible controller
       product: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:03:00.0
       version: e7
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
       configuration: driver=amdgpu latency=0
       resources: iomemory:440-43f iomemory:460-45f irq:16 memory:4400000000-45ffffffff memory:4600000000-46001fffff ioport:5000(size=256) memory:c0500000-c053ffff memory:c0540000-c055ffff
  *-display
       description: VGA compatible controller
       product: Navi 12 [Radeon Pro 5600M / V520]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:08:00.0
       version: c7
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
       configuration: driver=amdgpu latency=0
       resources: iomemory:480-47f iomemory:470-46f irq:17 memory:4800000000-49ffffffff memory:4700000000-47001fffff ioport:3000(size=256) memory:c0200000-c027ffff memory:c0280000-c029ffff

我使用以下命令安装了 amdgpu pro 的最新版本(21.40.2):

sudo amdgpu-install -y --accept-eula --usecase=rocm,lrt,opencl,openclsdk,hiplibsdk --opencl=rocr,legacy

clinfo 的输出显示:

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3354.7)
  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                                   AMD Accelerated Parallel Processing
Number of devices                                 2
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0 AMD-APP (3354.7)
  Driver Version                                  3354.7 (PAL,HSAIL)
  Device OpenCL C Version                         OpenCL C 2.0
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon RX 580 Series
  Device Topology (AMD)                           PCI-E, 03: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                             1411MHz
  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                              8589934592 (8GiB)
  Global free memory (AMD)                        8321004 (7.936GiB)
  Global memory channels (AMD)                    8
  Global memory banks per channel (AMD)           4
  Global memory bank width (AMD)                  256 bytes
  Error Correction support                        No
  Max memory allocation                           7301444403 (6.8GiB)
  Unified memory for Host and Device              No
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   No
    Atomics                                       No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       2048 bits (256 bytes)
  Preferred alignment for atomics
    SVM                                           0 bytes
    Global                                        0 bytes
    Local                                         0 bytes
  Max size for global variable                    6571299840 (6.12GiB)
  Preferred total size of global vars             8589934592 (8GiB)
  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            456340275 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                64
    Max number of read/write image args           64
  Max number of pipe args                         16
  Max active pipe reservations                    16
  Max pipe packet size                            3006477107 (2.8GiB)
  Local memory type                               Local
  Local memory size                               65536 (64KiB)
  Local memory syze per CU (AMD)                  65536 (64KiB)
  Local memory banks (AMD)                        32
  Max number of constant args                     8
  Max constant buffer size                        7301444403 (6.8GiB)
  Preferred constant buffer size (AMD)            16384 (16KiB)
  Max size of kernel argument                     1024
  Queue properties (on host)
    Out-of-order execution                        No
    Profiling                                     Yes
  Queue properties (on device)
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                262144 (256KiB)
    Max size                                      8388608 (8MiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    Yes
  Number of P2P devices (AMD)                     0
  P2P devices (AMD)                               <printDeviceInfo:147: get number of CL_DEVICE_P2P_DEVICES_AMD : error -30>
  Profiling timer resolution                      1ns
  Profiling timer offset since Epoch (AMD)        1641596881777387270ns (Sat Jan  8 00:08:01 2022)
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Thread trace supported (AMD)                  Yes
    Number of async queues (AMD)                  4
    Max real-time compute queues (AMD)            1
    Max real-time compute units (AMD)             0
  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_khr_gl_depth_images 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_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_copy_buffer_p2p

[...]

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 (2)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
    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 (2)
    Platform Name                                 AMD Accelerated Parallel Processing
    Device Name                                   Ellesmere
    Device Name                                   Ellesmere

当我运行 teamredminer 时,它仅识别 Polaris 卡并发送消息“无法找到设备 idx 2,请使用 --list_devices 检查”:

Team Red Miner version 0.8.5
[2022-01-08 00:13:48] Auto-detected AMD OpenCL platform 0
[2022-01-08 00:13:49] Initializing GPU 0.
[2022-01-08 00:13:49] Initializing GPU 1.
[2022-01-08 00:13:49] Failed to find device idx 2, check with --list_devices.
[2022-01-08 00:13:49] GPU 0 Starting tuning.
[2022-01-08 00:13:49] GPU 1 Starting tuning.
[2022-01-08 00:13:49] Successfully initialized GPU 0: Polaris with 36 CU (PCIe 01:00.0) 
[2022-01-08 00:13:49] Watchdog script enabled, will run '/home/m4rk0/teamredminer-v0.8.5-linux/watchdog_sysrq.sh' when triggered.
[2022-01-08 00:13:49] Watchdog thread starting.
[2022-01-08 00:13:49] Runtime Command Keys: h - help, s - stats, e - enable gpu, d - disable gpu, q - quit
[2022-01-08 00:13:49] Successfully initialized GPU 1: Polaris with 36 CU (PCIe 03:00.0) 
[...]

我尝试安装多个版本的 amdgpu,但仍然得到相同的结果。

在其他论坛中,他们建议更改以下文件,但更改后没有成功:

edit:

sudo nano /etc/OpenCL/vendors/amdocl64_40000.icd

and change:

libamdocl64.so
to:

/opt/rocm/opencl/lib/libamdocl64.so

我有一个不同的 HiveOS 环境,并且我注意到当 teamredminer 使用混合 Polaris 和 Navi GPU 装备启动时,teamredminer 检测到 2 个不同的 OpenCL 平台:

     Team Red Miner version 0.8.6.3
[2022-01-07 19:58:37] Auto-detected AMD OpenCL platform 0
[2022-01-07 19:58:37] Auto-detected AMD OpenCL platform 1
[2022-01-07 19:58:39] Initializing GPU 0.
[2022-01-07 19:58:39] Initializing GPU 1.
[2022-01-07 19:58:40] Initializing GPU 2.
[2022-01-07 19:58:40] Initializing GPU 3.
[2022-01-07 19:58:40] Initializing GPU 4.
[2022-01-07 19:58:40] Initializing GPU 5.
[2022-01-07 19:58:41] Initializing GPU 6.
[2022-01-07 19:58:41] Initializing GPU 7.
[2022-01-07 19:58:41] GPU 0 Starting tuning.
[2022-01-07 19:58:41] GPU 1 Starting tuning.
[2022-01-07 19:58:41] GPU 2 Starting tuning.
[2022-01-07 19:58:41] GPU 3 Starting tuning.
[2022-01-07 19:58:41] GPU 4 Starting tuning.
[2022-01-07 19:58:41] GPU 5 Starting tuning.
[2022-01-07 19:58:41] GPU 6 Starting tuning.
[2022-01-07 19:58:41] GPU 7 Starting tuning.
[2022-01-07 19:58:41] Watchdog script enabled, will run 'watchdog.sh' when triggered.
[2022-01-07 19:58:41] Watchdog thread starting.
[2022-01-07 19:58:41] API initialized on 127.0.0.1:65078
[2022-01-07 19:58:41] Runtime Command Keys: h - help, s - stats, e - enable gpu, d - disable gpu, q - quit
[2022-01-07 19:58:41] Successfully initialized GPU 0: Navi with 36 CU (PCIe 03:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 1: Polaris with 36 CU (PCIe 04:00.0)
[2022-01-07 19:58:41] GPU 0 DAG allocation trying 8176.0 - 256.0 = 7920.0 MiB.
[2022-01-07 19:58:41] Successfully initialized GPU 2: Polaris with 36 CU (PCIe 05:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 3: Polaris with 36 CU (PCIe 06:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 4: Polaris with 36 CU (PCIe 07:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 5: Navi with 36 CU (PCIe 0b:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 6: Polaris with 36 CU (PCIe 0c:00.0)
[2022-01-07 19:58:41] Successfully initialized GPU 7: Navi with 36 CU (PCIe 0f:00.0)
[2022-01-07 19:58:41] Pool eth-se.flexpool.io connecting to address 13.48.151.148.
[2022-01-07 19:58:41] Pool eth-se.flexpool.io successfully connected to address 13.48.151.148.
[2022-01-07 19:58:41] Pool eth-se.flexpool.io login succeeded.
[2022-01-07 19:58:41] Pool eth-se.flexpool.io set difficulty to 0.931 (4000 MH)
[2022-01-07 19:58:41] Pool eth-se.flexpool.io received new job. (job_id: 0x2576ce0fd4e..., diff 0.931 / 4000 MH)
[2022-01-07 19:58:42] Dev pool connected and ready.
[2022-01-07 19:58:44] Pool eth-se.flexpool.io received new job epoch 465 (variant ethash), cache built in 2.7 secs.
[2022-01-07 19:58:44] GPU 6 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:44] GPU 5 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:44] Pool eth-se.flexpool.io received new job. (job_id: 0xbe15f47e020..., diff 0.931 / 4000 MH)
[2022-01-07 19:58:44] GPU 1 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:44] GPU 7 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:45] GPU 0 Starting DAG generation for epoch 465 (single buffer mode).
[2022-01-07 19:58:45] GPU 2 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:45] GPU 3 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:45] GPU 4 Starting DAG generation for epoch 465, 4.63 GB (single buffer mode).
[2022-01-07 19:58:47] Pool eth-se.flexpool.io received new job. (job_id: 0xb3e65f8ac8c..., diff 0.931 / 4000 MH)
[2022-01-07 19:58:50] Pool eth-se.flexpool.io received new job. (job_id: 0xc2a16f6a9cc..., diff 0.931 / 4000 MH)
[2022-01-07 19:58:53] GPU 0 DAG generation finished in 8.302 seconds.
[2022-01-07 19:58:53] Pool eth-se.flexpool.io received new job. (job_id: 0x0f8516782ab..., diff 0.931 / 4000 MH)
[2022-01-07 19:58:55] GPU 5 DAG generation finished in 10.506 seconds.
[2022-01-07 19:58:55] GPU 7 DAG generation finished in 10.571 seconds.

与 Ubuntu 不同,HiveOS 环境中 clinfo 的输出显示平台数量为 2:

Number of platforms:                             2
  Platform Profile:                              FULL_PROFILE
  Platform Version:                              OpenCL 2.1 AMD-APP (3180.7)
  Platform Name:                                 AMD Accelerated Parallel Processing
  Platform Vendor:                               Advanced Micro Devices, Inc.
  Platform Extensions:                           cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
  Platform Profile:                              FULL_PROFILE
  Platform Version:                              OpenCL 2.1 AMD-APP (3180.7)
  Platform Name:                                 AMD Accelerated Parallel Processing
  Platform Vendor:                               Advanced Micro Devices, Inc.
  Platform Extensions:                           cl_khr_icd cl_amd_event_callback cl_amd_offline_devices


  Platform Name:                                 AMD Accelerated Parallel Processing
Number of devices:                               3
  Device Type:                                   CL_DEVICE_TYPE_GPU
  Vendor ID:                                     1002h
  Board name:                                    AMD Radeon RX 5600 XT
  Device Topology:                               PCI[ B#15, D#0, F#0 ]
  Max compute units:                             18
  Max work items dimensions:                     3
    Max work items[0]:                           1024
    Max work items[1]:                           1024
    Max work items[2]:                           1024
  Max work group size:                           256
  Preferred vector width char:                   4
  Preferred vector width short:                  2
  Preferred vector width int:                    1
  Preferred vector width long:                   1
  Preferred vector width float:                  1
  Preferred vector width double:                 1
  Native vector width char:                      4
  Native vector width short:                     2
  Native vector width int:                       1
  Native vector width long:                      1
  Native vector width float:                     1
  Native vector width double:                    1
  Max clock frequency:                           1100Mhz
  Address bits:                                  64
  Max memory allocation:                         5233652531
  Image support:                                 Yes
  Max number of images read arguments:           128
  Max number of images write arguments:          64
  Max image 2D width:                            16384
  Max image 2D height:                           16384
  Max image 3D width:                            2048
  Max image 3D height:                           2048
  Max image 3D depth:                            2048
  Max samplers within kernel:                    16
  Max size of kernel argument:                   1024
  Alignment (bits) of base address:              2048
  Minimum alignment (bytes) for any datatype:    128
  Single precision floating point capability
    Denorms:                                     Yes
    Quiet NaNs:                                  Yes
    Round to nearest even:                       Yes
    Round to zero:                               Yes
    Round to +ve and infinity:                   Yes
    IEEE754-2008 fused multiply-add:             Yes
  Cache type:                                    Read/Write
  Cache line size:                               64
  Cache size:                                    16384
  Global memory size:                            6425673728
  Constant buffer size:                          5233652531
  Max number of constant args:                   8
  Local memory type:                             Scratchpad
  Local memory size:                             65536
  Max pipe arguments:                            16
  Max pipe active reservations:                  16
  Max pipe packet size:                          938685235
  Max global variable size:                      4710287104
  Max global variable preferred total size:      6425673728
  Max read/write image args:                     64
  Max on device events:                          1024
  Queue on device max size:                      8388608
  Max on device queues:                          1
  Queue on device preferred size:                262144
  SVM capabilities:
    Coarse grain buffer:                         Yes
    Fine grain buffer:                           Yes
    Fine grain system:                           No
    Atomics:                                     No
  Preferred platform atomic alignment:           0
  Preferred global atomic alignment:             0
  Preferred local atomic alignment:              0
  Kernel Preferred work group size multiple:     32
  Error correction support:                      0
  Unified memory for Host and Device:            0
  Profiling timer resolution:                    1
  Device endianess:                              Little
  Available:                                     Yes
  Compiler available:                            Yes
  Execution capabilities:
    Execute OpenCL kernels:                      Yes
    Execute native function:                     No
  Queue on Host properties:
    Out-of-Order:                                No
    Profiling :                                  Yes
  Queue on Device properties:
    Out-of-Order:                                Yes
    Profiling :                                  Yes
  Platform ID:                                   0x7f1c158a6f30
  Name:                                          gfx1010
  Vendor:                                        Advanced Micro Devices, Inc.
  Device OpenCL C version:                       OpenCL C 2.0
  Driver version:                                3180.7 (PAL,LC)
  Profile:                                       FULL_PROFILE
  Version:                                       OpenCL 2.0 AMD-APP (3180.7)
  Extensions:                                    cl_khr_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_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_copy_buffer_p2p

[...]

  Platform Name:                                 AMD Accelerated Parallel Processing
Number of devices:                               5
  Device Type:                                   CL_DEVICE_TYPE_GPU
  Vendor ID:                                     1002h
  Board name:                                    Radeon RX 580 Series
  Device Topology:                               PCI[ B#4, D#0, F#0 ]
  Max compute units:                             36
  Max work items dimensions:                     3
    Max work items[0]:                           1024
    Max work items[1]:                           1024
    Max work items[2]:                           1024
  Max work group size:                           256
  Preferred vector width char:                   4
  Preferred vector width short:                  2
  Preferred vector width int:                    1
  Preferred vector width long:                   1
  Preferred vector width float:                  1
  Preferred vector width double:                 1
  Native vector width char:                      4
  Native vector width short:                     2
  Native vector width int:                       1
  Native vector width long:                      1
  Native vector width float:                     1
  Native vector width double:                    1
  Max clock frequency:                           1150Mhz
  Address bits:                                  64
  Max memory allocation:                         2902310502
  Image support:                                 Yes
  Max number of images read arguments:           128
  Max number of images write arguments:          8
  Max image 2D width:                            16384
  Max image 2D height:                           16384
  Max image 3D width:                            2048
  Max image 3D height:                           2048
  Max image 3D depth:                            2048
  Max samplers within kernel:                    16
  Max size of kernel argument:                   1024
  Alignment (bits) of base address:              2048
  Minimum alignment (bytes) for any datatype:    128
  Single precision floating point capability

[...]

有人可以建议如何配置 amdgpu pro 驱动程序,以便在 ubuntu 中运行的 teamredminer 可以检测到 navi 卡的 OpenCL 平台吗?

提前致谢!

相关内容