Skip to content

Commit

Permalink
Check number of threads before launching kernel (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasfaingnaert authored Nov 15, 2023
1 parent 912fa05 commit a7a802c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function matmul(conf::Config, a, b, c, d;

hostkernel = @cuda launch=false kernel(args...)
attributes(hostkernel.fun)[CUDA.FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES] = shmem

threads CUDA.maxthreads(hostkernel) || throw(ConfigError("Requested too many threads for this kernel: This kernel can be launched using at most $(CUDA.maxthreads(hostkernel)) threads, while this configuration required $(threads)"))

hostkernel(args...; threads, blocks, shmem)
end

Expand Down

0 comments on commit a7a802c

Please sign in to comment.