问题
Suppose we have AMD GPU (for example Radeon HD 7970) and minimal linux system without X and etc.
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.
Requirements to environment:
- GPU visible by OpenCL programs (
clinfo
for example) - It is possible to monitor temperature and set fan speed (for example using
aticonfig
).
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 When you use AMD GPU on linux, OpenCL applications don't see AMD GPU if Xserver isn't launched.
回答1:
I had similar problem, asked a question and had succeed solving it by myself. For R9 290 cards and newer i assume you have:
- 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.
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.
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
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. 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
来源:https://stackoverflow.com/questions/18359683/opencl-minimal-configuration-to-work-with-amd-gpu