Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Throw an error before using at-cfunction with closures on unsupported platforms. #170

Merged
merged 1 commit into from
Oct 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/occupancy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ function launch_configuration(fun::CuFunction; shmem=0, max_threads::Integer=0)
threads_ref = Ref{Cint}()
if isa(shmem, Integer)
cuOccupancyMaxPotentialBlockSize(blocks_ref, threads_ref, fun, C_NULL, shmem, max_threads)
else
elseif Sys.ARCH == :x86 || Sys.ARCH == :x86_64
shmem_cint = threads -> Cint(shmem(threads))
cb = @cfunction($shmem_cint, Cint, (Cint,))
cuOccupancyMaxPotentialBlockSize(blocks_ref, threads_ref, fun, cb, 0, max_threads)
else
error("launch_configuration with a shmem callback is not supported on your architecture")
end
return (blocks=blocks_ref[], threads=threads_ref[])
end