-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_benchmarks.jl
59 lines (51 loc) · 1.47 KB
/
run_benchmarks.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const doc = """run_benchmarks.jl -- multithreaded benchmarks test harness
Usage:
run_benchmarks.jl (scaling|comparative|misc) [<name>] [options]
run_benchmarks.jl -h | --help
run_benchmarks.jl --version
Options:
-n <runs>, --runs=<runs> Number of runs for each benchmark [default: 5].
-s <max>, --scale=<max> Maximum number of threads for scaling [default: 8].
-h, --help Show this screen.
--version Show version.
"""
using DocOpt
using UnicodePlots
using BenchmarkTools
const args = docopt(doc, version = v"0.0.1")
const JULIAVER = Base.julia_cmd()[1]
function run_benches(bench::String, args)
@show bench
local runs = parse(Int, args["--runs"])
local max = parse(Int, args["--scale"])
local n = 0
while true
threads = 2^n
threads > max && break
@show threads
for run in 1:runs
@show run
result = read(`$JULIAVER --project --threads=$threads $bench`)
@show result
end
n += 1
end
end
function run_benches(::Nothing, args)
for bench in filter(f -> endswith(f, ".jl"), readdir())
run_benches(bench, args)
end
end
function main(args)
cd(joinpath(@__DIR__, "benches"))
# select benchmark class
if args["scaling"]
cd("scaling")
elseif args["comparative"]
cd("comparative")
else # args["misc"]
cd("misc")
end
run_benches(args["<name>"], args)
end
main(args)