I am creating some dynamic shared memory boolean arrays in kernel, and it give me consistently
ERROR: LoadError: CUDA error: an illegal memory access was encountered (code 700, ERROR_ILLEGAL_ADDRESS)
Stacktrace:
[1] throw_api_error(res::CUDA.cudaError_enum)
@ CUDA C:\Users\1\.julia\packages\CUDA\9T5Sq\lib\cudadrv\error.jl:105
[2] query
@ C:\Users\1\.julia\packages\CUDA\9T5Sq\lib\cudadrv\stream.jl:102 [inlined]
[3] synchronize(stream::CuStream; blocking::Bool)
@ CUDA C:\Users\1\.julia\packages\CUDA\9T5Sq\lib\cudadrv\stream.jl:130
[4] synchronize (repeats 2 times)
@ C:\Users\1\.julia\packages\CUDA\9T5Sq\lib\cudadrv\stream.jl:117 [inlined]
[5] unsafe_copyto!(dest::Vector{UInt16}, doffs::Int64, src::CuArray{UInt16, 1, CUDA.Mem.DeviceBuffer}, soffs::Int64, n::Int64)
@ CUDA C:\Users\1\.julia\packages\CUDA\9T5Sq\src\array.jl:389
[6] copyto!
@ C:\Users\1\.julia\packages\CUDA\9T5Sq\src\array.jl:349 [inlined]
[7] getindex(xs::CuArray{UInt16, 1, CUDA.Mem.DeviceBuffer}, I::Int64)
@ GPUArrays C:\Users\1\.julia\packages\GPUArrays\3sW6s\src\host\indexing.jl:89
[8] top-level scope
@ c:\GitHub\GitHub\NuclearMedEval\src\playgrounds\convolutionsPlay.jl:71
I am wondering what is wrong here - my assumption is that true size of boolean array in bytes is amount of its entries divided by 8 so 1 bit per entry - am I correct?
using CUDA
dataBdim= (32,24,32)
fp = CUDA.zeros(UInt16,1)
sumInBits = (dataBdim[1]+2)+(dataBdim[2]+2)+(dataBdim[3]+2)+dataBdim[1]+dataBdim[2]+dataBdim[3]
shmemSum = cld(sumInBits,8)#in bytes
function testKernelA(dataBdim,fp)
resShmem = @cuDynamicSharedMem(Bool,((dataBdim[1]+2),(dataBdim[2]+2),(dataBdim[3]+2)))
sourceShmem = @cuDynamicSharedMem(Bool,(dataBdim[1],dataBdim[2],dataBdim[3]))
# naive loop just for presentation of problem
for i in 1:(dataBdim[1]+2),j in 1:(dataBdim[2]+2), n in 1:(dataBdim[3]+2)
resShmem[i,j,n]=false
end
for i in 1:(dataBdim[1]),j in 1:(dataBdim[2]), n in 1:(dataBdim[3])
sourceShmem[i,j,n]=false
end
fp[1]=1
return
end
@cuda threads=(32,5) blocks=(2) shmem=shmemSum testKernelA(dataBdim,fp)
fp[1]