Skip to content
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

Skip set_bench_config for Intel if already set #263

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions run_benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def have_yjit?(ruby)
def set_bench_config
if File.exist?('/sys/devices/system/cpu/intel_pstate') # Intel
# sudo requires the flag '-S' in order to take input from stdin
check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'")
check_call("sudo -S sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'")
check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'") unless intel_no_turbo?
check_call("sudo -S sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'") unless intel_perf_100pct?
elsif File.exist?('/sys/devices/system/cpu/cpufreq/boost') # AMD
check_call("sudo -S sh -c 'echo 0 > /sys/devices/system/cpu/cpufreq/boost'") unless amd_no_boost?
check_call("sudo -S cpupower frequency-set -g performance") unless performance_governor?
Expand All @@ -69,13 +69,13 @@ def set_bench_config

def check_pstate
if File.exist?('/sys/devices/system/cpu/intel_pstate') # Intel
if File.read('/sys/devices/system/cpu/intel_pstate/no_turbo').strip != '1'
unless intel_no_turbo?
puts("You forgot to disable turbo:")
puts(" sudo sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'")
exit(-1)
end

if File.read('/sys/devices/system/cpu/intel_pstate/min_perf_pct').strip != '100'
unless intel_perf_100pct?
puts("You forgot to set the min perf percentage to 100:")
puts(" sudo sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'")
exit(-1)
Expand All @@ -95,6 +95,14 @@ def check_pstate
end
end

def intel_no_turbo?
File.read('/sys/devices/system/cpu/intel_pstate/no_turbo').strip == '1'
end

def intel_perf_100pct?
File.read('/sys/devices/system/cpu/intel_pstate/min_perf_pct').strip == '100'
end

def amd_no_boost?
File.read('/sys/devices/system/cpu/cpufreq/boost').strip == '0'
end
Expand Down
Loading