Skip to content

Commit 774abc6

Browse files
authored
Fix resize! when pool=none is in use (#2613)
1 parent 1389800 commit 774abc6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/cudadrv/memory.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ GPU, and requires explicit calls to `unsafe_copyto!`, which wraps `cuMemcpy`,
5959
for access on the CPU.
6060
"""
6161
function alloc(::Type{DeviceMemory}, bytesize::Integer;
62-
async::Bool=memory_pools_supported(device()),
62+
async::Bool=false,
6363
stream::Union{Nothing,CuStream}=nothing,
6464
pool::Union{Nothing,CuMemoryPool}=nothing)
6565
bytesize == 0 && return DeviceMemory()

src/array.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,14 +838,14 @@ function Base.resize!(A::CuVector{T}, n::Integer) where T
838838
# replace the data with a new one. this 'unshares' the array.
839839
# as a result, we can safely support resizing unowned buffers.
840840
new_data = context!(context(A)) do
841-
mem = alloc(memory_type(A), bufsize)
841+
mem = pool_alloc(memory_type(A), bufsize)
842842
ptr = convert(CuPtr{T}, mem)
843843
m = min(length(A), n)
844844
if m > 0
845845
synchronize(A)
846846
unsafe_copyto!(ptr, pointer(A), m)
847847
end
848-
DataRef(pool_free, Managed(mem))
848+
DataRef(pool_free, mem)
849849
end
850850
unsafe_free!(A)
851851

0 commit comments

Comments
 (0)