`LinearRemap` uses scalar indexing
- Dominant language
- Julia
- Stars
- 117
- Forks
- 19
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 41
Description
## Describe the bug
`LinearRemap` uses scalar indexing, which is not GPU compatible, in [this line](https://github.com/CliMA/ClimaCore.jl/blob/main/src/Operators/remapping.jl#L62) of `linear_remap_op`. We want to use `LinearRemap` in ClimaCoupler on GPU if possible.
This bug is seen when using ClimaCore v0.13.3
## To Reproduce
Ideally a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example):
```julia
import ClimaCore as CC
import ClimaComms
function spectral_space_2D(; n1 = 1, n2 = 1, Nij = 4)
domain = CC.Domains.RectangleDomain(
CC.Geometry.XPoint(-1.0) .. CC.Geometry.XPoint(1.0),
CC.Geometry.YPoint(-1.0) .. CC.Geometry.YPoint(1.0),
x1periodic = false,
x2periodic = false,
x1boundary = (:east, :west),
x2boundary = (:south, :north),
)
mesh = CC.Meshes.RectilinearMesh(domain, n1, n2)
comms_ctx = ClimaComms.SingletonCommsContext()
grid_topology = CC.Topologies.Topology2D(comms_ctx, mesh)
quad = CC.Spaces.Quadratures.GLL{Nij}()
space = CC.Spaces.SpectralElementSpace2D(grid_topology, quad)
return space
end
spaceA = spectral_space_2D()
spaceB = spectral_space_2D(n1 = 2, n2 = 2)
map = CC.Operators.LinearRemap(spaceB, spaceA)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Read src/Operators/remapping.jl at the linear_remap_op implementation and inspect the scalar indexing on line 62. Run the supplied Julia reproduction to confirm the current LinearRemap behavior, then verify that the construction no longer relies on scalar indexing and remains suitable for GPU use.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100