如何使用开源驱动程序在AMD videocard上设置OpenCL?

use*_*980 12 opencl mesa

我已经阅读了这个链接 - https://wiki.debian.org/ru/AtiHowTo 并决定设置OpenCL.

r600g驱动程序仍然需要将专用微码加载到GPU中以实现硬件加速.该固件通常包含在内核中,但在Debian中单独打包.

所以,我安装了固件:

# apt-show-versions firmware-linux-nonfree firmware-linux
firmware-linux-nonfree:all/sid 0.40 uptodate
firmware-linux:all/sid 0.40 uptodate
Run Code Online (Sandbox Code Playgroud)

然后我升级内核版本:

uname -v
#1 SMP PREEMPT RT Debian 3.12.8-1 (2014-01-19)
Run Code Online (Sandbox Code Playgroud)

并检查内核标志:

grep DRM_RADEON /boot/config-$(uname -r)
CONFIG_DRM_RADEON=m
# CONFIG_DRM_RADEON_UMS is not set
grep AGP /boot/config-$(uname -r)
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
CONFIG_AGP_SIS=y
CONFIG_AGP_VIA=y
Run Code Online (Sandbox Code Playgroud)

另外我最近设置了xserver版本:

# apt-show-versions xorg
xorg:amd64/sid 1:7.7+5 uptodate
Run Code Online (Sandbox Code Playgroud)

我选择radeon作为驱动程序:

你肯定使用的是wheezy的xserver-xorg-core,它不再提供xorg-video-abi-6.0,radeonhd不适用于较新的xorg-video-abi,因为它已从Debian中删除

# apt-show-versions xserver-xorg-video-radeon
xserver-xorg-video-radeon:amd64/sid 1:7.3.0-1 uptodate
Run Code Online (Sandbox Code Playgroud)

这给了我OpenGL工作:

$ glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV770
OpenGL core profile version string: 3.1 (Core Profile) Mesa 10.1.0-devel (git-81144c0 saucy-oibaf-ppa+curaga)
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.0-devel (git-81144c0 saucy-oibaf-ppa+curaga)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用适用于OpenCL的应用程序.

这个程序在CPU上运行正常:

$ mono scallion/bin/Debug/scallion.exe parallax
Cooking up some delicions scallions...
Putting 1 patterns into 1 buckets.
Using kernel optimized from file kernel.cl (Optimized4)
Using work group size 1
Compiling kernel... done.
LoopIteration:10  HashCount:167.77MH  Speed:7.8MH/s  Runtime:00:00:21
Predicted:19:38:20
Stopping and shutting down...

LoopIteration:11  HashCount:184.55MH  Speed:7.8MH/s  Runtime:00:00:23
Predicted:19:36:58  init: 2687ms / 1 (2687ms, 0.37/s)
generate key: 153ms / 6 (25.5ms, 39.22/s)
cpu precompute: 7ms / 6 (1.17ms, 857.14/s)
total without init: 23706ms / 1 (23706ms, 0.04/s)
set buffers: 0ms / 11 (0ms, 0/s)
write buffers: 0ms / 11 (0ms, 0/s)
read results: 23699ms / 11 (2154.45ms, 0.46/s)
check results: 0ms / 11 (0ms, 0/s)

7.78 million hashes per second

Stopping and shutting down...
Run Code Online (Sandbox Code Playgroud)

但是我无法检测到GPU:

$ mono scallion/bin/Debug/scallion.exe
Usage: scallion [OPTIONS]+ regex [regex]+
Options:
      -l, --listdevices          Lists the devices that can be used.
      -d, --device=VALUE         Specifies the opencl device that should be used.
Run Code Online (Sandbox Code Playgroud)

设备列表中没有GPU:

$ mono scallion/bin/Debug/scallion.exe -l
Id:0 Name:Intel(R) Core(TM)2 Quad CPU    Q9650  @ 3.00GHz
    PreferredGroupSizeMultiple:1 ComputeUnits:4 ClockFrequency:2000
    MaxConstantBufferSize:65536 MaxConstantArgs:8 MaxMemAllocSize:2147483648
Run Code Online (Sandbox Code Playgroud)

我无法找到有关如何设置OpenCL的说明:

apt-get install libclc-r600

