Open
Description
Currently we have the following error (show for CUDA but the same happens with Metal).
julia> using GPUArrays, CUDA
julia> rng = GPUArrays.default_rng(CuArray);
julia> rand(rng, 5)
ERROR: MethodError: no method matching rng_native_52(::GPUArrays.RNG)
The function `rng_native_52` exists, but no method is defined for this combination of argument types.
Closest candidates are:
rng_native_52(::Random.MersenneTwister)
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/RNGs.jl:439
rng_native_52(::Random.RandomDevice)
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/RNGs.jl:36
rng_native_52(::Random.TaskLocalRNG)
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Xoshiro.jl:230
...
Stacktrace:
[1] rand(r::GPUArrays.RNG, ::Random.SamplerTrivial{Random.UInt52Raw{UInt64}, UInt64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/generation.jl:114
[2] rand(rng::GPUArrays.RNG, X::Random.UInt52Raw{UInt64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:255
[3] rand(r::GPUArrays.RNG, ::Random.SamplerTrivial{Random.UInt52{UInt64}, UInt64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/generation.jl:125
[4] rand(rng::GPUArrays.RNG, X::Random.UInt52{UInt64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:255
[5] rand(r::GPUArrays.RNG, ::Random.SamplerTrivial{Random.CloseOpen12{Float64}, Float64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/generation.jl:32
[6] rand(rng::GPUArrays.RNG, X::Random.CloseOpen12{Float64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:255
[7] rand(r::GPUArrays.RNG, ::Random.SamplerTrivial{Random.CloseOpen01{Float64}, Float64})
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/generation.jl:35
[8] rand!
@ ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:273 [inlined]
[9] rand!
@ ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:269 [inlined]
[10] rand
@ ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:290 [inlined]
[11] rand(r::GPUArrays.RNG, dims::Int64)
@ Random ~/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:278
[12] top-level scope
@ REPL[17]:1
Is there anything blocking an implementation of rand(rng, n)
? Notice that the following works fine instead:
julia> rng = CUDA.default_rng()
CUDA.RNG(0xe8e5e5ff, 0x00000029)
julia> rand(rng, 5)
5-element CuArray{Float32, 1, CUDA.DeviceMemory}:
0.45878232
0.55591
0.1085031
0.66130507
0.47421575
Metadata
Metadata
Assignees
Labels
No labels