I am getting: ERROR: LoadError: CUDA error: an illegal memory access was encountered (code #700, ERROR_ILLEGAL_ADDRESS) on the following
using CUDAdrv, CUDAnative
function kernel(x)
i = threadIdx().x
shared = @cuDynamicSharedMem(Int64,1)
if i == 1
shared[1] = 255
end
sync_threads()
x[i] = shared[1]
return nothing
end
d_x = CuArray{Int64,1}(10)
@cuda (1, 10) kernel(d_x)
x = Array(d_x)
println(x)
The error probably occurs as soon as I try
shared[1] = 255
In the source code CUDAnative.jl/src/device/intrinsics/memory_shared.jl it mentions:
Dynamic shared memory also needs to be allocated beforehand, when calling the kernel.
Yet, I cannot find an example on how to do this.