xmrig/scripts/randomx_boost.sh

37 lines
935 B
Bash
Raw Normal View History

#!/bin/sh -e
2019-12-12 17:25:28 +00:00
MSR_FILE=/sys/module/msr/parameters/allow_writes
2019-12-12 17:25:28 +00:00
if test -e "$MSR_FILE"; then
echo on > $MSR_FILE
else
modprobe msr allow_writes=on
fi
if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
2019-12-12 17:25:28 +00:00
then
if grep "cpu family[[:space:]]:[[:space:]]25" /proc/cpuinfo > /dev/null;
2020-11-12 14:55:27 +00:00
then
echo "Detected Zen3 CPU"
2020-11-12 14:55:27 +00:00
wrmsr -a 0xc0011020 0x4480000000000
wrmsr -a 0xc0011021 0x1c000200000040
wrmsr -a 0xc0011022 0xc000000401500000
wrmsr -a 0xc001102b 0x2000cc14
echo "MSR register values for Zen3 applied"
2020-11-12 14:55:27 +00:00
else
echo "Detected Zen1/Zen2 CPU"
2020-11-12 14:55:27 +00:00
wrmsr -a 0xc0011020 0
wrmsr -a 0xc0011021 0x40
wrmsr -a 0xc0011022 0x1510000
wrmsr -a 0xc001102b 0x2000cc16
echo "MSR register values for Zen1/Zen2 applied"
2020-11-12 14:55:27 +00:00
fi
elif grep "Intel" /proc/cpuinfo > /dev/null;
2019-12-12 17:25:28 +00:00
then
echo "Detected Intel CPU"
2020-01-12 02:42:48 +00:00
wrmsr -a 0x1a4 0xf
2019-12-12 17:25:28 +00:00
echo "MSR register values for Intel applied"
else
echo "No supported CPU detected"
fi