JuliaGPU / JuliaGPU/AMDGPU.jl

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

Open
#429 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
344
Forks
79
Avg merge
2d 19h
Merged PRs (30d)
25

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ParallelStencil's src/ParallelKernel/allocators.jl at lines 439-440 and the AMDGPU random path shown at AMDGPU/src/random.jl:53. Reproduce the failure using test/ParallelKernel/test_allocators.jl around line 401, then compare the successful CUDA analog. Done means the rand allocator test completes without the rng_native_52 MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
hpc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.