Skip to content

Conversation

@k0kubun
Copy link
Member

@k0kubun k0kubun commented Sep 11, 2024

After yjit-bench disables Turbo Boost, it becomes slower to build Ruby and run tests. To avoid that, I want to re-enable Turbo Boost at exit.

@maximecb maximecb merged commit f2b3c35 into ruby:main Sep 11, 2024
check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'") unless turbo || intel_no_turbo?
unless intel_no_turbo? || turbo
check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'")
at_exit { check_call("sudo -S sh -c 'echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'", quiet: true) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better to not make it quiet here to let the user understand why e.g. the sudo password is asked again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fair. Feel free to file a PR for it, but so far the 15-minute sudo timeout has been long enough for me to never encounter the situation when running benchmarks locally.

at_exit { check_call("sudo -S sh -c 'echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'", quiet: true) }
end
# Disabling Turbo Boost reduces the CPU frequency, so this should be run after that.
check_call("sudo -S sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'") unless intel_perf_100pct?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and sudo -S cpupower frequency-set -g performance below should probably also be undone then, otherwise they might e.g. consume a lot more power.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean you've been fine with it so far, so it should be fine. I just kept the code simple by not introducing what I don't need. I'm personally not interested in lowering power consumption, but if you're, feel free to file a PR to change it.

@k0kubun k0kubun deleted the re-enable-turbo branch September 11, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants