问题描述
假设我们拥有AMD GPU(例如Radeon HD 7970)和没有X等的最小Linux系统.
Suppose we have AMD GPU (for example Radeon HD 7970) and minimal linux system without X and etc.
要具有适当的OpenCL环境,应该安装什么,应该启动什么以及如何启动它?最好是在没有头的环境中.
What should be installed and what should be launched and how it should be launched to have proper OpenCL environment? In best case it should be headless environment.
环境要求
- OpenCL程序可见的GPU(例如
clinfo
) - 可以监视温度并设置风扇速度(例如,使用
aticonfig
).
- GPU visible by OpenCL programs (
clinfo
for example) - It is possible to monitor temperature and set fan speed (for example using
aticonfig
).
P.S.简单安装Xserver,催化剂并运行X :0
将无法正常工作.参见 X精确地49次访问X服务器后,带有fglrx驱动程序的服务器将没有响应
P.S. Simple install Xserver, catalyst and run X :0
won't work properly. See X server with fglrx driver won't responce after exactly 49 accesses to X server
UPD 在Linux上使用AMD GPU时,如果未启动Xserver,则OpenCL应用程序不会看到AMD GPU.
UPD When you use AMD GPU on linux, OpenCL applications don't see AMD GPU if Xserver isn't launched.
推荐答案
我遇到了类似的问题,提出了一个问题,并且.对于R9 290卡及更高版本,我认为您拥有:
I had similar problem, asked a question and had succeed solving it by myself.For R9 290 cards and newer i assume you have:
- 内置内核4.14或更高版本,并具有amdgpu驱动程序支持.在Linux内核配置中的图形支持"下有一个选项.
- 所有必要的固件.bin blob均已合并.为了轻松实现,您可以编辑buildroot的
buildroot/package/linux-firmware/*
内容,然后自己手动添加BR2_PACKAGE_LINUX_FIRMWARE_AMDGPU
选项以及BR2_PACKAGE_LINUX_FIRMWARE_RADEON
(将其用作模板).实际上,我们应该将该更新发布到他们的git中.
- Built kernel 4.14 or later, with amdgpu driver support. There is option in linux kernel config under Graphics Support.
- All nesesary firmware .bin blobs are incorporated. To do so easily you may edit
buildroot/package/linux-firmware/*
contents for buildroot, and manually addBR2_PACKAGE_LINUX_FIRMWARE_AMDGPU
option by yourself, along withBR2_PACKAGE_LINUX_FIRMWARE_RADEON
(use it as a template). Actually we should post that update to their git.
启动时,每个适配器上都应显示有关amdgpu初始化的适当dmesg消息.然后应切换屏幕模式.如果仍然看到较大的控制台文本,并且在初始化过程中未发生视频模式切换,则说明内核/固件存在问题,应首先解决此问题.
When booting you should see appropriate dmesg messages about amdgpu initializing, per each adapter. And screen mode should be switched. If you still see large console text and no videomode switch occured during init then you have problem in kernel/firmware, you should fix that out first.
要回答第二个问题,可以通过powerplay文件系统来控制风扇的速度/温度,例如/sys/class/drm/..
To answer second question, controlling fan speeds/temperatures is achieved via powerplay filesystem, eg /sys/class/drm/.. like this:
cd sys/class/drm/card0/device/hwmon/hwmon0
echo 1 > pwm1_enable
cat pwm1_max > pwm1
您可能会更深入一点,并在设备文件夹中的附近找到powertune参数.但是我强烈建议不要使用/sys/class/drm/card0/device/pp_dpm_sclk
,直接在卡的BIOS中刷新该值.设置所需的频率/电压,因为它更可靠,更稳定且与api无关-您可以启动它,也可以不启动它:)
You may dig a bit deeper and find powertune parameters nearby, in device folder.But instead of using /sys/class/drm/card0/device/pp_dpm_sclk
i highly recommend flashing that values directly in cards' bios. Set with required frequencies/voltages, as it is more reliable, stable and api independent - you either init it, or not :)
PS.还收起了7970,买了一些新的东西.我不知道最新的驱动程序是否仍然支持它,我们现在还没有手动使用过这种旧卡.我测试了290、390、480、580卡系列. (对于R9 270,矿工无法构建cl代码).对于较旧的卡,最好使用一些较旧的软件< = 16.40,也许还可以使用较旧的内核< = 4.13
PS. Also put away 7970, buy something a bit newer. I dont know if it is still supported in the latest drivers, we havent such an old card by hands right now. I tested 290, 390, 480, 580 cards series. (for R9 270, miner fails to build cl code). For older cards better to use some older software <=16.40 and maybe a bit older kernel <=4.13
这篇关于OpenCl:最低配置可与AMD GPU配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!