apt-show-versions libclc-r600 ocl-icd-libopencl1
libclc-r600:all/saucy 0~git20140101-1~gd~s uptodate
ocl-icd-libopencl1:amd64/sid 2.1.3-2 uptodate
Run Code Online (Sandbox Code Playgroud)

并在启动应用程序后收到错误:

~/github.com/lachesis/scallion$ mono ./scallion/bin/Debug/scallion.exe -l

Unhandled Exception:
System.InvalidOperationException: ErrorCode:'-1001'
at scallion.CLDeviceInfo.CheckError (Int32 err) [0x00000] in :0
at scallion.CLDeviceInfo.GetPlatformIds () [0x00000] in :0
at scallion.CLDeviceInfo.GetDeviceIds () [0x00000] in :0
at scallion.CLRuntime.GetDevices () [0x00000] in :0
at scallion.Program.ListDevices () [0x00000] in :0
at scallion.Program.Main (System.String[] args) [0x00000] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException:
ErrorCode:'-1001'
at scallion.CLDeviceInfo.CheckError (Int32 err) [0x00000] in :0
at scallion.CLDeviceInfo.GetPlatformIds () [0x00000] in :0
at scallion.CLDeviceInfo.GetDeviceIds () [0x00000] in :0
at scallion.CLRuntime.GetDevices () [0x00000] in :0
at scallion.Program.ListDevices () [0x00000] in :0
at scallion.Program.Main (System.String[] args) [0x00000] in :0
Run Code Online (Sandbox Code Playgroud)

错误代码值在opencl.h中定义.看起来您的平台配置不正确.来自clGetPlatformIDs的CL_PLATFORM_NOT_FOUND_KHR(-1001)错误.那是因为你确实有调度员,但没有实际的OpenCL驱动程序."

sudo apt-get install libopencl1-mesa

$ find / -iname «libMesaOpenCL.so*» 2>/dev/null
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
Run Code Online (Sandbox Code Playgroud)

在配置文件中应该有

cat /etc/OpenCL/vendors/mesa.icd
libMesaOpenCL.so
Run Code Online (Sandbox Code Playgroud)

错误是

fatal error: cannot open file '/usr/lib/clc/rv770-r600--.bc': No such file or directory
Run Code Online (Sandbox Code Playgroud)

如何使这项工作?

J. *_*ker 5

我最终启用了免费的OpenCL堆栈,并遇到了非常类似的问题.我将提供一些相关软件包的简要概述.

libopencl1-mesa只是ICD运行时,它被加载到泛型中ocl-icd-libopencl1.然后libclc用于libopencl1-mesa处理OpenCL内核.使用LLVM芯片组特定后端,libclc生成指令.你错过了GPU芯片组特定的胶水,这是由缺少的.bc.这是大大简化了,但对于这个问题它应该足够了,仍然一个好的图表将有很大帮助.

在你的特定例子中,.bc将提供的libclc-r600是在我的Freedesktop.org GalliumCompute页面上,我没有看到你的芯片组'DONE'的任何内容.看来支持最低的芯片组是Evergreen(HD5000系列).

*请重新检查GalliumCompute如果你2014年2月4日以后阅读.


Rom*_*yan 1

不确定“非自由”驱动程序是否开源。

然后,如果你看一下:

OpenGL renderer string: Gallium 0.4 on AMD RV770
Run Code Online (Sandbox Code Playgroud)

看起来 Gallium LLVM 是用来渲染的(不是原生 GPU),所以不能保证 OpenGL 是由 GPU 加速的。无论如何,如果您使用非自由驱动程序,我的建议是从 AMD 网站下载最新的驱动程序并使用它们,而不是当前安装的驱动程序。

另外,最近的 AMD APP SDK(从 2.8 开始,如果我没记错的话)与 GPU 驱动程序分开提供,因此您可以尝试使用它而不是打开软件包。它至少可以在 Ubuntu 12.04 上运行(来自存储库的 AMD 驱动程序 + 来自 AMD 网站的 AMD APP SDK)

  • 您将 LLVMpipe 软件渲染器与 Gallium 混淆了,它只是众多可能的 Gallium 渲染器之一,在本例中他使用的是 GPU。这由“AMD RV770 上的镓 0.4”表示,在我的上它显示“AMD REDWOOD 上的镓 0.4”。当使用 LLVMpipe 软件渲染时,它会读取“Gallium 0.4 on llvmpipe” (3认同)