无法在 Ubuntu 20.04 中更改 amd GPU 和 Mem 时钟和电压

无法在 Ubuntu 20.04 中更改 amd GPU 和 Mem 时钟和电压

从 Ubuntu 18.04 LTS 升级到 Ubuntu 20.04 LTS 后,我无法再调整 Sapphire Radeon RX 580 Pulse 或 Sapphire Radeon RX 580 Nitro+ SE 的时钟和电压设置。更改风扇和功率限制没有问题。我使用的是 amdgpu 驱动程序 20.30-1109583。我尝试使用 amdgpu 驱动程序 20.20,但遇到了同样的问题。

我尝试手动完成此操作,使用 Bash 脚本、Wattman_GTK、amdgpu-clocks,并尝试使用 CoreCtrl(崩溃)。

我已将 /etc/default/grub 更改为包含:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amdgpu.ppfeaturemask=0xffffffff"

并尝试过

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.si_support=0 amdgpu.si_support=1 amdgpu.dpm=1 amdgpu.ppfeaturemask=0xffffffff"

这是我的 Bash 脚本:

#!/bin/bash
# Get path for card 1
card_path=`readlink -f /sys/class/drm/card1/device`

echo "Path for card: $card_path"
echo "Initial values for card:"
echo "Power limit: $(cat $card_path/hwmon/hwmon2/power1_cap)"
echo "Fan settings: $(cat $card_path/hwmon/hwmon2/pwm1)"
pwm1_max=`cat $card_path/hwmon/hwmon2/pwm1_max`
echo "pwm1_max: $pwm1_max"
echo "GPU and memory clocks and voltages"
echo "$(cat $card_path/power_dpm_force_performance_level)"
echo "$(cat $card_path/pp_od_clk_voltage)"
echo " "

# Set power limit

echo "Setting card power limit:"
echo 101000000 > $card_path/hwmon/hwmon2/power1_cap

echo " "

# Set GPU and mem clocks and voltages

echo "Setting GPU and Mem clocks and voltages:"
echo manual > $card_path/power_dpm_force_performance_level

echo 's 0 300 750' > $card_path/pp_od_clk_voltage
echo 's 1 751 793' > $card_path/pp_od_clk_voltage
echo 's 2 848 806' > $card_path/pp_od_clk_voltage
echo 's 3 858 812' > $card_path/pp_od_clk_voltage
echo 's 4 900 820' > $card_path/pp_od_clk_voltage
echo 's 5 1059 840' > $card_path/pp_od_clk_voltage
echo 's 6 1194 880' > $card_path/pp_od_clk_voltage
echo 's 7 1280 890' > $card_path/pp_od_clk_voltage

echo 'm 0 300 750' > $card_path/pp_od_clk_voltage
echo 'm 1 1000 800' > $card_path/pp_od_clk_voltage
echo 'm 2 2215 895' > $card_path/pp_od_clk_voltage

echo c > $card_path/pp_od_clk_voltage

# Set Fan
echo " "
echo "Setting Fan:"
echo 1 > $card_path/hwmon/hwmon2/pwm1_enable
pwr_prc=$((pwm1_max * 7/10))
echo "$pwr_prc"
echo $pwr_prc > $card_path/hwmon/hwmon2/pwm1



# Check values 

echo " "
echo "Check settings"
echo "Power limit: $(cat $card_path/hwmon/hwmon2/power1_cap)"
echo " "
echo "Fan settings: $(cat $card_path/hwmon/hwmon2/pwm1)"
echo " "
echo "Clocks and voltages: "
echo "$(cat $card_path/power_dpm_force_performance_level)"
echo "$(cat $card_path/pp_od_clk_voltage)"

使用运行脚本

sudo sh -c ./card1.sh

产量:

