Skip to content

Commit

Permalink
cuptr conversion based on suggestion from @maleadt.
Browse files Browse the repository at this point in the history
  • Loading branch information
EC2 Default User committed Nov 6, 2019
1 parent 236986f commit 1401b42
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cuarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1401b42

Please sign in to comment.