Skip to content

Commit de6ca3f

Browse files
Restructure the category selection
For benchmarks like the knucleotide ractor benchmark, which use Ractors internally so need to be included in the ractor benchmarks, but which must not use the ractor harness New category selection is as follows: - No category: Runs all benchmarks except those with `ractor_only: true`. Uses each benchmark's `default_harness`, falling back to the `default` harness. - `--category=ractor`: Runs benchmarks with ractor: true or `ractor_only: true`. Uses each benchmark's `default_harness`, falling back to `harness-ractor`. - `--category=ractor-only`: Runs only benchmarks with `ractor_only: true`. Uses each benchmark's `default_harness`, falling back to `harness-ractor`.
1 parent f15b04e commit de6ca3f

File tree

15 files changed

+183
-127
lines changed

15 files changed

+183
-127
lines changed

benchmarks.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ knucleotide:
9494
no_pinning: true
9595
knucleotide-ractor:
9696
desc: k-nucleotide from the Computer Language Benchmarks Game - counts nucleotide frequencies using hash tables in parallel using Ractors
97-
no_pinning: true
97+
ractor: true
98+
ractor_only: true
99+
default_harness: harness
98100
lee:
99101
desc: lee is a circuit-board layout solver, deployed in a plausibly reality-like way
100102
matmul:
@@ -235,11 +237,20 @@ throw:
235237
ractor: true
236238

237239
#
238-
# Ractor-only benchmarks
240+
# Ractor scaling benchmarks
239241
#
240-
ractor/gvl_release_acquire:
242+
gvl_release_acquire:
241243
desc: microbenchmark designed to test how fast the gvl can be acquired and released between ractors.
242-
ractor/json_parse_float:
244+
ractor: true
245+
ractor_only: true
246+
default_harness: harness-ractor
247+
json_parse_float:
243248
desc: test the performance of parsing multiple lists of json floats with ractors.
244-
ractor/json_parse_string:
249+
ractor: true
250+
ractor_only: true
251+
default_harness: harness-ractor
252+
json_parse_string:
245253
desc: test the performance of parsing multiple lists of strings with ractors.
254+
ractor: true
255+
ractor_only: true
256+
default_harness: harness-ractor
File renamed without changes.
File renamed without changes.

burn_in.rb

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,10 @@ def free_file_path(parent_dir, name_prefix)
5959
end
6060
end
6161

62-
def run_benchmark(bench_id, no_yjit, logs_path, run_time, ruby_version)
63-
# Determine the path to the benchmark script
64-
bench_name = bench_id.sub('ractor/', '')
65-
bench_dir, harness = if bench_name == bench_id
66-
['benchmarks', 'harness']
67-
else
68-
['benchmarks-ractor', 'harness-ractor']
69-
end
62+
def run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version, metadata)
63+
bench_dir = 'benchmarks'
64+
entry = metadata[bench_name] || {}
65+
harness = entry.fetch('default_harness', 'harness')
7066

7167
script_path = File.join(bench_dir, bench_name, 'benchmark.rb')
7268
if not File.exist?(script_path)
@@ -153,12 +149,12 @@ def run_benchmark(bench_id, no_yjit, logs_path, run_time, ruby_version)
153149
return false
154150
end
155151

156-
def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
152+
def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version, metadata)
157153
error_found = false
158154

159155
while true
160156
bench_name = bench_names.sample()
161-
error = run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version)
157+
error = run_benchmark(bench_name, no_yjit, logs_path, run_time, ruby_version, metadata)
162158
error_found ||= error
163159

164160
if error_found
@@ -201,12 +197,16 @@ def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
201197
bench_names = []
202198

203199
if args.categories.include?('ractor-only')
204-
# Only include benchmarks with ractor/ prefix (from benchmarks-ractor directory)
205-
bench_names = metadata.keys.select { |name| name.start_with?('ractor/') }
200+
# Include only benchmarks with ractor_only: true
201+
metadata.each do |name, entry|
202+
if entry['ractor_only']
203+
bench_names << name
204+
end
205+
end
206206
elsif args.categories.include?('ractor')
207-
# Include both ractor/ prefixed benchmarks and those with ractor: true
207+
# Include benchmarks with ractor: true or ractor_only: true
208208
metadata.each do |name, entry|
209-
if name.start_with?('ractor/') || entry['ractor']
209+
if entry['ractor'] || entry['ractor_only']
210210
bench_names << name
211211
end
212212
end
@@ -221,10 +221,12 @@ def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
221221
end
222222
end
223223
else
224-
# Regular category filtering
224+
# Regular category filtering - exclude ractor-only and ractor harness benchmarks
225225
metadata.each do |name, entry|
226226
category = entry.fetch('category', 'other')
227-
if args.categories.include?(category)
227+
is_ractor_only = entry['ractor_only'] ||
228+
(entry['ractor'] && entry['default_harness'] == 'harness-ractor')
229+
if args.categories.include?(category) && !is_ractor_only
228230
bench_names << name
229231
end
230232
end
@@ -237,7 +239,7 @@ def test_loop(bench_names, no_yjit, logs_path, run_time, ruby_version)
237239
args.num_procs.times do |i|
238240
pid = Process.fork do
239241
run_time = (i < args.num_long_runs)? (3600 * 2):10
240-
test_loop(bench_names, args.no_yjit, args.logs_path, run_time, ruby_version)
242+
test_loop(bench_names, args.no_yjit, args.logs_path, run_time, ruby_version, metadata)
241243
end
242244
end
243245

lib/argument_parser.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class ArgumentParser
88
:out_path,
99
:out_override,
1010
:harness,
11+
:harness_explicit,
1112
:yjit_opts,
1213
:categories,
1314
:name_filters,
@@ -93,6 +94,7 @@ def parse(argv)
9394
opts.on("--harness=HARNESS_DIR", "which harness to use") do |v|
9495
v = "harness-#{v}" unless v.start_with?('harness')
9596
args.harness = v
97+
args.harness_explicit = true
9698
end
9799

98100
opts.on("--warmup=N", "the number of warmup iterations for the default harness (default: 15)") do |n|
@@ -188,6 +190,7 @@ def default_args
188190
out_path: File.expand_path("./data"),
189191
out_override: nil,
190192
harness: "harness",
193+
harness_explicit: false,
191194
yjit_opts: "",
192195
categories: [],
193196
name_filters: [],

0 commit comments

Comments
 (0)