# Using AMDGPU.jl with an AMD APU

**URL:** <https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134>\
**Category:** GPU\
**Created:** [May 26, 2022, 11:38am UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134 "2022-05-26T11:38:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Amorim](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Post date:** [May 26, 2022, 11:38am UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134/1 "2022-05-26T11:38:53Z")

</div>

I was trying `AMDGPU.jl` with an AMD APU. I was convinced that ROCm did not support APU’s, but [this thread](https://discourse.julialang.org/t/amdgpu-error/64990/11) 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
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:

```julia
(@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:

```julia
     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?

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [May 28, 2022, 4:19am UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134/2 "2022-05-28T04:19:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bruno\_Amorim](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Post date:** [June 2, 2022, 11:10am UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134/3 "2022-06-02T11:10:11Z")

</div>

Thank you for your reply. These are the premissions of those files/folders:

```julia
(base) bamorim@bamorim-AMD-4750g:/dev$ ls -l kfd
crw-rw---- 1 root render 510, 0 jun 2 10:38 kfd

```

```julia
(base) bamorim@bamorim-AMD-4750g:/dev$ ls -l dri
total 0
drwxr-xr-x 2 root root 80 jun 2 10:38 by-path
crw-rw----+ 1 root video 226, 0 jun 2 10:38 card0
crw-rw----+ 1 root render 226, 128 jun 2 10:38 renderD128

```

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [June 2, 2022, 12:58pm UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134/4 "2022-06-02T12:58:49Z")

</div>

Do you have both the `video` and `render` groups assigned to your user? If so, these look fine to me.

---

<div class="post-metadata">

**Author:** ![Bruno\_Amorim](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Post date:** [June 2, 2022, 2:02pm UTC](https://discourse.julialang.org/t/using-amdgpu-jl-with-an-amd-apu/82134/5 "2022-06-02T14:02:33Z")

</div>

That was probably the problem. My user was not listed as a member of the `video` and `render` groups. I added my user to those groups and the warnings went away!

Thanks a lot @jpsamaroo !

Now its time to explore how things work with the APU.
