Hi everyone,
I am working on a project that makes intensive use of GPU computation and we wanted to have some module constants that were already placed on the GPU memory, but apparently the memory is freed after the module has been defined and accessing that constant results in an undefined reference error (if you access from CPU) or non-determined data (when accessed from a GPU kernel).
I tried to replicate it in the REPL but it doesn’t happen there:
module CUDAtest
using CUDA
const A = Vector{Float32}([1f0, 2f0, 3f0])
const B = CuArray(A)
end
In this case I can access both CUDAtest.A
and CUDAtest.B
without issues, but when I try to access constants in my other module I can only have the one located in CPU. About the constant located in GPU, I can query its type, size and length (which indicates that the pointer is there), but trying to print it throws the following error:
julia> Common.CU_BLUE
5-element CUDA.CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}:
Error showing value of type CUDA.CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}:
ERROR: UndefRefError: access to undefined reference
With CPU arrays it works all right, so do you know if this is somewhat an expected behaviour or maybe it is a bug?
Thanks in advance,
David