-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(0.90.7) Remove argument splatting in hydrostatic free surface tendency kernel entry functions #3477
Conversation
Here's a script for generating timings using Oceananigans
using Oceananigans.TurbulenceClosures: CATKEVerticalDiffusivity
using Oceananigans.TimeSteppers: time_step!
grid = RectilinearGrid(size=64, z=(-256, 0), topology=(Flat, Flat, Bounded))
coriolis = FPlane(f=1e-4)
closure = CATKEVerticalDiffusivity()
boundary_conditions = (b = FieldBoundaryConditions(top = FluxBoundaryCondition(1e-8)),
u = FieldBoundaryConditions(top = FluxBoundaryCondition(-2e-4)))
model = HydrostaticFreeSurfaceModel(; grid, closure, coriolis, boundary_conditions,
tracers = (:b, :e), buoyancy = BuoyancyTracer())
bᵢ(z) = 1e-6 * z
set!(model, b=bᵢ, e=1e-6)
# Compile
time_step!(model, 600)
@time for n = 1:100
time_step!(model, 600)
end |
@simone-silvestri note that the tridiagonal solver also did not re-introduce splatting, so no change needs to be made there. |
That's right @navidcy, nice detective work |
I think we should merge this now, since Oceananigans is barely useable at the moment, and then pick up getting the Enzyme tests passing in @jlk9's PR (which also needs to involve performance benchmarking to ensure we maintain performance) |
This PR removes argument splatting in intermediate functions that are called to compute the hydrostatic free surface tendencies.
Argument splatting was removed in a prior PR (that'd be great if someone can remember), but was reinstated in #3360.
This PR re-removes splatting. It yields a 2x performance gain for a column model:
main
This PR
It also reduces memory allocation.
Note that the nonhydrostatic model was not changed (it does not splat).