-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RX] randomx linux booster script #2637
Merged
fireice-uk
merged 1 commit into
fireice-uk:xmr-stak-rx-dev
from
psychocrypt:ry-topic-bosterScriptLinux
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env bash | ||
# based on xmrig's randomx_boost.sh script | ||
# lifted by psychocrypt | ||
|
||
function help() | ||
{ | ||
echo "$(basename $0) modifies caching behaviors of your CPU" | ||
echo "and activates huge pages." | ||
echo "Reboot your system to revert the changes." | ||
echo "" | ||
echo "must be called with administrative privileges e.g. 'sudo $(basename $0)'" | ||
} | ||
|
||
if [ $# -ge 1 ] ; then | ||
help | ||
exit 1 | ||
fi | ||
|
||
hasAptGet=$(which apt-get >/dev/null && { echo 1; } || { echo 0; }) | ||
hasApt=$(which apt >/dev/null && { echo 1; } || { echo 0; }) | ||
hasYum=$(which yum >/dev/null && { echo 1; } || { echo 0; }) | ||
|
||
tools=$(which wrmsr >/dev/null || { echo "msr-tools "; })$(which numactl >/dev/null || { echo " numactl"; }) | ||
|
||
if [ -n "$tools" ] ; then | ||
echo "tool '$tools' not found, $(basename $0) is trying to install the dependency" | ||
if [ $hasAptGet -eq 1 ] ; then | ||
comm="apt-get --no-install-recommends --yes install $tools" | ||
echo "execute: $comm" | ||
$comm | ||
elif [ $hasApt -eq 1 ] ; then | ||
comm="apt-get --no-install-recommends --yes install $tools" | ||
echo "execute: $comm" | ||
$comm | ||
elif [ $hasYum -eq 1 ] ; then | ||
comm="yum install -y $tools" | ||
echo "execute: $comm" | ||
$comm | ||
else | ||
echo "package manager unknown, please install '$tools' by hand" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
hasWrmsr=$(which wrmsr >/dev/null && { echo 1; } || { echo 0; }) | ||
if [ $hasWrmsr -eq 0 ] ; then | ||
echo "dependency 'wrmsr' not found, tool failed" >&2 | ||
exit 1 | ||
fi | ||
|
||
hasNumactl=$(which numactl >/dev/null && { echo 1; } || { echo 0; }) | ||
if [ $hasNumactl -eq 0 ] ; then | ||
echo "dependency 'numactl' not found, tool failed" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "" | ||
modprobe msr | ||
|
||
if cat /proc/cpuinfo | grep -q "AMD Ryzen" ; | ||
then | ||
echo "Detected Ryzen" | ||
wrmsr -a 0xc0011022 0x510000 | ||
wrmsr -a 0xc001102b 0x1808cc16 | ||
wrmsr -a 0xc0011020 0 | ||
wrmsr -a 0xc0011021 0x40 | ||
echo "MSR register values for Ryzen applied" | ||
echo "Reboot your system to revert the changes." | ||
elif cat /proc/cpuinfo | grep -q "Intel" ; | ||
then | ||
echo "Detected Intel" | ||
wrmsr -a 0x1a4 7 | ||
echo "MSR register values for Intel applied" | ||
echo "Reboot your system to revert the changes." | ||
else | ||
echo "No supported CPU detected" | ||
fi | ||
|
||
echo "" | ||
|
||
### begin enable huge pages | ||
required_num_huge_pages=1280 | ||
num_huge_pages=$(cat /proc/meminfo | grep "HugePages_Free" | sed 's/ \{2,\}/ /g' | cut -d" " -f2) | ||
|
||
if [ $num_huge_pages -lt $required_num_huge_pages ] ; then | ||
echo "active 2 MiB pages" | ||
echo "execute: sysctl -w vm.nr_hugepages=$required_num_huge_pages" | ||
sysctl -w vm.nr_hugepages="$required_num_huge_pages" | ||
fi | ||
# verify number of huge pages | ||
num_huge_pages=$(cat /proc/meminfo | grep "HugePages_Free" | sed 's/ \{2,\}/ /g' | cut -d" " -f2) | ||
num_memsets=$((num_huge_pages/required_num_huge_pages)) | ||
|
||
if [ $num_memsets -eq 0 ] ; then | ||
echo "Error: not enough 2 MiB pages $num_huge_pages/$required_num_huge_pages" >&2 | ||
fi | ||
|
||
# apply gigabyte pages last because 2MiB pages will give more performance | ||
numNodes=$(numactl --hardware | grep available | cut -d" " -f2) | ||
freeGigPages=$(cat /sys/kernel/mm/hugepages/hugepages-1048576kB/free_hugepages) | ||
neededGigPages=$((numNodes * 3)) | ||
|
||
if [ $freeGigPages -lt $neededGigPages ] ; then | ||
echo "" | ||
echo "activate 1 GiB pages" | ||
comm="echo $neededGigPages > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages" | ||
echo "execute: $comm" | ||
echo "$neededGigPages" > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages | ||
fi | ||
### end enable huge pages | ||
|
||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non blocking comment - those numbers are correct only for gen1 zen cores. Some testing is needed as they will set collateral bits with unknown function on gen2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Numbers for C001_1020 and C001_1021 registers were taken from R7 3700X (Geekbench performance bias option in BIOS). Funny to see how you copy my work without any clue of what it does or how it was obtained :D AMD doesn't change MSR registers (at least these ones) within same family CPUs, and all Zen, Zen+ and Zen2 CPUs so far are family 17h.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, for the info
please stop craying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course I know - you copied it from RagerX. That's why you have 2 gen2 MSRs and 2 gen1 MSRs. If you don't stop rocking your arse off, we will ban you from this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG lol. I figured the last two values myself, and the first two were sent to me by xnbya who tested prefetcher options in BIOS on some other AM4 board (that I didn't have). Your RagerX is a joke. Have you even implemented MSR mod there yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this is the screenshot of #monero-pools IRC from December 11th (everyone with IRC logs can check it): https://imgur.com/a/cE5XqHE
This where I got the info about the first 2 MSR registers and then I figured out the other two on my own, testing my BIOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RagerX came out on the 9th -> see, it only works on people who are dumb enough not to fact-check you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it came out on the 9th and it didn't have MSR mod back then because I tested it and I didn't see anything faster than I already had with xmrig on windows (without the mod). Maybe It has MSR mod now (of course), but I don't really care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very convenient to claim you had something before XMRig without proof when everything RagerX is closed source and people have no way of checking it. You're a pathological liar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have been hanging out with pathological liars a bit too much.
https://medium.com/@crypto_ryo/senior-nasa-engineer-calls-out-howard-chu-hyc-symas-monero-developer-on-being-a-fraud-db0b46688041
But, hey, if "Look! I got this magic undocumented number of some guy on IRC. I totally don't know where it came from!!" is your story, that's your story.
Follow up question - do you think we would be dumb enough to put all our improvements at once :P. You will need to start looking harder for dodgy guys on IRC to find stuff for you =]