Initial values for card:
Power limit: 101000000
Fan settings: 173
pwm1_max: 255
GPU and memory clocks and voltages
manual
OD_SCLK:
0:        300MHz        750mV
1:        751MHz        793mV
2:       1048MHz       1006mV
3:       1158MHz       1112mV
4:       1240MHz       1150mV
5:       1309MHz       1150mV
6:       1364MHz       1150mV
7:       1430MHz       1150mV
OD_MCLK:
0:        300MHz        750mV
1:       1000MHz        800mV
2:       2100MHz        950mV
OD_RANGE:
SCLK:     300MHz       2000MHz
MCLK:     300MHz       2250MHz
VDDC:     750mV        1200mV
 
Setting card power limit:
 
Setting GPU and Mem clocks and voltages:
./card1.sh: line 28: echo: write error: Invalid argument
./card1.sh: line 29: echo: write error: Invalid argument
./card1.sh: line 30: echo: write error: Invalid argument
./card1.sh: line 31: echo: write error: Invalid argument
./card1.sh: line 32: echo: write error: Invalid argument
./card1.sh: line 33: echo: write error: Invalid argument
./card1.sh: line 34: echo: write error: Invalid argument
./card1.sh: line 35: echo: write error: Invalid argument
./card1.sh: line 37: echo: write error: Invalid argument
./card1.sh: line 38: echo: write error: Invalid argument
./card1.sh: line 39: echo: write error: Invalid argument
./card1.sh: line 41: echo: write error: Invalid argument
 
Setting Fan:
178
 
Check settings
Power limit: 101000000
 
Fan settings: 173
 
Clocks and voltages: 
manual
OD_SCLK:
0:        300MHz        750mV
1:        751MHz        793mV
2:       1048MHz       1006mV
3:       1158MHz       1112mV
4:       1240MHz       1150mV
5:       1309MHz       1150mV
6:       1364MHz       1150mV
7:       1430MHz       1150mV
OD_MCLK:
0:        300MHz        750mV
1:       1000MHz        800mV
2:       2100MHz        950mV
OD_RANGE:
SCLK:     300MHz       2000MHz
MCLK:     300MHz       2250MHz
VDDC:     750mV        1200mV

Wattman_GTK 和 amdgpu-clocks 也产生了错误:

write error: Invalid argument

使用运行脚本

$sudo sh card1.sh

给出的不是“echo:写入错误:无效参数”,

echo: echo: I/O error

当我尝试从命令行更改时钟和电压时也会发生这种情况:

$sudo echo 's 7 1280 895' > /sys/devices/pci0000:00/0000:00:1c.7/0000:0d:00.0/pp_od_clk_voltage

得出的结果是:

-bash: /sys/devices/pci0000:00/0000:00:1c.7/0000:0d:00.0/pp_od_clk_voltage: Permission denied

答案1

我在使用默认内核 (5.4) 时也遇到了同样的问题。将内核更新为 edge 内核 (linux-generic-hwe-20.04-edge) 后,问题就解决了。

答案2

这对我适用于 Radeon VII 20.04 和驱动程序 20.45

对于所有核心时钟级别改变:

echo 's 0 300 750' > $card_path/pp_od_clk_voltage

到:

echo 'vc 0 300 750' > $card_path/pp_od_clk_voltage

并且内存级别仅有一个最大频率设置,因此删除:

echo 'm 0 300 750' > $card_path/pp_od_clk_voltage
echo 'm 1 1000 800' > $card_path/pp_od_clk_voltage

并改变:

echo 'm 2 2215 895' > $card_path/pp_od_clk_voltage

到:

echo 'm 1 2215' > $card_path/pp_od_clk_voltage

答案3

我遇到了同样的问题,只需将双引号(“)更改为单引号(')即可。

IE更改:

echo "s 0 300 750" > /sys/class/drm/card0/device/pp_od_clk_voltage

到:

echo 's 0 300 750' > /sys/class/drm/card0/device/pp_od_clk_voltage

希望这可以帮助。

相关内容