-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc3eb7f
commit 300ddcf
Showing
2 changed files
with
33 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,35 @@ | ||
using BenchmarkTools | ||
|
||
const GPU_BACKENDS = ["AMDGPU", "CUDA", "Metal", "oneAPI"] | ||
const NUM_CPU_THREADS = [1, 2, 4, 8] | ||
using JSON | ||
|
||
const RESULTS = BenchmarkGroup() | ||
const MEMORY_RESULTS = Dict{String, Dict{String, Float64}}() | ||
|
||
# Aggregate CPU results | ||
for n in NUM_CPU_THREADS | ||
filename = string("CPUbenchmarks", n, "threads.json") | ||
filepath = joinpath(@__DIR__, "results", filename) | ||
if ispath(filepath) | ||
nthreads_results = BenchmarkTools.load(filepath)[1] | ||
for benchmark in keys(nthreads_results) | ||
if !haskey(RESULTS, benchmark) | ||
RESULTS[benchmark] = BenchmarkGroup() | ||
end | ||
for size in keys(nthreads_results[benchmark]) | ||
if !haskey(RESULTS[benchmark], size) | ||
RESULTS[benchmark][size] = BenchmarkGroup() | ||
end | ||
for algorithm in keys(nthreads_results[benchmark][size]) | ||
if !haskey(RESULTS[benchmark][size], algorithm) | ||
RESULTS[benchmark][size][algorithm] = BenchmarkGroup() | ||
end | ||
if !haskey(RESULTS[benchmark][size][algorithm], "CPU") | ||
RESULTS[benchmark][size][algorithm]["CPU"] = BenchmarkGroup() | ||
end | ||
RESULTS[benchmark][size][algorithm]["CPU"][string(n, " thread(s)")] = | ||
nthreads_results[benchmark][size][algorithm]["CPU"][string(n, " thread(s)")] | ||
end | ||
end | ||
end | ||
else | ||
@warn "No CPU benchmark file found at path: $(filepath)" | ||
# Load CPU benchmarks | ||
for threads in [1, 4] | ||
filename = joinpath(@__DIR__, "results", string("CPUbenchmarks", threads, "threads.json")) | ||
if isfile(filename) | ||
RESULTS["CPU_$(threads)thread"] = BenchmarkTools.load(filename)[1] | ||
end | ||
end | ||
|
||
# Aggregate GPU results | ||
for backend in GPU_BACKENDS | ||
filename = string(backend, "benchmarks.json") | ||
filepath = joinpath(@__DIR__, "results", filename) | ||
if ispath(filepath) | ||
backend_results = BenchmarkTools.load(filepath)[1] | ||
for benchmark in keys(backend_results) | ||
if !haskey(RESULTS, benchmark) | ||
RESULTS[benchmark] = BenchmarkGroup() | ||
end | ||
for size in keys(backend_results[benchmark]) | ||
if !haskey(RESULTS[benchmark], size) | ||
RESULTS[benchmark][size] = BenchmarkGroup() | ||
end | ||
for algorithm in keys(backend_results[benchmark][size]) | ||
if !haskey(RESULTS[benchmark][size], algorithm) | ||
RESULTS[benchmark][size][algorithm] = BenchmarkGroup() | ||
end | ||
if !haskey(RESULTS[benchmark][size][algorithm], "GPU") | ||
RESULTS[benchmark][size][algorithm]["GPU"] = BenchmarkGroup() | ||
end | ||
RESULTS[benchmark][size][algorithm]["GPU"][backend] = | ||
backend_results[benchmark][size][algorithm]["GPU"][backend] | ||
end | ||
end | ||
end | ||
else | ||
@warn "No GPU benchmark file found at path: $(filepath)" | ||
# Load GPU benchmarks and memory info | ||
for backend in ["Metal", "CUDA", "AMDGPU", "oneAPI"] | ||
# Load timing benchmarks | ||
filename = joinpath(@__DIR__, "results", "$(backend)benchmarks.json") | ||
if isfile(filename) | ||
RESULTS[backend] = BenchmarkTools.load(filename)[1] | ||
end | ||
|
||
# Load memory info | ||
memory_filename = joinpath(@__DIR__, "results", "$(backend)_memory_info.json") | ||
if isfile(memory_filename) | ||
MEMORY_RESULTS[backend] = JSON.parsefile(memory_filename) | ||
end | ||
end | ||
|
||
# Save combined results | ||
mkpath(joinpath(@__DIR__, "results")) | ||
BenchmarkTools.save(joinpath(@__DIR__, "results", "combinedbenchmarks.json"), RESULTS) | ||
BenchmarkTools.save(joinpath(@__DIR__, "results", "combinedbenchmarks.json"), RESULTS) | ||
open(joinpath(@__DIR__, "results", "combined_memory_info.json"), "w") do io | ||
JSON.print(io, MEMORY_RESULTS) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters