diff --git a/.buildkite/build_docs.sh b/.buildkite/build_docs.sh new file mode 100755 index 00000000..20646dd7 --- /dev/null +++ b/.buildkite/build_docs.sh @@ -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")' diff --git a/.buildkite/jobscript.sh b/.buildkite/jobscript.sh deleted file mode 100755 index ebf55028..00000000 --- a/.buildkite/jobscript.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -pwd; hostname; date - -module load julia - -echo "Running Tests..." -julia --project -t 16 -e 'using Pkg; Pkg.status(); Pkg.test()' - -echo "Building Documentation..." -julia --project=docs -t 16 -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.status(); Pkg.instantiate(); include("docs/make.jl")' diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 150a0908..fe5d7d35 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -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 diff --git a/.buildkite/run_tests.sh b/.buildkite/run_tests.sh new file mode 100755 index 00000000..8043259a --- /dev/null +++ b/.buildkite/run_tests.sh @@ -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()" diff --git a/.buildkite/toolbox/.rsync-filter b/.buildkite/toolbox/.rsync-filter deleted file mode 100644 index 3cfdcd22..00000000 --- a/.buildkite/toolbox/.rsync-filter +++ /dev/null @@ -1,2 +0,0 @@ -- .git -- .buildkite/toolbox diff --git a/.buildkite/toolbox/hpg.sh b/.buildkite/toolbox/hpg.sh deleted file mode 100644 index e69de29b..00000000 diff --git a/.buildkite/toolbox/srun.sh b/.buildkite/toolbox/srun.sh deleted file mode 100644 index 3d36cbb3..00000000 --- a/.buildkite/toolbox/srun.sh +++ /dev/null @@ -1,6 +0,0 @@ -srun --cpus-per-task=16 \ - --mem=8G \ - --time=1:00:00 \ - --output=.buildkite/build_%j.log \ - --unbuffered \ - .buildkite/jobscript.sh diff --git a/.buildkite/toolbox/to_hpg.sh b/.buildkite/toolbox/to_hpg.sh deleted file mode 100755 index 0871ac5d..00000000 --- a/.buildkite/toolbox/to_hpg.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -if [ "$1" == "-t" ]; then - echo "Flag -t is provided." - DRYRUN="--dry-run" - else - DRYRUN="" -fi - -# check if we are in a valid git repository -REPO=`git rev-parse --show-toplevel` -if [[ ! $REPO ]]; then - echo "We are not in a valid git repo $(pwd)" - exit 1 -fi - -REMOTE_DIR="$REPO/.buildkite/toolbox/" -CONFIG="$REPO/.buildkite/config.json" - -# obtain username -if [ ! -f "$REMOTE_DIR/username" ]; then - USERNAME=$USER - read -p "Is \"${USERNAME}\" your HPG username? [y/N]" -n 1 -r -s - echo - - if [[ ! $REPLY =~ ^[Yy]$ ]] - then - read -p "Please provide the username to your HPG account: " -r USERNAME - fi -else - USERNAME=`head -1 $REMOTE_DIR/username` -fi - -# get branch name -BRANCH=`echo $REPO | xargs basename` - -TIME=`date +%s` -rsync -a --exclude '.buildkite/remote/to_hpg.sh' --exclude '.git' --exclude-from '.gitignore' --rsync-path="mkdir -p builds/ && rsync -arv " $REPO $USERNAME@hpg.rc.ufl.edu:~/builds/ - - - diff --git a/.gitignore b/.gitignore index 615d61e1..d54351c1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/benchmarks/scripts/final.jl b/benchmarks/scripts/final.jl index 2fe9a108..1f0f99c2 100644 --- a/benchmarks/scripts/final.jl +++ b/benchmarks/scripts/final.jl @@ -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`) diff --git a/benchmarks/scripts/main.jl b/benchmarks/scripts/main.jl index 8e376a61..4305d326 100644 --- a/benchmarks/scripts/main.jl +++ b/benchmarks/scripts/main.jl @@ -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 diff --git a/benchmarks/scripts/main.sh b/benchmarks/scripts/main.sh old mode 100644 new mode 100755 diff --git a/benchmarks/src/main_config.toml b/benchmarks/src/main_config.toml index 54619c6b..a5b9dcb2 100644 --- a/benchmarks/src/main_config.toml +++ b/benchmarks/src/main_config.toml @@ -1,2 +1,5 @@ [heat.cpu.test] -[heat.cuda.test] \ No newline at end of file +[heat.cuda.test] + +[brussel.cpu.default] +[brussel.cuda.default] diff --git a/docs/benchmark_helper.jl b/docs/benchmark_helper.jl new file mode 100644 index 00000000..82058c76 --- /dev/null +++ b/docs/benchmark_helper.jl @@ -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: + +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, ""), ks); + 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 diff --git a/docs/make.jl b/docs/make.jl index e8d7e32b..abdd607a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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], @@ -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" ] ) diff --git a/docs/src/benchmarks.md b/docs/src/benchmarks.md new file mode 100644 index 00000000..ebd7f5de --- /dev/null +++ b/docs/src/benchmarks.md @@ -0,0 +1,17 @@ +# Benchmarks + +## 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 |