Enable custom prefix command from env var - #533
Open
rwstauner wants to merge 1 commit into
Open
Conversation
I setup my machine with the kernel options to isolate a cpu
and then I have a custom script that writes to the necessary files,
and I have NOPASSWD sudo commands setup for the commands in that file.
Then I can set this env var to that script and it runs
benchmarks specifically configured for my machine with no sudo prompt.
Example script:
#!/bin/bash
# sudoers
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/intel_pstate/no_turbo
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
# rwstauner ALL= NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/cpu*/online
# rwstauner ALL= NOPASSWD: /usr/bin/renice
# NOTE: add `isolcpus=10,11 nohz_full=10,11` to the options line in /boot/loader conf
cpu=10
sibling=11
sudo () {
command sudo --bell "$@"
}
teardown () {
echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo 8 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
echo 1 | sudo tee /sys/devices/system/cpu/cpu$sibling/online
}
setup () {
echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo 100 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
echo 0 | sudo tee /sys/devices/system/cpu/cpu$sibling/online
}
setup > /dev/null
trap 'teardown > /dev/null' EXIT
setarch x86_64 -R taskset -c $cpu sh -c 'sudo renice -n -15 "$$" > /dev/null; exec "$@"' - "$@"
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I setup my machine with the kernel options to isolate a cpu and then I have a custom script that writes to the necessary files, and I have NOPASSWD sudo commands setup for the commands in that file.
Then I can set this env var to that script and it runs benchmarks specifically configured for my machine with no sudo prompt.
Example script: