How to correctly install Julia in Renoir platform?

I am using a laptop with AMD Renoir CPU, the operating system is Manjaro under WSL2. Under a simple performance test there appears to be a major performance problem:

julia> versioninfo()

Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 4600HS with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, znver1)

julia> using LinearAlgebra

julia> LinearAlgebra.versioninfo()
BLAS: libopenblas (OpenBLAS 0.3.10 NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY USE_OPENMP Prescott MAX_THREADS=64)
LAPACK: liblapack

I assume that it is recognized as a Prescott CPU and the performance does not surprise me:

julia> peakflops(10_000)
7.764909084542572e10 

For a 6c12t processor it should not be right as my 7200U laptop has about 5e10 on battery. To add it gives basically same result in the Windows version of Julia.

I tried also to download from GitHub and compile it myself. With a naive compilation it gives:

julia> versioninfo()
Julia Version 1.6.0-DEV.531
Commit 3dc49ca18d (2020-07-24 05:37 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 4600HS with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, btver1)

julia> using LinearAlgebra

julia> LinearAlgebra.versioninfo()
BLAS: libopenblas (OpenBLAS 0.3.9  USE64BITINT DYNAMIC_ARCH NO_AFFINITY Prescott MAX_THREADS=32)
LAPACK: libopenblas64_

julia> peakflops(10_000)
5.056306894529036e10

To make things worse now the LLVM is even Bristol Ridge arch. I may be able to solve the part of OpenBLAS but the LLVM is confusing. Since I am pretty much a starter and using Julia as a learning tool instead of coping with compilation first, how should I fix the performance problem and have the hardware recognized correctly? BTW, I would expect step-to-step procedures since I suppose it is not only me but many other users new to Julia.

To add: This thread reported a similar Prescott problem. However, I suppose MKL to be a not acceptable solution for Zen CPUs and the “Prescott” should have an easy debug mode to override.


Update: I reinstalled and reconfigured the libopenblas from AUR, now the system Julia has:

julia> LinearAlgebra.versioninfo()
BLAS: libopenblas (OpenBLAS 0.3.10 NO_AFFINITY USE_OPENMP ZEN MAX_THREADS=12)
LAPACK: liblapack

julia> peakflops(10_000)
1.9276897177522015e11

It now saves me from the annoyance and enables me to focus on actual coding and real problems. However, I still suggest there being problems since I tried editing Make.user too and it didn’t work at all.

Did you ever check how many threads BLAS was using? It is possible that you were not fully utilizing your CPU on your first tests. For example, I get about 5.7e10 with only 1 thread, but like 2.4e11 with 6 threads.

See this discussion

1 Like

I checked, no problem there and they are normal. Seems it is a problem of OpenBLAS not recognizing the CPU and falling back to Pentium 4 settings. I would hope though this shouldn’t be solved by recompilation like what I did latter.

I am also having the same issue on a Ryzen 7 4700U.

I made an issue to track this: https://github.com/JuliaLang/julia/issues/36826

1 Like

To follow up, a patch was merged for LLVM to detect Renoir as znver2 which will be in 1.6.

For OpenBLAS, a patch was also merged, but in the meantime the architecture can be selected with an environment variable: OPENBLAS_CORETYPE=ZEN.

julia> LinearAlgebra.versioninfo()
BLAS: libopenblas (OpenBLAS 0.3.5  USE64BITINT DYNAMIC_ARCH NO_AFFINITY Zen MAX_THREADS=32)
LAPACK: libopenblas64_
1 Like