AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1223032
Accepted
haxpor
haxpor
Asked: 2020-04-01 18:19:49 +0800 CST2020-04-01 18:19:49 +0800 CST 2020-04-01 18:19:49 +0800 CST

在 Ubuntu 19.10 上为 AMD GPU 安装 OpenCL 2.0 驱动程序?我有什么选择?

  • 772

我的主要目标是让 Blender 2.82a 能够检测到我系统的 GPU,然后用作 OpenCL 计算来加快渲染时间。

问题似乎是我的 Ubuntu 发行版本太高,因为我有 19.10 (with kernel 5.5.11-050511-lowlatency) + AMDGPU-PRO的 OpenCL 组件只能正式支持 Ubuntu 18.04,ROCm也是如此。

我确实尝试通过仅针对 OpenCL 组件的安装脚本(通过--headless)安装 AMDGPU-PRO 的 OpenCL,甚至手动安装一个包;都没有成功。如前所述,不支持显示在错误消息中。我想用 ROCm 再试一次,但它的包似乎很大。由于我的发行版没有可用的预构建包,我想它也会失败。

那么,如果回到 18.04 是为我的 GPU 安装 OpenCL 驱动程序(确切地说是来自 Ryzen 3 2200g 的 APU,我没有独立的 GPU)以及已经安装的开源 OpenGL/Vulkan 驱动程序的最后手段,我的选择是什么?梅萨?

编辑:

与此同时,我尽我所能通过libclang-common-10-dev libclc-amdgcn libclc-dev libclc-r600 libllvm10 mesa-opencl-icd包安装 OpenCL 1.1 来测试。它通过 显示有意义的信息clinfo。但是 Blender 仍然没有检测到任何 GPU 作为 OpenCL 设备。

更新 1:

我用 ROCm 进行了测试。有了来自这里和这里的良好报告,很明显 Ubuntu 发行版 19.10 应该不是问题,只需要一个合适的内核版本。因此,我将内核版本恢复为 5.3.x(特别是使用 5.3.18 通用版本,因为 5.3 被声明为 ROCm 的受支持版本,并且来自报告)。

请注意,我按照第二个报告链接中的说明最低限度地安装软件包,因为 ROCm 软件包很大,然后按照其 github 页面的 README.md 中的较少安装说明进行操作。虽然我在上eoan并且包裹来自xenial,但我现在确实承担了风险。都过去了。我可以通过验证clinfo或/opt/rocm-3.1.0/opencl/bin/x86_64/clinfo两者都给出有意义的结果,即我现在拥有 OpenCL 2.1但没有找到设备!!!。

结果来自clinfo

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3084.0)
  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                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  AMD Accelerated Parallel Processing
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  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)  No devices found in platform

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

结果来自/opt/rocm-3.1.0/opencl/bin/x86_64/clinfo

Number of platforms:                 1
  Platform Profile:              FULL_PROFILE
  Platform Version:              OpenCL 2.1 AMD-APP (3084.0)
  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
ERROR: clGetDeviceIDs(-1)

除了使用 Blender 进行测试之外,仍然没有检测到 GPU,这就是现在我遇到的设备未找到问题。

我正在进一步调查...

更新 2:

虽然性能不好,但问题解决了。请参阅下面我对这个问题的回答。

blender gpu opencl
  • 1 1 个回答
  • 8298 Views

