Can't get gpu recognized: AMDGPU.functional(:MIOpen) returns false

I got the FastAI example from the readme running on cpu, so now tried to move to gpu after installing ROCm 5.7.1. It still reverted to CPU:

fitonecycle!(learner, 1)
┌ Info: The GPU function is being called but the GPU is not accessible. 
└ Defaulting back to the CPU. (No action is required if you want to run on the CPU).

It appears to be recognized but fails the MIOpen test:

julia> using AMDGPU

julia> AMDGPU.device()
GPU-048e90c172fc1a8a [AMD Radeon VII (gfx906)]

julia> AMDGPU.functional()
true

julia> AMDGPU.functional(:MIOpen)
false

https://fluxml.ai/Flux.jl/stable/gpu/

The hip backend is installed according to apt:

miopen-hip-dev/jammy,now 2.20.0.50701-98~22.04 amd64 [installed,automatic]
miopen-hip/jammy,now 2.20.0.50701-98~22.04 amd64 [installed]

From here I see there is also an OpenCL version:

MIOpen can be installed on Ubuntu using apt-get.

For OpenCL backend: apt-get install miopen-opencl

For HIP backend: apt-get install miopen-hip

Currently both the backends cannot be installed on the same system simultaneously. If a different backend other than what currently exists on the system is desired, please uninstall the existing backend completely and then install the new backend.
Build and Install Instructions — MIOpen: AMD's deep learning library

But (after uninstalling miopen-hip) that version is not found:

sudo apt-get install miopen-opencl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package miopen-opencl is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'miopen-opencl' has no installation candidate

Do I need to install miopen-opencl from somewhere else? How could I figure out why I am getting this error?

Also, here is the environment. It should all be up-to-date:

julia> 
Julia Version 1.9.4
Commit 8e5136fa297 (2023-11-14 08:46 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 64 × AMD Ryzen Threadripper 2990WX 32-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver1)
  Threads: 2 on 64 virtual cores

⌃ [21141c5a] AMDGPU v0.4.15
  [a8cc5b0e] Crayons v4.1.1
⌃ [a93c6f00] DataFrames v1.3.6
  [864edb3b] DataStructures v0.18.15
  [31c24e10] Distributions v0.25.103
  [634d3b9d] DrWatson v2.13.0
  [5d0beca9] FastAI v0.5.2
  [ca994201] FastMakie v0.1.1
  [d896c661] FastTabular v0.1.1
  [7bf02486] FastVision v0.1.1
  [dbeba491] Metalhead v0.9.0
  [3beb2ed1] PDFmerger v0.3.0
  [6f49c342] RCall v0.13.18
⌅ [2913bbd2] StatsBase v0.33.21
  [f3b207a7] StatsPlots v0.15.6
  [dbf13d8f] ThreadTools v0.2.0
⌅ [b8865327] UnicodePlots v2.12.4
  [de0858da] Printf
  [9a3f8284] Random

Sorry, for spamming but I have no idea what is relevant here. I added Flux (rather than just FastAI) and changed the gpu backend:

Flux.gpu_backend!("AMD")
┌ Info: New GPU backend set: AMD.
└ Restart your Julia session for this change to take effect!

Now got this warning, which seems like progress:

fitonecycle!(learner, 1)
┌ Warning: MIOpen is not functional in AMDGPU.jl, some functionality will not be available.
└ @ AMDGPUExt ~/.julia/packages/Flux/n3cOc/ext/AMDGPUExt/AMDGPUExt.jl:24

And then this error:

It tells me:

┌ Warning: Performing scalar indexing on task Task (runnable) @0x00007fcaf6139dc0.

│ Invocation of getindex resulted in scalar indexing of a GPU array.

│ This is typically caused by calling an iterating implementation of a method.

│ Such implementations *do not* execute on the GPU, but very slowly on the CPU,

│ and therefore are only permitted from the REPL for prototyping purposes.

│ If you did intend to index this array, annotate the caller with @allowscalar.

└ @ GPUArraysCore ~/.julia/packages/GPUArraysCore/uOYfN/src/GPUArraysCore.jl:106

This should have been version 0.8, but was downgraded by the package manager due to FastAI to 0.6.1, then I guess further by some other package:

AMDGPU v0.4.15

So my original question is solved, looks like this is another dependency issue with FastAI. So I still can’t run that demo, but the problem wasn’t with AMDGPU or MIOpen.

Hope that helps someone…

1 Like