AMDGPU-error

Hi,

on my manjaro (arch linux) system (with a ryzen 4500u, no dedicated GPU) I get an error initiating a simple ROCArray:

a=ROCArray([1,2,3])
3-element ROCVector{Int64}:
Error showing value of type ROCVector{Int64}:
ERROR: could not load library ""
/home/olep/.julia/artifacts/aa6ac134081d81525be58c62abcb37f3e75029a5/lib/: cannot read file data: Is a directory
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/AMDGPU/mNX1n/src/hip/error.jl:149 [inlined]
  [2] hipStreamSynchronize(stream::Ptr{Nothing})
    @ AMDGPU.HIP ~/.julia/packages/AMDGPU/mNX1n/src/hip/libhip.jl:2
  [3] wait!(ss::AMDGPU.SyncState)
    @ AMDGPU ~/.julia/packages/AMDGPU/mNX1n/src/sync.jl:19
  [4] wait!
    @ ~/.julia/packages/AMDGPU/mNX1n/src/array.jl:83 [inlined]
  [5] copyto!(dest::Vector{Int64}, d_offset::Int64, source::ROCVector{Int64}, s_offset::Int64, amount::Int64)
    @ AMDGPU ~/.julia/packages/AMDGPU/mNX1n/src/array.jl:173
  [6] copyto!
    @ ~/.julia/packages/GPUArrays/Z5nPF/src/host/abstractarray.jl:95 [inlined]
  [7] copyto_axcheck!
    @ ./abstractarray.jl:1056 [inlined]
  [8] Array
    @ ./array.jl:540 [inlined]
  [9] Array
    @ ./boot.jl:472 [inlined]
 [10] convert
    @ ./array.jl:532 [inlined]
 [11] adapt_storage
    @ ~/.julia/packages/GPUArrays/Z5nPF/src/host/abstractarray.jl:45 [inlined]
 [12] adapt_structure
    @ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:42 [inlined]
 [13] adapt
    @ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:40 [inlined]
 [14] print_array
    @ ~/.julia/packages/GPUArrays/Z5nPF/src/host/abstractarray.jl:48 [inlined]
 [15] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, X::ROCVector{Int64})
    @ Base ./arrayshow.jl:368
 [16] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:220
 [17] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [18] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:213
 [19] display(d::REPL.REPLDisplay, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:225
 [20] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [21] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [22] invokelatest
    @ ./essentials.jl:706 [inlined]
 [23] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:247
 [24] (::REPL.var"#40#41"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:231
 [25] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [26] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:229
 [27] (::REPL.var"#do_respond#61"{Bool, Bool, REPL.var"#72#82"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:798
 [28] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [29] invokelatest
    @ ./essentials.jl:706 [inlined]
 [30] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
 [31] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
 [32] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:411

Also my computer totally crashes when running the test command on the package (graphic bugs all over the screen, only fixed after reboot).
Any idea what’s going on?

I think the underlying ROCm (“AMD CUDA”) doesn’t support non-dedicated GPUs. See here for a list of supported GPUs. Probably it doesn’t make much sense to use it without a proper GPU anyway.

That’s a but sad but sounds plausible. I just wanted to try out GPU computing and get my hands on it, so actual speed would not have mattered anyways…

1 Like

@peteole, You’re simply missing libhipamd64_.so. Try installing AMDGPU@0.2.10 or above, it should ship with HIP_jll. I have AMD Ryzen 7 PRO 4750U with Radeon Graphics and I can run basic examples just fine!

Many thanks to @jpsamaroo for singlehandedly making this happen on AMD GPUs!

2 Likes

I also have this when using my laptop APU; try updating to a very recent Linux kernel (5.12 or so) and it should work far better. And of course, as @abulak pointed out, make sure to keep an eye on AMDGPU releases and use the latest one!

Actually one of the key considerations around HSA (ROCR) and HIP was supporting heterogeneous systems like APUs. The lack of good support for APUs in practice is due to the complexity of supporting all the different kinds of GPUs that AMD produces, with all their quirks and different features, and getting all of that code upstream into Linux and LLVM.

2 Likes

Hmm you are right. I wonder what happened to OpenCL by the way… it had the same intentions, but now it seems buried in the past like a maya temple.

OpenCL.jl still exists, but since it doesn’t compose well with other Julia code, it’s not often used.

This really fixed it, thanks! How does the package versioning work in julia? I am a bit confused since I installed the amdgpu package a few days ago so I expected it to be up to date… Is 5.11 a beta version and you normally get the stable one?

I was already on 5.13 :innocent: it crashed again when running the test command, but when just trying my stuff it seems stable now.

Sorry for replying to such an old post, but I was trying AMDGPU.jl with an AMD APU. I was convinced that ROCm did not support APU’s, but this tread gave me hope that it might work.

I have a desktop with a Ryzen 4750G APU. I am running linux (Kubuntu 21.10 with a 5.17 kernel), with Julia version 1.7.3, AMDGPU.jl v0.3.3

So far, I have not been successful.

I get the following warning:

julia> using AMDGPU
┌ Warning: HSA runtime has not been built, runtime functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: Failed to initialize HSA runtime, status code: 4104
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:187
┌ Warning: ld.lld was not found, compilation functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:201
┌ Warning: ROCm-Device-Libs were not found, device intrinsics will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:215
┌ Warning: HIP library has not been built, HIP integration will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:231
┌ Warning: rocRAND_jll failed to load, RNG functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: false
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:245

If I try to build the package, I get:

(@v1.7) pkg> build AMDGPU
    Building AMDGPU → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/24cb88a8b763e4fe3c0be7eb3cc43505541b8581/build.log`
Precompiling project...
  ✓ AMDGPU
  1 dependency successfully precompiled in 8 seconds (180 already precompiled)
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version

If I test the package,

(@v1.7) pkg> test AMDGPU

I obtain:

     Testing Running tests...
┌ Warning: HSA runtime has not been built, runtime functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: Failed to initialize HSA runtime, status code: 4104
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:187
┌ Warning: ld.lld was not found, compilation functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:201
┌ Warning: ROCm-Device-Libs were not found, device intrinsics will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:215
┌ Warning: HIP library has not been built, HIP integration will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:231
┌ Warning: rocRAND_jll failed to load, RNG functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: false
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:245
AMDGPU: Test Failed at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:37
  Expression: AMDGPU.functional()
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
 [2] macro expansion
   @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:37 [inlined]
 [3] macro expansion
   @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
 [4] top-level scope
   @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:33
AMDGPU: Error During Test at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:31
  Got exception outside of a @test
  AssertionError: AMDGPU.functional()
  Stacktrace:
   [1] macro expansion
     @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:38 [inlined]
   [2] macro expansion
     @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
   [3] top-level scope
     @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:33
   [4] include(fname::String)
     @ Base.MainInclude ./client.jl:451
   [5] top-level scope
     @ none:6
   [6] eval
     @ ./boot.jl:373 [inlined]
   [7] exec_options(opts::Base.JLOptions)
     @ Base ./client.jl:268
   [8] _start()
     @ Base ./client.jl:495
Test Summary: | Pass  Fail  Error  Total
AMDGPU        |   43     1      1     45
  Core        |   43                  43
ERROR: LoadError: Some tests did not pass: 43 passed, 1 failed, 1 errored, 0 broken.
in expression starting at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:31
ERROR: Package AMDGPU errored during testing

Has anyone encountered this before?

What permissions are on /dev/kfd and /dev/dri/*? This error often comes from having insufficient permissions to open those devices with read+write access.