-
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
Adds kernel computed field #1293
Conversation
…KernelComputedField
@glwagner Sorry for posting in the wrong place. Here's the same message again: @glwagner I modified the docstring with a small example that I think illustrates the patterns relatively in this commit. I'm assuming that's what you meant by "example", right? I've tested it already in some simple examples and it produces correct results. Is there anything else left besides testing this with an actual complex calculation that can only be done via KernelComputedField on a GPU? |
I already tested it for some complex calculations (TKE, Ri, Ro and Ertel PV) and the results are correct! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'm guessing this would simplify some of the statistics in LESbrary.jl?
src/Fields/kernel_computed_field.jl
Outdated
using Oceananigans.Grids: Cell, Face | ||
|
||
@inline ψ²(i, j, k, grid, ψ, Ψ) = @inbounds (ψ[i, j, k] - Ψ[i, j, k])^2 | ||
@kernel function compute_var!(var, grid, ϕ, Φ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's just an example but would compute_perturbation!
be a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to a change of names, but my idea was that it computes the variance, hence compute_var!
. (Although in hindsight I should have just named it compute_variance!
and be more explicit.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah haha sorry I thought it was short for compute_variable!
. Indeed compute_variance!
would be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@tomchor Just merged it! We should add you as a collaborator on the repo so you can merge your own PRs once they're approved. |
Adds
KernelComputedField <: AbstractField
which is computed using a user-defined@kernel
function viaKernelAbstractions.jl
. To do:Closes #1246