Skip to content
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

GPU issue indexing flat fields #4044

Open
jagoosw opened this issue Jan 14, 2025 · 0 comments
Open

GPU issue indexing flat fields #4044

jagoosw opened this issue Jan 14, 2025 · 0 comments
Labels
GPU 👾 Where Oceananigans gets its powers from

Comments

@jagoosw
Copy link
Collaborator

jagoosw commented Jan 14, 2025

When I try to index into a field which has nothing topology in a kernel, e.g.:

@kernel function add_one!(A)
    i, j = @index(Global, NTuple)
    A[i, j] += 1
end

then it works on CPU, but hits a dynamic function invocation on line 82 here:

@inline function Base.size(loc, topo, sz, indices=default_indices(Val(length(loc))))
D = length(loc)
# (it's type stable?)
return ntuple(Val(D)) do d
Base.@_inline_meta
length(instantiate(loc[d]), instantiate(topo[d]), sz[d], indices[d])
end
end

could we rewrite this like:

@inline function Base.size(loc::NTuple{N},...) where N

instead?

@jagoosw jagoosw added the GPU 👾 Where Oceananigans gets its powers from label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GPU 👾 Where Oceananigans gets its powers from
Projects
None yet
Development

No branches or pull requests

1 participant