Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPUArrays seeding does not generate reproducible values past a certain array size #530

Open
christiangnrd opened this issue Apr 12, 2024 · 3 comments
Labels

Comments

@christiangnrd
Copy link
Contributor

Tested on main. Seems to be a Metal-specific issue as the test passes with JLArrays.

using Metal, GPUArrays, Random, Test
begin
    AT = MtlArray
    a = AT(zeros(Float32, 1000,1000))
    b = AT(zeros(Float32, 1000,1000))

    rng = GPUArrays.default_rng(AT)

    Random.seed!(rng, 1234)
    s1 = copy(rng.state)
    rand!(rng, a)
    s2 = copy(rng.state)

    Random.seed!(rng, 1234)
    s3 = copy(rng.state)
    rand!(rng, b)
    s4 = copy(rng.state)

    @show s1 != s2
    @show s3 != s4
    @show s1 == s3
    @show s2 == s4

    @show collect(a) == collect(b)
end
@christiangnrd
Copy link
Contributor Author

Ok this also affects CUDA.jl. Should I also submit this to CUDA.jl or is this a GPUArrays issue?

@maleadt
Copy link
Member

maleadt commented Apr 15, 2024

If it's because of the GPUArrays RNG it is probably better to move it there.

@christiangnrd

This comment was marked as outdated.

@maleadt maleadt transferred this issue from JuliaGPU/Metal.jl Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants