Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first pass at benchmarks. need post-processing, formatting, dynamism.… #282

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .buildkite/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

pwd; hostname; date

if [ $# -ne 1 ]; then
echo "Usage: $0 VERSION"
echo "Example: $0 1.10.0"
exit 1
fi

VERSION=$1

module load julia/$VERSION

echo "Building documentation..."
julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.status(); Pkg.instantiate(); include("docs/make.jl")'
11 changes: 0 additions & 11 deletions .buildkite/jobscript.sh

This file was deleted.

27 changes: 9 additions & 18 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
env:
JULIA_VERSION: "1.10.2"
GATAS_HOME: "~/../../blue/fairbanksj/.gatas/bk/agents/$BUILDKITE_AGENT_NAME"

steps:

- label: ":hammer: Build Project"
env:
JULIA_DEPOT_PATH: "$GATAS_HOME"
command:
- "module load julia"
- "julia --project=docs --color=yes -e 'using Pkg; Pkg.update(); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile()'"

- wait

- label: ":scroll: Build docs and run tests"
- label: "Running benchmarks"
env:
JULIA_DEPOT_PATH: "$GATAS_HOME"
JULIA_PROJECT: "docs/"
command:
- "srun --cpus-per-task=16 --mem=64G --time=1:00:00 --output=.buildkite/log_%j.log --unbuffered .buildkite/jobscript.sh"
JULIA_PROJECT = "benchmarks/"
command: |
./benchmarks/scripts/main.sh

- wait

- label: ":arrow_down: Load AlgebraicJulia pipeline"
command: |
curl -s https://raw.githubusercontent.com/AlgebraicJulia/.github/main/buildkite/pipeline.yml | buildkite-agent pipeline upload

- wait
14 changes: 14 additions & 0 deletions .buildkite/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pwd; hostname; date

if [ $# -ne 1 ]; then
echo "Usage: $0 VERSION"
echo "Example: $0 1.10.0"
exit 1
fi

VERSION=$1

module load julia/$VERSION

echo "Running tests..."
julia --project -e "using Pkg; Pkg.status(); Pkg.test()"
2 changes: 0 additions & 2 deletions .buildkite/toolbox/.rsync-filter

This file was deleted.

Empty file removed .buildkite/toolbox/hpg.sh
Empty file.
6 changes: 0 additions & 6 deletions .buildkite/toolbox/srun.sh

This file was deleted.

41 changes: 0 additions & 41 deletions .buildkite/toolbox/to_hpg.sh

This file was deleted.

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.DS_Store
.ipynb_checkpoints
/Manifest.toml
**/Manifest.toml
/dev/
*.mem
.vscode
.buildkite/toolbox/config.json
.buildkite/toolbox/username
docs/Manifest.toml
benchmarks/data/sims/
benchmarks/src/physics/
benchmarks/scripts/slurm_logs/
benchmarks/data/exp_pro/heat/
**/*.swp
2 changes: 1 addition & 1 deletion benchmarks/scripts/final.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const physics = ARGS[2]

aggregate_data(slurm_id, physics)

run(`julia --threads=auto $(postprocessdir("default_out.jl")) $slurm_id $physics`)
run(`julia --threads=auto $(postprocessdir("docs_pp.jl")) $slurm_id $physics`)
2 changes: 1 addition & 1 deletion benchmarks/scripts/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ elseif length(ARGS) == 3

run_physics = SimNameData(physics, arch, tag)
is_valid_config_instance(run_physics)
run_single_physics(physics, [run_physics])
run_single_physics(physics, [run_physics]) # final.sh
else
error("Usage: ['physics' 'architecture' 'tag']")
end
Empty file modified benchmarks/scripts/main.sh
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion benchmarks/src/main_config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[heat.cpu.test]
[heat.cuda.test]
[heat.cuda.test]

[brussel.cpu.default]
[brussel.cuda.default]
30 changes: 30 additions & 0 deletions docs/benchmark_helper.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
insert_benchmarks!(file::String, benchmark_data::Dict)

Insert benchmark results into a markdown file at specified placeholder locations.
Placeholders should be in the format: <!-- BENCHMARK:benchmark_name -->

Parameters:
- file: Path to the markdown file
- benchmark_data: Dictionary mapping benchmark names to their result tables
"""
function insert_benchmarks!(file::String, benchmark_data::Dict{String,String})
ks = keys(benchmark_data);
open(file, "r+") do f
foreach(readlines(file)) do line
stub = filter(u -> startswith(line, "<!-- BENCHMARK:$u -->"), ks);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you use a regex to parse out the u instead of looping over the keys(benchmark_data) to do this in O(1) time instead of O(n)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regex is something like <!-- BENCHMARK:\([A-z]*\)\w+-->

if !isempty(stub)
# get the most recent sims
eligible_sims = readdir(benchmark_data[only(stub)], join=true)
most_recent = filter(eligible_sims) do path
last(splitpath(path)) == maximum(last.(splitpath.(eligible_sims)))
end
foreach(eachline(joinpath(only(most_recent), "default_output.md"))) do line
println(f, line)
end
else
println(f, line)
end
end
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabwidth!

40 changes: 23 additions & 17 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ end
# end
# end

@info "Interpolating benchmarks into docs $(@__DIR__))"
include("benchmark_helper.jl")
insert_benchmarks!("docs/src/benchmarks.md",
Dict("heat" => "benchmarks/data/exp_pro/heat/"))

@info "Building Documenter.jl docs"
makedocs(
modules = [Decapodes],
Expand All @@ -47,23 +52,24 @@ makedocs(
r"Decapodes\.jl/dev"], # 404, probably due to bad self-rerference
pages = Any[
"Decapodes.jl" => "index.md",
"Overview" => "overview/overview.md",
"Equations" => "equations/equations.md",
"Vortices" => "navier_stokes/ns.md",
"Harmonics" => "harmonics/harmonics.md",
"Cahn-Hilliard" => "ch/cahn-hilliard.md",
"Klausmeier" => "klausmeier/klausmeier.md",
"CISM v2.1" => "cism/cism.md",
"Glacial Flow" => "ice_dynamics/ice_dynamics.md",
"Grigoriev Ice Cap" => "grigoriev/grigoriev.md", # Requires ice_dynamics
"Budyko-Sellers-Halfar" => "bsh/budyko_sellers_halfar.md", # Requires ice_dynamics
"Halfar-NS" => "halmo/halmo.md", # Requires grigoriev
"NHS" => "nhs/nhs_lite.md",
"Pipe Flow" => "poiseuille/poiseuille.md",
"Misc Features" => "bc/bc_debug.md", # Requires overview
"ASCII Operators" => "ascii.md",
"Canonical Models" => "canon.md",
"Library Reference" => "api.md"
#"Overview" => "overview/overview.md",
#"Equations" => "equations/equations.md",
#"Vortices" => "navier_stokes/ns.md",
#"Harmonics" => "harmonics/harmonics.md",
#"Cahn-Hilliard" => "ch/cahn-hilliard.md",
#"Klausmeier" => "klausmeier/klausmeier.md",
#"CISM v2.1" => "cism/cism.md",
#"Glacial Flow" => "ice_dynamics/ice_dynamics.md",
#"Grigoriev Ice Cap" => "grigoriev/grigoriev.md", # Requires ice_dynamics
#"Budyko-Sellers-Halfar" => "bsh/budyko_sellers_halfar.md", # Requires ice_dynamics
#"Halfar-NS" => "halmo/halmo.md", # Requires grigoriev
#"NHS" => "nhs/nhs_lite.md",
#"Pipe Flow" => "poiseuille/poiseuille.md",
#"Misc Features" => "bc/bc_debug.md", # Requires overview
"Benchmarks" => "benchmarks.md"
#"ASCII Operators" => "ascii.md",
#"Canonical Models" => "canon.md",
#"Library Reference" => "api.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use draft mode in Documenter to disable running specific pages.

]
)

Expand Down
17 changes: 17 additions & 0 deletions docs/src/benchmarks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Benchmarks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed the results rather than stub

## Heat
| Task ID | statsfile | benchfile | resolution | code_target | float_type | Setup Median time | Mesh Median time | Simulate Median time | Solve Median time | nf |
|---------|-----------------------------|----------------------------------|------------|-------------|------------|-------------------|------------------|----------------------|-------------------|------|
| 3 | stats_heat_cpu_test_3.jld2 | benchmarks_heat_cpu_test_3.json | 1 | CPUTarget | Float32 | 0.00440888 | 0.279692 | 0.00309735 | 0.558636 | 9327 |
| 6 | stats_heat_cpu_test_6.jld2 | benchmarks_heat_cpu_test_6.json | 1 | CPUTarget | Float64 | 0.00447047 | 0.324688 | 0.00329365 | 0.63329 | 9297 |
| 3 | stats_heat_cuda_test_3.jld2 | benchmarks_heat_cuda_test_3.json | 1 | CUDATarget | Float32 | 0.0052702 | 0.382094 | 0.00457613 | 0.79329 | 9321 |
| 6 | stats_heat_cuda_test_6.jld2 | benchmarks_heat_cuda_test_6.json | 1 | CUDATarget | Float64 | 0.00491387 | 0.386088 | 0.0046531 | 0.801826 | 9297 |
| 2 | stats_heat_cpu_test_2.jld2 | benchmarks_heat_cpu_test_2.json | 2 | CPUTarget | Float32 | 0.0044489 | 0.0662042 | 0.000771337 | 0.0368417 | 2409 |
| 5 | stats_heat_cpu_test_5.jld2 | benchmarks_heat_cpu_test_5.json | 2 | CPUTarget | Float64 | 0.00449127 | 0.0769773 | 0.00080348 | 0.0415073 | 2373 |
| 2 | stats_heat_cuda_test_2.jld2 | benchmarks_heat_cuda_test_2.json | 2 | CUDATarget | Float32 | 0.00496288 | 0.0869387 | 0.00202888 | 0.205252 | 2409 |
| 5 | stats_heat_cuda_test_5.jld2 | benchmarks_heat_cuda_test_5.json | 2 | CUDATarget | Float64 | 0.0049011 | 0.0873349 | 0.00192332 | 0.197789 | 2373 |
| 1 | stats_heat_cpu_test_1.jld2 | benchmarks_heat_cpu_test_1.json | 5 | CPUTarget | Float32 | 0.00444552 | 0.0101653 | 0.000141233 | 0.00136106 | 471 |
| 4 | stats_heat_cpu_test_4.jld2 | benchmarks_heat_cpu_test_4.json | 5 | CPUTarget | Float64 | 0.00448736 | 0.0124717 | 0.000148126 | 0.00146659 | 435 |
| 1 | stats_heat_cuda_test_1.jld2 | benchmarks_heat_cuda_test_1.json | 5 | CUDATarget | Float32 | 0.00492554 | 0.0136025 | 0.00122809 | 0.0408824 | 471 |
| 4 | stats_heat_cuda_test_4.jld2 | benchmarks_heat_cuda_test_4.json | 5 | CUDATarget | Float64 | 0.00524847 | 0.0150585 | 0.00122604 | 0.0378521 | 435 |
Loading