-
Notifications
You must be signed in to change notification settings - Fork 16
Remove DeviceIntervalTopology #2343
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
base: main
Are you sure you want to change the base?
Conversation
6fa26df
to
51d23ee
Compare
Trying on ClimaAtmos here |
fcd312c
to
765bb1a
Compare
765bb1a
to
7017aff
Compare
6f4f47e
to
3d0c9ca
Compare
18a714c
to
bd1d3cb
Compare
Ok, this is now working in ClimaCore CI, and ClimaAtmos. As this PR developed, I came to better understand the trade-offs. On the one hand, this will allow users to write things like function rayleigh_sponge_tendency_uₕ(ᶜuₕ, s)
s isa Nothing && return NullBroadcasted()
ᶜz = Fields.coordinate_field(axes(ᶜuₕ)).z
ᶠz = Fields.coordinate_field(Spaces.face_space(axes(ᶜuₕ))).z
zmax = Spaces.z_max(axes(ᶠz))
return @. lazy(-β_rayleigh_uₕ(s, ᶜz, zmax) * ᶜuₕ)
end On the other hand, more operations on vertical meshes need to be gpu compatible if we make the The alternative is that we tell users: you must put function rayleigh_sponge_tendency_uₕ(ᶜuₕ, s, p)
s isa Nothing && return NullBroadcasted()
(; zmax) = p
ᶜz = Fields.coordinate_field(axes(ᶜuₕ)).z
return @. lazy(-β_rayleigh_uₕ(s, ᶜz, zmax) * ᶜuₕ)
end (the same will go for any variables in the vertical mesh). I'm torn. I almost think that the latter is just easier, and handle this on a case-by-case basis. The most I've seen so far is needing |
It seems like from a user POV, making From a developer POV, moving what's needed on device to the cache seems much easier. I'm not sure how many operations need to be made gpu compatible, but maybe this would be easier with Denis's |
I think storing zmin/zmax in the cache is just much simpler. I’ll leave this PR open in a draft in case someone later finds that this is useful to revive. |
This PR removes the
DeviceIntervalTopology
, and instead adaptsIntervalTopology
to the GPU. This allows us to compute things likez_min
/z_max
on the device (which needs the vertical mesh, which theDeviceIntervalTopology
does not have).Consequently, I've updated the columnwise test to include
rayleigh_sponge_tendency_uₕ
, which includes that computation.