Skip to content

Commit 7a00146

Browse files
committed
Add compression filters
1 parent c919367 commit 7a00146

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Checkpointer.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ function checkpoint_model_cache(
102102
@info "Saving checkpoint $(nameof(sim)) model cache to JLD2 on day $day second $sec"
103103
pid = ClimaComms.mypid(comms_ctx)
104104
output_file = joinpath(output_dir, "checkpoint_cache_$(pid)_$(nameof(sim))_$t.jld2")
105-
JLD2.jldsave(output_file, cache = p)
105+
filters = [JLD2.Shuffle(), JLD2.ZstdFilter(1)]
106+
JLD2.jldsave(output_file, filters, cache = p)
106107

107108
# Remove previous checkpoint if it exists
108109
prev_checkpoint_file = joinpath(
@@ -163,8 +164,12 @@ function checkpoint_sims(cs::Interfacer.CoupledSimulation)
163164
pid = ClimaComms.mypid(comms_ctx)
164165
@info "Saving coupler fields to JLD2 on day $day second $sec"
165166
output_file = joinpath(output_dir, "checkpoint_coupler_fields_$(pid)_$time.jld2")
167+
# Apply shuffle filter to groups same-order bytes together to improve
168+
# compression
169+
# Apply ZstdFilter with level 1 to priortize speed over compression
170+
filters = [JLD2.Shuffle(), JLD2.ZstdFilter(1)]
166171
# Adapt to Array move fields to the CPU
167-
JLD2.jldsave(output_file, coupler_fields = CC.Adapt.adapt(Array, cs.fields))
172+
JLD2.jldsave(output_file, filters, coupler_fields = CC.Adapt.adapt(Array, cs.fields))
168173

169174
# Remove previous Coupler fields checkpoint if it exists
170175
prev_checkpoint_file =

0 commit comments

Comments
 (0)