1 个回答

  • Voted
  1. Best Answer
    haxpor
    2020-04-02T04:06:21+08:002020-04-02T04:06:21+08:00

    最后,我让它工作,这是clinfo(从 ROCm 捆绑的二进制文件)的结果。

    umber of platforms:              1
      Platform Profile:              FULL_PROFILE
      Platform Version:              OpenCL 2.1 AMD-APP (3004.6)
      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:               1
      Device Type:                   CL_DEVICE_TYPE_GPU
      Vendor ID:                     1002h
      Board name:                    Unknown AMD GPU
      Device Topology:               PCI[ B#7, D#0, F#0 ]
      Max compute units:                 8
      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:             1825361100
      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:                     No
        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:                7301444400
      Constant buffer size:              1825361100
      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:              1825361100
      Max global variable size:          1642824960
      Max global variable preferred total size:  7301444400
      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:     64
      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:             No
      Queue on Host properties:              
        Out-of-Order:                No
        Profiling :                  Yes
      Queue on Device properties:                
        Out-of-Order:                Yes
        Profiling :                  Yes
      Platform ID:                   0x7f6233d65f10
      Name:                      gfx902
      Vendor:                    Advanced Micro Devices, Inc.
      Device OpenCL C version:           OpenCL C 2.0 
      Driver version:                3004.6 (PAL,HSAIL)
      Profile:                   FULL_PROFILE
      Version:                   OpenCL 2.0 AMD-APP (3004.6)
      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
    

    让我们在这里赶上一点。现在我的系统是

    • 内核版本:5.3.18 通用
    • 图形 API:Mesa(最新版本很好)
    • aptOpenCL:2.1(通过 ROCm 3.1 或通过命令安装可能为您提供的任何版本) 。

    关键是在完成 ROCm 的安装之后。您必须下载最新的AMD 驱动程序。在我撰写本文时,它是 19.50 版,确切的链接是amdgpu-pro-19.50-967956-ubuntu-18.04.tar.xz。即使您像我的情况一样处于 19.10 版本,也不必担心 Ubuntu 发布版本,重要的可能是保持在内核 5.3.x 以确保适合 ROCm 和 AMD 驱动程序的安全性。

    然后你在这里使用/修改来自 tuxutku 的脚本。您可以像现在自己下载一样注释掉下载远程文件的行,然后在文件系统中对此类文件进行脱机操作。注意最后一个命令,它将结果文件复制到/. 您甚至可以评论该行并自己手动执行以确保安全。

    脚本的要点是我们并没有真正从 AMD 驱动程序包中安装任何东西,而只是获取共享库和一些配置文件,然后放入我们的系统中。ROCm 将与之交互。它涉及重命名共享库以避免冲突,以防您已经安装了工作 AMDGPU-PRO,因此这将隔离问题。

    请记住,/opt/OpenCL/vendors/amdocl64.icd它libamdocl64.so的内容是。我们已经复制了提取的.so文件,/因此它将引用它而不是 ROCm 的捆绑.so文件。如果您参考 ROCm,它将无法正常工作,并且会喊出找不到设备的错误。

    现在一切都完成了。您可以使用单独的二进制文件clinfo或从 ROCm 捆绑的二进制文件来验证所有内容,以检查一切是否顺利。

    最好有一些基于 OpenCL 的应用程序来测试它。我使用Phoronix 测试套件或pts/juliagpu测试pts/luxmarkOpenCL 的能力。对于 Blender,它检测并列出如下

    在此处输入图像描述

    选择第一个(未知)似乎是搅拌机的真正GPU,因为选择了第二个场景的“ GPU Compute”的设置Will Grey。

    在此处输入图像描述

    是的,您需要确保它没有变灰,以确保它是真正的 GPU 渲染。或者您可以radeontop在渲染场景时使用它来监视活动。

    最后,虽然它现在可以工作并且 Blender 检测到我的 GPU。但是当你点击渲染场景时,性能比以前使用延迟加载的 CPU 更差。此Blender 问题表明它仅正式支持专有驱动程序。因此,下一步将尝试纯粹使用 AMDGPU-PRO 并进行测试,但您必须努力在开源驱动程序和封闭驱动程序之间正确切换。

    更新:

    我总结了上述解决方案,并进行了一些改进,以便在此视频中轻松完成。

    • 1

相关问题

  • 使用 Nvidia 卡在 CPU 和 GPU 上进行 OpenCL 编程?

  • Blender3D 和 ATI 图形的问题 [关闭]

  • 如何在 Ubuntu 中超频显卡?

  • 如何获取 GPU 信息?

  • 是否有适用于最新 Blender 版本的 PPA?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve