Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save ScheduleDiagnostics as Vectors #84

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

main
-------
## Bug fixes

- `scheduled_diagnostics` are now internally saved as vectors instead of tuples.
This has significant compile-time/inference benefits.

v0.2.6
-------
Expand Down
9 changes: 2 additions & 7 deletions src/clima_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ include("reduction_identities.jl")
A struct that contains the scheduled diagnostics, ancillary data and areas of memory needed
to store and accumulate results.
"""
struct DiagnosticsHandler{
SD <: Tuple,
STORAGE <: Dict,
ACC <: Dict,
COUNT <: Dict,
}
struct DiagnosticsHandler{SD, STORAGE <: Dict, ACC <: Dict, COUNT <: Dict}
"""An iterable with the `ScheduledDiagnostic`s that are scheduled."""
scheduled_diagnostics::SD

Expand Down Expand Up @@ -61,7 +56,7 @@ function DiagnosticsHandler(scheduled_diagnostics, Y, p, t; dt = nothing)
accumulators = Dict()
counters = Dict()

unique_scheduled_diagnostics = Tuple(unique(scheduled_diagnostics))
unique_scheduled_diagnostics = unique(scheduled_diagnostics)
if length(unique_scheduled_diagnostics) != length(scheduled_diagnostics)
@warn "Given list of diagnostics contains duplicates, removing them"
end
Expand Down
Loading