Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Commit 1e909dd

Browse files
committed
Use the CUDAnative context getter.
Fix #538.
1 parent 01be4f4 commit 1e909dd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/array.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end
1818

1919
# primary array
2020
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}
2222
self = CuArray{T,N,Nothing}(ptr, dims, nothing, pooled, ctx)
2323
retain(self)
2424
finalizer(unsafe_free!, self)
@@ -123,7 +123,7 @@ Base.similar(a::CuArray, ::Type{T}, dims::Base.Dims{N}) where {T,N} = CuArray{T,
123123

124124

125125
"""
126-
unsafe_wrap(::CuArray, ptr::CuPtr{T}, dims; own=false, ctx=CuCurrentContext())
126+
unsafe_wrap(::CuArray, ptr::CuPtr{T}, dims; own=false, ctx=context())
127127
128128
Wrap a `CuArray` object around the data at the address given by `ptr`. The pointer
129129
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
133133
"""
134134
function Base.unsafe_wrap(::Union{Type{CuArray},Type{CuArray{T}},Type{CuArray{T,N}}},
135135
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}
137137
xs = CuArray{T, length(dims)}(p, dims, false; ctx=ctx)
138138
if own
139139
base = convert(CuPtr{Cvoid}, p)
@@ -149,7 +149,7 @@ end
149149

150150
function Base.unsafe_wrap(Atype::Union{Type{CuArray},Type{CuArray{T}},Type{CuArray{T,1}}},
151151
p::CuPtr{T}, dim::Integer;
152-
own::Bool=false, ctx::CuContext=CuCurrentContext()) where {T}
152+
own::Bool=false, ctx::CuContext=context()) where {T}
153153
unsafe_wrap(Atype, p, (dim,); own=own, ctx=ctx)
154154
end
155155

src/rand/random.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mutable struct RNG <: Random.AbstractRNG
2222
handle_ref = Ref{curandGenerator_t}()
2323
@allocates curandCreateGenerator(handle_ref, typ)
2424

25-
obj = new(handle_ref[], CuCurrentContext(), typ)
25+
obj = new(handle_ref[], context(), typ)
2626
finalizer(unsafe_destroy!, obj)
2727
return obj
2828
end

0 commit comments

Comments
 (0)