Add support for lazy and eager broadcast expressions
- Dominant language
- Julia
- Stars
- 117
- Forks
- 19
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 41
Description
A common pattern that is seen in the ClimaAtmos diagnostics, and a desirable capability for unit tests and performance, is something this:
```julia
if isnothing(out)
return TD.dry_pottemp.(thermo_params, cache.precomputed.ᶜts)
else
out .= TD.dry_pottemp.(thermo_params, cache.precomputed.ᶜts)
end
```
What we are trying to do is this: when `out` is `nothing`, we want to allocate a new `Field` and return it. When `out` is a preallocated `Field`, we just want to use it. It would be really nice for ClimaCore to support this in a single `out .= something` expression.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the ClimaAtmos diagnostic pattern shown in the issue, especially the `out .= TD.dry_pottemp.(...)` expression and its `out === nothing` alternative. Determine how ClimaCore's broadcast expressions currently handle allocation and preallocated `Field` outputs. Done means one `out .= something` form supports both lazy allocation and eager reuse, with behavior suitable for unit tests and performance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100