Skip to content

Commit

Permalink
Avoid pinning the CPU to the last core (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun authored Aug 15, 2024
1 parent 51396ba commit ca6b1c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion run_benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ def run_benchmarks(ruby:, ruby_description:, categories:, name_filters:, out_pat
# Pin the process to one given core to improve caching and reduce variance on CRuby
# Other Rubies need to use multiple cores, e.g., for JIT threads
if ruby_description.start_with?('ruby ') && !no_pinning
cmd += ["taskset", "-c", "#{Etc.nprocessors - 1}"]
# The last few cores of Intel CPU may be slow E-Cores, so avoid using the last one.
cpu = [(Etc.nprocessors / 2) - 1, 0].max
cmd += ["taskset", "-c", "#{cpu}"]
end
end

Expand Down

0 comments on commit ca6b1c6

Please sign in to comment.