Skip to content

Reducing parameter space usage by LatitudeLongitudeGrid #3693

Open
@glwagner

Description

@glwagner

It's come to light that the LatitudeLongitudeGrid consumes almost 1 kb of parameter space as an argument on the GPU. This is a problem because at least for some versions of CUDA + GPUs (unsure how much is due to the GPU itself vs the CUDA version) we only have 4 kb of parameter space.

I'm wondering if we can save space by removing the latitude and longitude spacings Δλ and Δφ:

function Adapt.adapt_structure(to, grid::LatitudeLongitudeGrid)
TX, TY, TZ = topology(grid)
return LatitudeLongitudeGrid{TX, TY, TZ}(nothing,
grid.Nx, grid.Ny, grid.Nz,
grid.Hx, grid.Hy, grid.Hz,
grid.Lx, grid.Ly, grid.Lz,
Adapt.adapt(to, grid.Δλᶠᵃᵃ),
Adapt.adapt(to, grid.Δλᶜᵃᵃ),
Adapt.adapt(to, grid.λᶠᵃᵃ),
Adapt.adapt(to, grid.λᶜᵃᵃ),
Adapt.adapt(to, grid.Δφᵃᶠᵃ),
Adapt.adapt(to, grid.Δφᵃᶜᵃ),
Adapt.adapt(to, grid.φᵃᶠᵃ),
Adapt.adapt(to, grid.φᵃᶜᵃ),
Adapt.adapt(to, grid.Δzᵃᵃᶠ),
Adapt.adapt(to, grid.Δzᵃᵃᶜ),
Adapt.adapt(to, grid.zᵃᵃᶠ),
Adapt.adapt(to, grid.zᵃᵃᶜ),
Adapt.adapt(to, grid.Δxᶠᶜᵃ),
Adapt.adapt(to, grid.Δxᶜᶠᵃ),
Adapt.adapt(to, grid.Δxᶠᶠᵃ),
Adapt.adapt(to, grid.Δxᶜᶜᵃ),
Adapt.adapt(to, grid.Δyᶠᶜᵃ),
Adapt.adapt(to, grid.Δyᶜᶠᵃ),
Adapt.adapt(to, grid.Azᶠᶜᵃ),
Adapt.adapt(to, grid.Azᶜᶠᵃ),
Adapt.adapt(to, grid.Azᶠᶠᵃ),
Adapt.adapt(to, grid.Azᶜᶜᵃ),
grid.radius)
end

these are used when metrics are not precomputed. So, removing them would require either discontinuing support for non-precomputed-metrics (I'm ok with this), or at least making it so that we can't build a grid on a GPU without precomputing metrics (fine too).

We don't need either Δλ or Δφ inside kernels, right?

Unfortunately, I do not think that the same kind of savings is possible for OrthogonalSphericalShellGrid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GPU 👾Where Oceananigans gets its powers from

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions