Skip to content

Commit

Permalink
parse GPU allocs before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Mar 22, 2024
1 parent e4a8553 commit 789a50c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion experiments/AMIP/coupler_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ function show_memory_usage(comms_ctx, objects, io::Union{Base.TTY, IOContext, IO
if comms_ctx.device isa ClimaComms.CUDADevice
# If `io` is `stdout`, print the memory status, otherwise store in buffer to return
CUDA.memory_status(io)
return io != stdout ? take!(io) : nothing
# Get the memory usage in GB by parsing the output of `CUDA.memory_status`
allocs_GB = split(split(take!(io), '(')[2], '/')[1]
return io != stdout ? allocs_GB : nothing
elseif comms_ctx.device isa ClimaComms.AbstractCPUDevice
if ClimaComms.iamroot(comms_ctx)
cumul_size = 0
Expand Down

0 comments on commit 789a50c

Please sign in to comment.