Skip to content

Commit

Permalink
Aim allocation monitoring at perf targets
Browse files Browse the repository at this point in the history
Remove threaded allocation table

Increase mem alloc limits

Increase mem request
  • Loading branch information
charleskawczynski committed Sep 19, 2022
1 parent b3de7ce commit a9ed19a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ steps:
agents:
slurm_mem: 20GB

- label: ":rocket: flame graph: threadedd perf target (ρe_tot)"
- label: ":rocket: flame graph: threaded perf target (ρe_tot)"
command: "julia --threads 8 --color=yes --project=perf perf/flame.jl --job_id flame_perf_target_rhoe_threaded --enable_threading true"
artifact_paths: "flame_perf_target_rhoe_threaded/*"
agents:
Expand All @@ -392,8 +392,10 @@ steps:
- label: ":rocket: benchmark: baroclinic wave (ρe_tot)"
command: "julia --color=yes --project=perf perf/benchmark.jl --job_id bm_sphere_baroclinic_wave_rhoe"

- label: ":mag: Allocations: baroclinic wave (ρe_tot)"
- label: ":mag: Allocations: perf target"
command: "julia --color=yes --project=perf perf/allocs.jl"
agents:
slurm_mem: 20GB

- wait: ~
continue_on_failure: true
Expand Down
10 changes: 10 additions & 0 deletions examples/hybrid/cli_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,13 @@ function parsed_args_per_job_id(buildkite_yaml; trigger = "driver.jl")
end
return result
end

function non_default_command_line_flags_parsed_args(parsed_args)
(s, default_parsed_args) = parse_commandline()
s = ""
for k in keys(parsed_args)
default_parsed_args[k] == parsed_args[k] && continue
s *= "--$k $(parsed_args[k]) "
end
return rstrip(s)
end
13 changes: 11 additions & 2 deletions perf/allocs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Track some important dependencies:
example_dir = joinpath(dirname(@__DIR__), "examples")
include(joinpath(example_dir, "hybrid", "cli_options.jl"));

import ClimaCore
import SciMLBase
Expand All @@ -24,9 +25,16 @@ dirs_to_monitor = String.(dirs_to_monitor)

#! format: off

dict = parsed_args_per_job_id(; trigger = "benchmark.jl")
for k in keys(dict)
dict[k]["job_id"] = "allocs_"*dict[k]["job_id"]

# Lower resolution, since allocation tracking is expensive
dict[k]["h_elem"] = 6
dict[k]["z_elem"] = 18
end
cli_options = [
("--job_id alloc_sphere_baroclinic_wave_rhoe"),
("--vert_diff true --surface_scheme bulk --moist equil --forcing held_suarez --microphy 0M"),
non_default_command_line_flags_parsed_args(dict["perf_target_unthreaded"]),
]
#! format: on

Expand All @@ -35,6 +43,7 @@ import ReportMetrics
for clio in cli_options
job_id = first(split(last(split(clio, "--job_id ")), " "))
clio_in = split(clio, " ")
@info "CL options: `$clio_in`"
ReportMetrics.report_allocs(;
job_name = string(job_id),
run_cmd = `$(Base.julia_cmd()) --project=perf/ --track-allocation=all perf/allocs_per_case.jl $clio_in`,
Expand Down
1 change: 1 addition & 0 deletions perf/allocs_per_case.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ catch err
end

OrdinaryDiffEq.step!(integrator) # compile first
Profile.clear()
Profile.clear_malloc_data()
OrdinaryDiffEq.step!(integrator)
4 changes: 2 additions & 2 deletions perf/flame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ allocs = @allocated OrdinaryDiffEq.step!(integrator)

allocs_limit = Dict()
allocs_limit["flame_perf_target_rhoe"] = 10575616
allocs_limit["flame_perf_target_rhoe_threaded"] = 12078128
allocs_limit["flame_perf_target_rhoe_threaded"] = 12078608
allocs_limit["flame_perf_target_rhoe_callbacks"] = 21740792
allocs_limit["flame_perf_target_rhoe_ARS343"] = 24021744
allocs_limit["flame_perf_target_rhoe_ARS343"] = 24056711

if allocs < allocs_limit[job_id] * buffer
@info "TODO: lower `allocs_limit[$job_id]` to: $(allocs)"
Expand Down

0 comments on commit a9ed19a

Please sign in to comment.