使用ROCM在Ubuntu 18.04上不支持rx 470 / vega 8的OpenCL / HSA

时间:2019-05-19 14:53:22

标签: python tensorflow opencl ubuntu-18.04 amd-rocm

我按照以下说明在新安装的Ubuntu 18.04上安装了ROCm,ROCm-Tensorflow和PlaidML:

虽然两个GPU都被/opt/rocm/bin/rocminfo列出,但/opt/rocm/opencl/bin/x86_64/clinfoplaidml-setup却无法识别它们(下面的输出)。 导入tensorflow会引发以下错误:

>>> import tensorflow
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
HSA reported error!
 In file: unpinned_copy_engine.cpp
At line: 126
### HCC STATUS_CHECK Error: HSA_STATUS_ERROR_OUT_OF_RESOURCES (0x1008) at file:mcwamp_hsa.cpp line:1220
Aborted (core dumped)

Rocminfo列出了所有设备:

$ /opt/rocm/bin/rocminfo 
=====================    
HSA System Attributes    
=====================    
Runtime Version:         1.1
System Timestamp Freq.:  1000.000000MHz
Sig. Max Wait Duration:  18446744073709551615 (number of timestamp)
Machine Model:           LARGE                              
System Endianness:       LITTLE                             

==========               
HSA Agents               
==========               
*******                  
Agent 1                  
*******                  
  Name:                    AMD Ryzen 3 2200G with Radeon Vega Graphics
  Vendor Name:             CPU                                
  Feature:                 None specified                     
  Profile:                 FULL_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        0                                  
  Queue Min Size:          0                                  
  Queue Max Size:          0                                  
  Queue Type:              MULTI                              
  Node:                    0                                  
  Device Type:             CPU                                
  Cache Info:              
    L1:                      32KB                               
  Chip ID:                 5597                               
  Cacheline Size:          64                                 
  Max Clock Frequency (MHz):3850                               
  BDFID:                   2560                               
  Compute Unit:            4                                  
  Features:                None
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: KERNARG, FINE GRAINED
      Size:                    16776832KB                         
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Acessible by all:        TRUE                               
  ISA Info:                
    N/A                      
*******                  
Agent 2                  
*******                  
  Name:                    gfx902                             
  Vendor Name:             AMD                                
  Feature:                 KERNEL_DISPATCH                    
  Profile:                 FULL_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        128                                
  Queue Min Size:          4096                               
  Queue Max Size:          131072                             
  Queue Type:              MULTI                              
  Node:                    0                                  
  Device Type:             GPU                                
  Cache Info:              
    L1:                      16KB                               
  Chip ID:                 5597                               
  Cacheline Size:          64                                 
  Max Clock Frequency (MHz):1100                               
  BDFID:                   2560                               
  Compute Unit:            11                                 
  Features:                KERNEL_DISPATCH 
  Fast F16 Operation:      FALSE                              
  Wavefront Size:          64                                 
  Workgroup Max Size:      1024                               
  Workgroup Max Size Per Dimension:
    Dim[0]:                  67109888                           
    Dim[1]:                  167773184                          
    Dim[2]:                  0                                  
  Grid Max Size:           4294967295                         
  Waves Per CU:            160                                
  Max Work-item Per CU:    10240                              
  Grid Max Size per Dimension:
    Dim[0]:                  4294967295                         
    Dim[1]:                  4294967295                         
    Dim[2]:                  4294967295                         
  Max number Of fbarriers Per Workgroup:32                                 
  Pool Info:               
    Pool 1                   
      Segment:                 GROUP                              
      Size:                    64KB                               
      Allocatable:             FALSE                              
      Alloc Granule:           0KB                                
      Alloc Alignment:         0KB                                
      Acessible by all:        FALSE                              
  ISA Info:                
    ISA 1                    
      Name:                    amdgcn-amd-amdhsa--gfx902+xnack    
      Machine Models:          HSA_MACHINE_MODEL_LARGE            
      Profiles:                HSA_PROFILE_BASE                   
      Default Rounding Mode:   NEAR                               
      Default Rounding Mode:   NEAR                               
      Fast f16:                TRUE                               
      Workgroup Max Dimension: 
        Dim[0]:                  67109888                           
        Dim[1]:                  1024                               
        Dim[2]:                  16777217                           
      Workgroup Max Size:      1024                               
      Grid Max Dimension:      
        x                        4294967295                         
        y                        4294967295                         
        z                        4294967295                         
      Grid Max Size:           4294967295                         
      FBarrier Max Size:       32                                 
