-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use single kernel for pointwise functions #3399
base: main
Are you sure you want to change the base?
Conversation
return nothing | ||
end | ||
|
||
function compute_precipitation_sources_kernel!( |
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.
Hi @sriharshakandala, thanks for looking into this. But, what do we do when a user wants to add a new term in here that requires a derivative? If the answer is to split up the kernel, then this seems like a very inflexible solution compared to #3371, which should be able to achieve the same thing as what is done here. One of my bigger concerns, however, is that we cannot easily unit test and refactor compute_precipitation_sources_kernel!
, as we move towards a more lazy representation that will allow us to fuse more kernels still.
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.
This is only for pointwise functions. Spectral element derivatives are not pointwise functions!
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 do not see any limitations with testing code with this approach.
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.
This is only for pointwise functions. Spectral element derivatives are not pointwise functions!
Yeah, but that means that if a user wants to try adding a gradient somewhere that they would need to break up this function, which seems like a lot of work just to add one term.
Also, this example has a collection of floats, how would that look for this example? https://github.com/CliMA/ClimaAtmos.jl/pull/3371/files#diff-471fb2001bc0d6f84924896fd8c99bd3d4edcc84bd5d79da9e9f35afef17f9cdR491-R497
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.
In my view, the point of what Sriharsha is doing here is not so much establish a pattern for refactoring the code, but get a relatively simple example going that allows us to quantitatively assess the performance benefits of kernel fusion. So I'd suggest we table discussions of how to realize the benefits until we have a better sense what the benefits are.
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.
Ok, yes, that makes sense. This would be a nice example to see the speed up.
df42458
to
71fc5d5
Compare
Purpose
Use single kernel for point-wise functions.