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 0fdadee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SciMLBase
import .Parameters as CAP
import DiffEqCallbacks as DECB
import ClimaCore: InputOutput
import Base.Sys: maxrss
using Dates
using Insolation: instantaneous_zenith_angle
import ClimaCore.Fields: ColumnField
Expand Down Expand Up @@ -502,6 +503,14 @@ function print_walltime_estimate(integrator)
wall_time_spent percent_complete = "$percent_complete%" sypd = sypd date_now =
Dates.now() estimated_finish_date = estimated_finish_date

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 used by process (RSS): $maxrss_str"

# the first fixed increment is equivalent to
# doubling (which puts us at 10%), so we check
# if we're below 5%.
Expand Down

0 comments on commit 0fdadee

Please sign in to comment.