JuliaGPU/AMDGPU.jl

`rand`: MethodError: no method matching `rng_native_52(::GPUArrays.RNG)`

omlins opened this issue · 0 comments

omlins commented

When running the following unit test using rand (found here: https://github.com/omlins/ParallelStencil.jl/blob/amdgpu2/test/ParallelKernel/test_allocators.jl#L401)

@test typeof(@rand(2,3, celldims=(3,4), eltype=Phase))                          == typeof(ROCCellArray{T_Phase,0}(undef,2,3))

the following error occurs:

5. Enums: Error During Test at /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/test/ParallelKernel/test_allocators.jl:401
  Test threw exception
  Expression: typeof(#= /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/test/ParallelKernel/test_allocators.jl:401 =# @rand(2, 3, celldims = (3, 4), eltype = Phase)) == typeof(ROCCellArray{T_Phase, 0}(undef, 2, 3))
  MethodError: no method matching rng_native_52(::GPUArrays.RNG)
  
  Closest candidates are:
    rng_native_52(::RandomNumbers.AbstractRNG)
     @ RandomNumbers /scratch/project_465000105/saomlin/julia_local/julia_depot/packages/RandomNumbers/3pD1N/src/common.jl:16
    rng_native_52(::Random.Xoshiro)
     @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Xoshiro.jl:75
    rng_native_52(::Random.TaskLocalRNG)
     @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Xoshiro.jl:114
    ...
  
  Stacktrace:
    [1] rand(r::GPUArrays.RNG, #unused#::Random.SamplerTrivial{Random.UInt52Raw{UInt64}, UInt64})
      @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/generation.jl:114
    [2] rand(rng::GPUArrays.RNG, X::Random.UInt52Raw{UInt64})
      @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Random.jl:256
    [3] rand(r::GPUArrays.RNG, #unused#::Random.SamplerTrivial{Random.UInt52{UInt64}, UInt64})
      @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/generation.jl:125
    [4] rand(rng::GPUArrays.RNG, sp::Random.SamplerSimple{Tuple{Phase, Phase, Phase}, Random.SamplerTrivial{Random.UInt52{UInt64}, UInt64}, Phase})
      @ Random /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/generation.jl:537
    [5] rand!
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Random.jl:274 [inlined]
    [6] rand!
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Random.jl:270 [inlined]
    [7] rand
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Random.jl:291 [inlined]
    [8] rand
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Random/src/Random.jl:294 [inlined]
    [9] rand!
      @ /scratch/project_465000105/saomlin/julia_local/julia_depot/packages/GPUArrays/t0LfC/src/host/random.jl:114 [inlined]
   [10] rand!
      @ /scratch/project_465000105/saomlin/julia_local/julia_depot/packages/AMDGPU/9VGcR/src/random.jl:53 [inlined]
   [11] rand
      @ /scratch/project_465000105/saomlin/julia_local/julia_depot/packages/AMDGPU/9VGcR/src/random.jl:62 [inlined]
   [12] rand_amdgpu(#unused#::Type{SMatrix{3, 4, Phase, 12}}, #unused#::Val{0}, dims::Tuple{Int64, Int64})
      @ ParallelStencil.ParallelKernel /scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/src/ParallelKernel/allocators.jl:439
   [13] rand_amdgpu(::Type{SMatrix{3, 4, Phase, 12}}, ::Val{0}, ::Int64, ::Int64)
      @ ParallelStencil.ParallelKernel /scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/src/ParallelKernel/allocators.jl:440
   [14] macro expansion
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Test/src/Test.jl:477 [inlined]
   [15] macro expansion
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/test/ParallelKernel/test_allocators.jl:401 [inlined]
   [16] macro expansion
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Test/src/Test.jl:1496 [inlined]
   [17] macro expansion
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/test/ParallelKernel/test_allocators.jl:385 [inlined]
   [18] macro expansion
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia-150590ce51/share/julia/stdlib/v1.10/Test/src/Test.jl:1496 [inlined]
   [19] top-level scope
      @ /pfs/lustrep2/scratch/project_465000105/saomlin/julia_local/julia_depot/dev/ParallelStencil/test/ParallelKernel/test_allocators.jl:22

Note that with CUDA.jl the analog test succeeds.