From c23e09f43d534216e6bbaf5ba29499c3d31364f5 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 10 Dec 2024 14:56:44 +0100 Subject: [PATCH] Use host memory to prevent OOM. --- test/base/random.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/base/random.jl b/test/base/random.jl index d98a2bf04d..d48cf7288b 100644 --- a/test/base/random.jl +++ b/test/base/random.jl @@ -200,7 +200,12 @@ end @testset "counter overflow" begin rng = CUDA.RNG() - c = CUDA.zeros(Float16, (64, 32, 512, 32, 64)) - rand!(rng, c) - randn!(rng, c) + # we may not be able to allocate over 4GB on the GPU, so use CPU memory + #c = CUDA.zeros(Float16, (64, 32, 512, 32, 64)) + c = Array{Float16}(undef, 64, 32, 512, 32, 64) + GC.@preserve c begin + dc = unsafe_wrap(CuArray, c) + rand!(rng, dc) + randn!(rng, dc) + end end