Skip to content

Commit

Permalink
Add RSS memory usage to reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbozzolo committed Dec 19, 2023
1 parent a223fbe commit 2cb5ab7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/solver/solve.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ClimaTimeSteppers as CTS
import Base.Sys: maxrss

struct EfficiencyStats{TS <: Tuple, WT}
tspan::TS
Expand Down Expand Up @@ -74,6 +75,15 @@ function solve_atmos!(simulation)
return AtmosSolveResults(nothing, :simulation_crashed, nothing)
finally
# Close all the files opened by the writers

maxrss_bytes = maxrss()
maxrss_str =
maxrss_bytes > 2^30 ?
"$(round(maxrss_bytes / 2^30, digits = 2)) GiB" :
"$(round(maxrss_bytes / 2^20, digits = 2)) MiB"

@info "Memory currently used by the process (RSS): $maxrss_str"

foreach(CAD.close, output_writers)
end
end
Expand Down

0 comments on commit 2cb5ab7

Please sign in to comment.