From 596796e1568c21f1cc0ff5277dac85cac8bde3db Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Tue, 5 Nov 2019 01:47:39 +0000 Subject: [PATCH] CuArrays-1.3.0 compat --- Project.toml | 4 ++-- src/cuarray.jl | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 84e69fe87..c4925eb32 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Knet" uuid = "1902f260-5fb4-5aff-8c31-6271790ab950" authors = ["Deniz Yuret "] -version = "1.3.0" +version = "1.3.1" [deps] AutoGrad = "6710c13c-97f1-543f-91c5-74e8f7d95b35" @@ -26,7 +26,7 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" julia = "1.0.0" AutoGrad = "1.1.6" CUDAapi = "1.2.0" -CUDAdrv = "3.1.0" +CUDAdrv = "3.0, 4.0" CUDAnative = "2.4.0" CuArrays = "1.2.1" DataStructures = "0.17.3" diff --git a/src/cuarray.jl b/src/cuarray.jl index a67be813f..987b9f370 100644 --- a/src/cuarray.jl +++ b/src/cuarray.jl @@ -88,7 +88,11 @@ end # Testing the CuArrays allocator: set Knet.cuallocator()=true to use this function KnetPtrCu(len::Int) c = CuArray{UInt8}(undef, len) - p = convert(Cptr, convert(Int, c.buf.ptr)) + 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 kp = KnetPtr(p, len, gpu(), c) finalizer(freeKnetPtrCu, kp) end