Skip to content

Commit 54bf5b0

Browse files
committed
Native RNG: Improve randn determinism by using fixed grid.
1 parent 478a952 commit 54bf5b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/random.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ function Random.randn!(rng::RNG, A::AnyCuArray{<:Union{AbstractFloat,Complex{<:A
150150
return
151151
end
152152

153-
kernel = @cuda launch=false name="rand!" kernel(A, rng.seed, rng.counter)
154-
config = launch_configuration(kernel.fun; max_threads=64)
155-
threads = max(32, min(config.threads, length(A)÷2))
156-
blocks = min(config.blocks, cld(cld(length(A), 2), threads))
157-
kernel(A, rng.seed, rng.counter; threads, blocks)
153+
# see note in `rand!` about the launch configuration
154+
threads = 32
155+
blocks = cld(cld(length(A), 2), threads)
156+
157+
@cuda threads=threads blocks=blocks name="randn!" kernel(A, rng.seed, rng.counter)
158158

159159
new_counter = Int64(rng.counter) + length(A)
160160
overflow, remainder = fldmod(new_counter, typemax(UInt32))

0 commit comments

Comments
 (0)