Skip to content

Commit 706c026

Browse files
committed
Update benchmark script to target core2
This more closely matches the conditions the scripts will run on
1 parent f9d52c5 commit 706c026

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

run_benchmarks.jl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using DeepDiffs
22
using TimerOutputs
33

4-
verify = "verify" in ARGS
5-
num_threads = 4
4+
const VERIFY = "verify" in ARGS
5+
const NUM_THREADS = 4
6+
const CPU_TARGET = "core2"
67

78
struct Benchmark
89
name::String
@@ -26,36 +27,38 @@ const BENCHMARKS = [
2627
]
2728

2829
function run_benchmarks()
29-
verify && println("VERIFYING!")
30+
VERIFY && println("VERIFYING!")
3031
errored = false
3132
result_file = "result.bin"
3233
TimerOutputs.reset_timer!()
3334
for benchmark in BENCHMARKS
34-
if !verify && benchmark.requires_fasta
35+
if !VERIFY && benchmark.requires_fasta
3536
if !isfile(joinpath(@__DIR__, "fasta.txt"))
3637
fasta_gen = joinpath(@__DIR__, "fasta", "fasta.jl")
3738
@info "Generating fasta file"
3839
run(pipeline(`$(Base.julia_cmd()) $fasta_gen 25000000` ;stdout = "fasta.txt"))
3940
end
4041
end
4142
dir = benchmark.name
42-
_arg = verify ? benchmark.verify : benchmark.benchmark
43+
_arg = VERIFY ? benchmark.verify : benchmark.benchmark
4344
println("Running $dir")
4445
bdir = joinpath(@__DIR__, dir)
4546
arg, input = _arg isa String ? ("", "$(_arg)") : (string(_arg), "")
4647
@timeit dir begin
4748
for file in readdir(bdir)
4849
endswith(file, ".jl") || continue
4950
println(" $file:")
50-
withenv("JULIA_NUM_THREADS" => num_threads) do
51+
withenv("JULIA_NUM_THREADS" => NUM_THREADS) do
5152
if !isempty(input)
52-
cmd = pipeline(`$(Base.julia_cmd()) $(joinpath(bdir, file)) `; stdin=input, stdout = result_file)
53+
cmd = pipeline(`$(Base.julia_cmd()) --cpu-target=$CPU_TARGET $(joinpath(bdir, file))`;
54+
stdin=input, stdout = result_file)
5355
else
54-
cmd = pipeline(`$(Base.julia_cmd()) $(joinpath(bdir, file)) $(arg)`; stdout = result_file)
56+
cmd = pipeline(`$(Base.julia_cmd()) --cpu-target=$CPU_TARGET $(joinpath(bdir, file)) $(arg)`;
57+
stdout = result_file)
5558
end
5659
@timeit file run(cmd)
5760
end
58-
if verify
61+
if VERIFY
5962
bench_output = read(result_file, String)
6063
correct_output = read(joinpath(bdir, string(dir, "-output.txt")), String)
6164
if bench_output != correct_output
@@ -74,4 +77,4 @@ function run_benchmarks()
7477
end
7578
end
7679

77-
run_benchmarks()
80+
run_benchmarks()

0 commit comments

Comments
 (0)