Replies: 2 comments
-
I don't personally use them much. But I guess there's a few other problems it solves other than compilation difficulties:
uc = KernelFunctionOperation{Face, Center, Center}(advective_tracer_flux_x, grid, computed_dependencies=(model.advection, model.velocities.u, model.tracers.c)) I think it's true though that in some ideal limit we would use abstract operations for everything, including the internal model implementation... |
Beta Was this translation helpful? Give feedback.
0 replies
-
An update on this from my end: it looks like the PTX / compilation errors are a lot more prevalent on |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some context to my question:
When I started using Oceananigans, there were many "medium-complexity" abstract operation expressions that couldn't be compiled into GPU code. Plus, (I think) we weren't aware that we could nest
ComputedFields
to achieve a more complex result. This motivated us to createKernelComputedField
s (which now have been replaced by the simplerKernelFunctionOperation
s), and motivated me to create Oceanostics to save useful kernels.Nowadays, however, abstract operations are much better (thanks to @glwagner), and we know that we can nest abstract operations (computed
Field
s really) to calculate a complex result. So generally when needing to calculate a complex diagnostic we're faced with two options:1 - Nesting computed
Fields
of low/medium complexity. This is very easy to do and produces readable code, but it's inefficient.2 - Using
KernelFunctionOperation
s (either by hand, which isn't trivial at all, or through Oceanostics if that operation is there). Downside here is that it's harder, but upside is that it's more efficient.However, in my experience abstract operations are so good now (i.e. are able to compile so many operations into GPU code) that I generally don't need to nest more than 2 abstract operations to get any diagnostic that I want. In fact, when comparing time-to-solution for simulations that need complex diagnostics, I find that the added time by using nested abstract operations is negligible when comparing to the same simulation using
KernelFunctionOperation
s. And the code with abstract operations is generally more readable.Of course, if you need to calculate many complex diagnostics very often, then the added time might pile up, but I suspect that this situation very rarely happens.
I was just wondering if you guys have also compared nested computed
Fields
againstKFO
s, and what are your thoughts on the issue. Do you end up usingKernelFunctionOperation
s a lot?Beta Was this translation helpful? Give feedback.
All reactions