Skip to content

Commit 6ca54e3

Browse files
committed
Fix cuda-memcheck, don't use memory pools.
1 parent 4a1af44 commit 6ca54e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/cudadrv/memory.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ using Base: @deprecate_binding
1111

1212
using Printf
1313

14+
using Memoize
15+
1416

1517
#
1618
# buffers
@@ -54,6 +56,8 @@ Base.show(io::IO, buf::DeviceBuffer) =
5456
Base.convert(::Type{CuPtr{T}}, buf::DeviceBuffer) where {T} =
5557
convert(CuPtr{T}, pointer(buf))
5658

59+
@memoize has_stream_ordered() = CUDA.version() >= v"11.2" && !haskey(ENV, "CUDA_MEMCHECK")
60+
5761
"""
5862
Mem.alloc(DeviceBuffer, bytesize::Integer;
5963
[async=false], [stream::CuStream], [pool::CuMemoryPool])
@@ -65,7 +69,7 @@ for access on the CPU.
6569
function alloc(::Type{DeviceBuffer}, bytesize::Integer;
6670
async::Bool=false, stream::CuStream=stream(),
6771
pool::Union{Nothing,CuMemoryPool}=nothing,
68-
stream_ordered::Bool=CUDA.version() >= v"11.2")
72+
stream_ordered::Bool=has_stream_ordered())
6973
bytesize == 0 && return DeviceBuffer(CU_NULL, 0)
7074

7175
ptr_ref = Ref{CUDA.CUdeviceptr}()

0 commit comments

Comments
 (0)