*******                  
Agent 3                  
*******                  
  Name:                    gfx803                             
  Vendor Name:             AMD                                
  Feature:                 KERNEL_DISPATCH                    
  Profile:                 BASE_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        128                                
  Queue Min Size:          4096                               
  Queue Max Size:          131072                             
  Queue Type:              MULTI                              
  Node:                    1                                  
  Device Type:             GPU                                
  Cache Info:              
    L1:                      16KB                               
  Chip ID:                 26591                              
  Cacheline Size:          64                                 
  Max Clock Frequency (MHz):1206                               
  BDFID:                   256                                
  Compute Unit:            32                                 
  Features:                KERNEL_DISPATCH 
  Fast F16 Operation:      FALSE                              
  Wavefront Size:          64                                 
  Workgroup Max Size:      1024                               
  Workgroup Max Size Per Dimension:
    Dim[0]:                  67109888                           
    Dim[1]:                  16778240                           
    Dim[2]:                  0                                  
  Grid Max Size:           4294967295                         
  Waves Per CU:            40                                 
  Max Work-item Per CU:    2560                               
  Grid Max Size per Dimension:
    Dim[0]:                  4294967295                         
    Dim[1]:                  4294967295                         
    Dim[2]:                  4294967295                         
  Max number Of fbarriers Per Workgroup:32                                 
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    4194304KB                          
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Acessible by all:        FALSE                              
    Pool 2                   
      Segment:                 GROUP                              
      Size:                    64KB                               
      Allocatable:             FALSE                              
      Alloc Granule:           0KB                                
      Alloc Alignment:         0KB                                
      Acessible by all:        FALSE                              
  ISA Info:                
    ISA 1                    
      Name:                    amdgcn-amd-amdhsa--gfx803          
      Machine Models:          HSA_MACHINE_MODEL_LARGE            
      Profiles:                HSA_PROFILE_BASE                   
      Default Rounding Mode:   NEAR                               
      Default Rounding Mode:   NEAR                               
      Fast f16:                TRUE                               
      Workgroup Max Dimension: 
        Dim[0]:                  67109888                           
        Dim[1]:                  1024                               
        Dim[2]:                  16777217                           
      Workgroup Max Size:      1024                               
      Grid Max Dimension:      
        x                        4294967295                         
        y                        4294967295                         
        z                        4294967295                         
      Grid Max Size:           4294967295                         
      FBarrier Max Size:       32                                 
*** Done ***

CLinfo:

$ /opt/rocm/opencl/bin/x86_64/clinfo 
Number of platforms:                 1
  Platform Profile:              FULL_PROFILE
  Platform Version:              OpenCL 1.2 pocl 1.1 None+Asserts, LLVM 6.0.0, SPIR, SLEEF, DISTRO, POCL_DEBUG
  Platform Name:                 Portable Computing Language
  Platform Vendor:               The pocl project
  Platform Extensions:               cl_khr_icd


  Platform Name:                 Portable Computing Language
Number of devices:               1
  Device Type:                   CL_DEVICE_TYPE_CPU
  Vendor ID:                     1022h
  Max compute units:                 4
  Max work items dimensions:             3
    Max work items[0]:               4096
    Max work items[1]:               4096
    Max work items[2]:               4096
  Max work group size:               4096
  Preferred vector width char:           16
  Preferred vector width short:          16
  Preferred vector width int:            8
  Preferred vector width long:           4
  Preferred vector width float:          8
  Preferred vector width double:         4
  Native vector width char:          16
  Native vector width short:             16
  Native vector width int:           8
  Native vector width long:          4
  Native vector width float:             8
  Native vector width double:            4
  Max clock frequency:               3850Mhz
  Address bits:                  64
  Max memory allocation:             4294967296
  Image support:                 Yes
  Max number of images read arguments:       128
  Max number of images write arguments:      128
  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:      1024
  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:                    4194304
  Global memory size:                12548460544
  Constant buffer size:              2097152
  Max number of constant args:           8
  Local memory type:                 Global
  Local memory size:                 2097152
  Kernel Preferred work group size multiple:     8
  Error correction support:          0
  Unified memory for Host and Device:        1
  Profiling timer resolution:            1
  Device endianess:              Little
  Available:                     Yes
  Compiler available:                Yes
  Execution capabilities:                
    Execute OpenCL kernels:          Yes
    Execute native function:             Yes
  Queue on Host properties:              
    Out-of-Order:                No
    Profiling :                  Yes
  Platform ID:                   0x7ff20df56020
  Name:                      pthread-AMD Ryzen 3 2200G with Radeon Vega Graphics
  Vendor:                    AuthenticAMD
  Device OpenCL C version:           OpenCL C 1.2 pocl
  Driver version:                1.1
  Profile:                   FULL_PROFILE
  Version:                   OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-znver1
  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_3d_image_writes cl_khr_spir cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

PlaidML:

$ plaidml-setup

PlaidML Setup (0.5.0)

Thanks for using PlaidML!

Some Notes:
  * Bugs and other issues: https://github.com/plaidml/plaidml
  * Questions: https://stackoverflow.com/questions/tagged/plaidml
  * Say hello: https://groups.google.com/forum/#!forum/plaidml-dev
  * PlaidML is licensed under the GNU AGPLv3

Default Config Devices:
   No devices.

Experimental Config Devices:
   llvm_cpu.0 : CPU (LLVM)

Using experimental devices can cause poor performance, crashes, and other nastiness.
...

系统信息:

  • AMD Ryzen 2200g,带有vega 8图形(iGPU)和AMD Radeon rx470(dGPU)
  • Ubuntu 18.04.2
  • 内核4.18.0-20(通用)
  • ROCm 2.4.25
  • Python 3.6.7
  • ROCm Tensorflow:1.13.3
  • PlaidML 0.5.0

2 个答案:

答案 0 :(得分:0)

参考ROCm文档,我相信rx470可以使用它,而iGPU vega 8则不能。 请参考此链接以获取更多信息。 https://rocm.github.io/hardware.html

答案 1 :(得分:0)

嗯,您的设置存在一个明显的问题:

  

平台数量:1

     

平台名称:便携式计算语言

     

平台供应商:pocl项目

     

设备类型:CL_DEVICE_TYPE_CPU

您仅安装了一个平台,而没有AMD的平台。 Ubuntu / Debian中的Pocl平台只能使用CPU。您需要为ROCm安装AMD的opencl软件包。描述here,但基本上是:

  

sudo apt-get install rocm-opencl-dev

应该工作。如果安装正确,clinfo输出中的“ Platform Vendor”将显示“ Advanced Micro Devices,Inc。”。