Reactant primitive models #985
Conversation
|
One thing that's annoying to deal with for Reactant compat is the I don't have the best way to deal with that figured out yet without going directly into the |
| # Branchless kernel for finding ring indices, compatible with Reactant tracing. | ||
| # It's slower than the regular kernel on both CPU and GPU, that's why it's only used here | ||
| # Counts how many latd entries are >= θ to find the ring index j | ||
| # such that latd[j] >= θ > latd[j+1]. This avoids data-dependent control flow | ||
| # (while, break, if/elseif) which is incompatible with Reactant tracing. |
There was a problem hiding this comment.
This is good to know for the parameterizations. For a lot of the surface fluxes we use condition ? a : b which can be easily written as ifelse but I'll try to directly implement this also for the convection scheme which has way more conditionals that I'll try to revisit in #976
There was a problem hiding this comment.
Branches are not completely forbidding, we can @trace them in Reactant as well. But the binary search algorithm here was problematic with its data dependent while loop.
I don't want one monster PR, so I split the Reactant work a little.
#970 is about all the basics and getting the barotropic model going
Here, I continue with the primitive wet model