diff --git a/src/cuarray.jl b/src/cuarray.jl index 987b9f370..4648cbfa8 100644 --- a/src/cuarray.jl +++ b/src/cuarray.jl @@ -88,11 +88,7 @@ end # Testing the CuArrays allocator: set Knet.cuallocator()=true to use this function KnetPtrCu(len::Int) c = CuArray{UInt8}(undef, len) - if :buf in fieldnames(CuArray) - p = convert(Cptr, convert(Int, c.buf.ptr)) # ver <= 1.2.1 - else - p = convert(Cptr, convert(Int, c.ptr)) # ver >= 1.3.0 - end + p = convert(Cptr, convert(UInt, Base.unsafe_convert(CuPtr{UInt8}, Base.cconvert(CuPtr{UInt8}, c)))) kp = KnetPtr(p, len, gpu(), c) finalizer(freeKnetPtrCu, kp) end