18
18
19
19
# primary array
20
20
function CuArray {T,N} (ptr:: CuPtr{T} , dims:: Dims{N} , pooled:: Bool = true ;
21
- ctx= CuCurrentContext ()) where {T,N}
21
+ ctx= context ()) where {T,N}
22
22
self = CuArray {T,N,Nothing} (ptr, dims, nothing , pooled, ctx)
23
23
retain (self)
24
24
finalizer (unsafe_free!, self)
@@ -123,7 +123,7 @@ Base.similar(a::CuArray, ::Type{T}, dims::Base.Dims{N}) where {T,N} = CuArray{T,
123
123
124
124
125
125
"""
126
- unsafe_wrap(::CuArray, ptr::CuPtr{T}, dims; own=false, ctx=CuCurrentContext ())
126
+ unsafe_wrap(::CuArray, ptr::CuPtr{T}, dims; own=false, ctx=context ())
127
127
128
128
Wrap a `CuArray` object around the data at the address given by `ptr`. The pointer
129
129
element type `T` determines the array element type. `dims` is either an integer (for a 1d
@@ -133,7 +133,7 @@ take ownership of the memory, calling `cudaFree` when the array is no longer ref
133
133
"""
134
134
function Base. unsafe_wrap (:: Union{Type{CuArray},Type{CuArray{T}},Type{CuArray{T,N}}} ,
135
135
p:: CuPtr{T} , dims:: NTuple{N,Int} ;
136
- own:: Bool = false , ctx:: CuContext = CuCurrentContext ()) where {T,N}
136
+ own:: Bool = false , ctx:: CuContext = context ()) where {T,N}
137
137
xs = CuArray {T, length(dims)} (p, dims, false ; ctx= ctx)
138
138
if own
139
139
base = convert (CuPtr{Cvoid}, p)
149
149
150
150
function Base. unsafe_wrap (Atype:: Union{Type{CuArray},Type{CuArray{T}},Type{CuArray{T,1}}} ,
151
151
p:: CuPtr{T} , dim:: Integer ;
152
- own:: Bool = false , ctx:: CuContext = CuCurrentContext ()) where {T}
152
+ own:: Bool = false , ctx:: CuContext = context ()) where {T}
153
153
unsafe_wrap (Atype, p, (dim,); own= own, ctx= ctx)
154
154
end
155
155
0 commit comments