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

Simplify storage Dict keys #85

Closed
charleskawczynski opened this issue Sep 27, 2024 · 2 comments · Fixed by #86
Closed

Simplify storage Dict keys #85

charleskawczynski opened this issue Sep 27, 2024 · 2 comments · Fixed by #86
Assignees

Comments

@charleskawczynski
Copy link
Member

Right now, the storage Dict keys are entire ScheduledDiagnostics:

julia> keys(integrator.callback.discrete_callbacks[6].affect!.diagnostics_handler.storage)
KeySet for a Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, ClimaCore.Fields.Field} with 74 entries. Keys:
  ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic{ClimaDiagnostics.Schedules.EveryDtSchedule{Float64}, ClimaDiagnostics.Schedules.DivisorSchedule, ClimaDiagnostics.Writers.NetCDFWriter{Tuple{Int64, Int64, Int64}, Array{Float64, 3}, Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, Array}, ClimaDiagno
  ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic{ClimaDiagnostics.Schedules.EveryDtSchedule{Float64}, ClimaDiagnostics.Schedules.DivisorSchedule, ClimaDiagnostics.Writers.NetCDFWriter{Tuple{Int64, Int64, Int64}, Array{Float64, 3}, Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, Array}, ClimaDiagno
  ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic{ClimaDiagnostics.Schedules.EveryDtSchedule{Float64}, ClimaDiagnostics.Schedules.DivisorSchedule, ClimaDiagnostics.Writers.NetCDFWriter{Tuple{Int64, Int64, Int64}, Array{Float64, 3}, Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, Array}, ClimaDiagno
  ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic{ClimaDiagnostics.Schedules.EveryDtSchedule{Float64}, ClimaDiagnostics.Schedules.DivisorSchedule, ClimaDiagnostics.Writers.NetCDFWriter{Tuple{Int64, Int64, Int64}, Array{Float64, 3}, Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, Array}, ClimaDiagno
  ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic{ClimaDiagnostics.Schedules.EveryDtSchedule{Float64}, ClimaDiagnostics.Schedules.DivisorSchedule, ClimaDiagnostics.Writers.NetCDFWriter{Tuple{Int64, Int64, Int64}, Array{Float64, 3}, Dict{ClimaDiagnostics.ScheduledDiagnostics.ScheduledDiagnostic, Array}, Cli

I think that we can get closure to fixing the inference issues if we first simplify how we look up which diagnostic is to be computed.

@Sbozzolo
Copy link
Member

It's not just storage, it's all the dictionaries in DiagnosticsHandler. I made them dictionaries because not all diagnostics need accumulators and counters, so it was the easiest. I think we could turn them into vectors by adding some more bookkeeping.

@charleskawczynski
Copy link
Member Author

Ok, sounds good, I'll update the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants