Argument splatting fails on GPU for too many arguments #3784
Replies: 5 comments 7 replies
-
What's the current definition of |
Beta Was this translation helpful? Give feedback.
-
Also though I would suggest using the discrete form for a heavy lifting model. It'll increase the options for development too, you are more restricted with the continuous form which is more for rapid prototyping than production-level |
Beta Was this translation helpful? Give feedback.
-
It just had all of the fields together: Oceananigans.jl/src/Biogeochemistry.jl Lines 108 to 121 in 10e9fb0 The vision is to convert it to discrete form eventually but we had some undergrads working on it to get it working first. |
Beta Was this translation helpful? Give feedback.
-
What if you try defining a new function to encourage the compiler to inline this: so rather than calling return splat_bgc(bgc, val_tracer_name, x, y, z, clock.time, fields_ijk) and then @inline splat_bgc(bgc, name, x, y, z, t, fields_tuple) = bgc(name, x, y, z, t, fields_tuple...) or maybe @inline splat_bgc(bgc, name, x, y, z, t, fields_tuple::NTuple{N}) where N = bgc(name, x, y, z, t, fields_tuple...) sometime the type annotations encourage the compiler to try harder / specialize where it may have given up previously. We've run into inference issues with splatting before in other situations. I think your fix may work only for this specific case but may not generalize to even bigger models. If we can find a more general fix that'd be best, but it might be hard. I also wonder if there is an issue specializing on the Another strategy could be to take the pattern you've demonstrated @jagoosw but generalize it, ie simply split function splat_by_division(bgc, name, x, y, z, t, fields::NTuple{N}) where N
M = floor(Int, N/2)
return bgc(name, x, y, z, t, fields[1:M]..., fields[M+1:N]...)
end This is a bit nicer for future developers, because it is clear how to continue to generalize this pattern if the issue crops up again. |
Beta Was this translation helpful? Give feedback.
-
How do we lose velocities? I agree that its plausible they might be needed, but considering it now I don't think we support it at the moment because |
Beta Was this translation helpful? Give feedback.
-
I've been implementing PISCES in OceanBioME which has 24 tracers and 12 auxiliary fields and been struggling with an issue getting it to run on GPU. I couldn't understand why I kept getting
Reason: unsupported call to an unknown function (call to jl_f__apply_iterate)
errors. I finally worked out that it was coming from this line:Oceananigans.jl/src/Biogeochemistry.jl
Line 120 in 10e9fb0
where
fields_ijk
gets splatted.In this specific instance I can solve this problem by redefining
biogeochemical_transitions
like:I gather that there are different implementations for
_apply_iterate
depending on the array length in C, and I assume that is the true root of the issue. Since in Oceananigans this seems like the only instance where this kind of error is likely, would it be okay for me to make this change in the source code? I can't think of a way to fix this otherwise.Beta Was this translation helpful? Give feedback.
All reactions