CliMA / CliMA/ClimaCore.jl

maximum is alloacting

Open
#1,268 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
117
Forks
19
Avg merge
3d 4h
Merged PRs (30d)
41

Description

Here is a mwe of the problem that me and @dennisYatunin saw:

```
using ClimaCore
const FT = Float64

z_domain = ClimaCore.Domains.IntervalDomain(
ClimaCore.Geometry.ZPoint(FT(0)),
ClimaCore.Geometry.ZPoint(FT(1));
boundary_tags = (:bottom, :top),
)
z_mesh = ClimaCore.Meshes.IntervalMesh(z_domain; nelems = 100)
z_topology = ClimaCore.Topologies.IntervalTopology(z_mesh)
z_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(z_topology)

@allocated maximum(ClimaCore.Fields.coordinate_field(z_space).z)
640
```

And here is a more dramatic example of it

```
tuple_field = map(z -> (rand(FT), z), ClimaCore.Fields.coordinate_field(z_space).z)
@allocated maximum(((a, z),) -> a > FT(0.99) ? z : FT(0), tuple_field)
6137496
```
In the second example the allocation is also a little bit random. Any ideas? cc @charleskawczynski @simonbyrne

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied ClimaCore reproducer with `@allocated`, focusing on `maximum` over `coordinate_field(z_space).z` and the mapped tuple field. Trace the allocation through the `CenterFiniteDifferenceSpace` and field operations; done means the cause is identified and the reported allocations are eliminated or documented as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.