CliMA / ClimaCore.jl

CliMA model dycore
https://clima.github.io/ClimaCore.jl/dev
Apache License 2.0
86 stars 8 forks source link

`LinearRemap` uses scalar indexing #1690

Open juliasloan25 opened 5 months ago

juliasloan25 commented 5 months ago

Describe the bug

LinearRemap uses scalar indexing, which is not GPU compatible, in this line 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:

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)
charleskawczynski commented 5 months ago

Yeah, it looks like it's not gpu compatible. When is it used? Is it only used during post-processing?