Skip to content

Unsupported keyword argument 'inbounds' with CUDA.jl #184

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

Open
albert-de-montserrat opened this issue May 14, 2025 · 1 comment
Open

Unsupported keyword argument 'inbounds' with CUDA.jl #184

albert-de-montserrat opened this issue May 14, 2025 · 1 comment

Comments

@albert-de-montserrat
Copy link
Contributor

When I try to use the inbounds keyword with CUDA kernels I get the following Unsupported keyword argument 'inbounds' error:

using CUDA
using ParallelStencil
@init_parallel_stencil(CUDA, Float64, 2)

n = 1024
A = @rand(n, n)
B = @zeros(n, n)

@parallel_indices (I...) function foo!(A, B)
    A[I...] = B[I...]
    nothing
end
julia> @parallel inbounds=true (1:n, 1:n) foo!(A, B)
ERROR: LoadError: ArgumentError: Unsupported keyword argument 'inbounds'
Stacktrace:
 [1] var"@cuda"(__source__::LineNumberNode, __module__::Module, ex::Vararg{Any})
   @ CUDA ~/.julia/packages/CUDA/1kIOw/src/compiler/execution.jl:57

while this seems to work just fine on the CPU backend. Any chance I am misusing it?

@omlins
Copy link
Owner

omlins commented May 16, 2025

This keyword argument is for function definitions, not function calls (see ?@parallel).

In a function call, it will simply pass it further as an unknown keyword argument to the gpu backend. In the CPU case, unknown keyword arguments are assumed to be for the GPU backend and are simply ignored. This is why it appeared to be working in the CPU case for you.

That said, you can call @inbounds @parallel (1:n, 1:n) foo!(A, B), but at least as of now I don't think it has any effect in the GPU case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants