Skip to content

Support for kernels with keyword arguments #2718

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
gmgunter opened this issue Mar 24, 2025 · 2 comments
Open

Support for kernels with keyword arguments #2718

gmgunter opened this issue Mar 24, 2025 · 2 comments
Labels
cuda kernels Stuff about writing CUDA kernels.

Comments

@gmgunter
Copy link

Hi,

Thanks for this nice package. I'm just getting started but ran into an issue when trying to GPU-ize an existing function that takes keyword arguments. Is this possible? I'm getting a syntax error when passing such a function as an argument to the @cuda macro (MWE below).

This simple kernel works fine when I pass a positional argument:

julia> using CUDA: @cuda, @cushow

julia> function kernel1(foo::Integer)
           @cushow foo
           return
       end
kernel1 (generic function with 1 method)

julia> @cuda kernel1(1)
foo = 1
CUDA.HostKernel for kernel1(Int64)

But I get a syntax error when I pass a keyword argument instead:

julia> function kernel2(; foo::Integer)
           @cushow foo
           return
       end
kernel2 (generic function with 1 method)

julia> @cuda kernel2(foo=1)
ERROR: syntax: invalid syntax foo = 1
Stacktrace:
 [1] top-level scope
   @ REPL[5]:1

Version info

julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 256 × AMD EPYC 7713 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 256 virtual cores)
julia> CUDA.versioninfo()
CUDA runtime 12.4, local installation
CUDA driver 12.5
NVIDIA driver 555.42.6

CUDA libraries:
- CUBLAS: 12.4.2
- CURAND: 10.3.5
- CUFFT: 11.2.0
- CUSOLVER: 11.6.0
- CUSPARSE: 12.3.0
- CUPTI: 2024.1.0 (API 22.0.0)
- NVML: 12.0.0+555.42.6

Julia packages:
- CUDA: 5.7.0
- CUDA_Driver_jll: 0.12.0+0
- CUDA_Runtime_jll: 0.16.0+0
- CUDA_Runtime_Discovery: 0.3.5

Toolchain:
- Julia: 1.11.4
- LLVM: 16.0.6

Preferences:
- CUDA_Runtime_jll.local: true

1 device:
  0: NVIDIA A800 40GB Active (sm_80, 38.224 GiB / 40.000 GiB available)
@maleadt
Copy link
Member

maleadt commented Mar 25, 2025

No, this is currently not supported.

@maleadt maleadt changed the title Kernel keyword arguments? Support for kernels with keyword arguments Mar 25, 2025
@maleadt maleadt added the cuda kernels Stuff about writing CUDA kernels. label Mar 25, 2025
@gmgunter
Copy link
Author

Alright, thanks. Feel free to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda kernels Stuff about writing CUDA kernels.
Projects
None yet
Development

No branches or pull requests

2 participants