# There is no Julia for AMD Epyc, is there?

**URL:** <https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713>\
**Category:** General Usage\
**Created:** [May 2, 2024, 12:08am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713 "2024-05-02T00:08:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [May 2, 2024, 12:08am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/1 "2024-05-02T00:08:01Z")

</div>

I would like to run a test on an AMD EPYC 7543 32-Core Processor. I guess unless I want to build Julia myself, I am out of luck?

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [May 2, 2024, 12:11am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/2 "2024-05-02T00:11:41Z")

</div>

Generic x86\_64 julia download will work fine. The system image is multi-versioned, so you won’t get fully tuned code out, but you’ll get a good enough version. Pkgimages compiled locally will be tuned to the microarchitecture.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 2, 2024, 12:43am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/3 "2024-05-02T00:43:22Z")

</div>

One thing to note is that Epyc is the one system that where MKL will do horrible things to your performance.

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [May 2, 2024, 2:55am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/4 "2024-05-02T02:55:37Z")

</div>

Bad, but not horrible (I haven’t tried other examples):

```julia
julia> using LinearAlgebra, BenchmarkTools

julia> N = 500; A = rand(N,N); As = similar(A);

julia> BLAS.set_num_threads(1);

julia> @benchmark lu!(copyto!($As,$A))
BenchmarkTools.Trial: 1999 samples with 1 evaluation.
 Range (min … max): 2.467 ms … 4.590 ms ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 2.484 ms ┊ GC (median): 0.00%
 Time (mean ± σ): 2.494 ms ± 75.584 μs ┊ GC (mean ± σ): 0.00% ± 0.00%

    ▃▄▁▂█▆▆▄▂▂                                                
  ▃▆██████████▇█▆▅▆▅▅▅▄▄▄▄▄▄▃▄▃▃▄▃▄▃▃▃▃▃▃▃▃▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂ ▄
  2.47 ms Histogram: frequency by time 2.57 ms <

 Memory estimate: 4.06 KiB, allocs estimate: 1.

julia> using MKL; BLAS.set_num_threads(1);

julia> @benchmark lu!(copyto!($As,$A))
BenchmarkTools.Trial: 1655 samples with 1 evaluation.
 Range (min … max): 2.987 ms … 5.348 ms ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 3.009 ms ┊ GC (median): 0.00%
 Time (mean ± σ): 3.018 ms ± 65.104 μs ┊ GC (mean ± σ): 0.00% ± 0.00%

          ▅▆██▇▄▄▂                                            
  ▁▁▁▂▅▇███████████▇▇▅▄▄▃▃▄▃▂▂▂▃▂▃▁▂▃▂▂▃▂▂▁▂▂▂▁▁▂▂▂▁▁▁▁▁▁▁▁▁ ▃
  2.99 ms Histogram: frequency by time 3.09 ms <

 Memory estimate: 4.06 KiB, allocs estimate: 1.

```

Multithreading was worse:

```julia
julia> @benchmark lu!(copyto!($As,$A))
BenchmarkTools.Trial: 1243 samples with 1 evaluation.
 Range (min … max): 3.771 ms … 12.269 ms ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 3.936 ms ┊ GC (median): 0.00%
 Time (mean ± σ): 4.009 ms ± 500.821 μs ┊ GC (mean ± σ): 0.00% ± 0.00%

    ▂█▂                                                        
  ▂▃███▇▅▅▄▅▄▅▄▇█▆▄▄▄▃▄▃▃▃▂▂▂▃▃▂▂▂▂▂▂▂▂▂▂▂▁▂▁▂▂▁▁▁▂▁▁▁▁▁▁▁▁▁▂ ▃
  3.77 ms Histogram: frequency by time 4.84 ms <

 Memory estimate: 4.06 KiB, allocs estimate: 1.

julia> using MKL

julia> @benchmark lu!(copyto!($As,$A))
BenchmarkTools.Trial: 535 samples with 1 evaluation.
 Range (min … max): 2.191 ms … 127.404 ms ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 7.341 ms ┊ GC (median): 0.00%
 Time (mean ± σ): 9.345 ms ± 8.530 ms ┊ GC (mean ± σ): 0.00% ± 0.00%

    ▃▅▇▅▇▆█▄▃▂▂▁▂ ▁ ▁                                          
  ▄▅█████████████▇█▁█▅▁▅▆▄▁▄▄▅▆▄▄▄▅▁▄▄▁▅▄▄▁▄▅▁▄▁▄▁▁▁▁▁▁▅▄▁▁▁▅ ▇
  2.19 ms Histogram: log(frequency) by time 43.4 ms <

 Memory estimate: 4.06 KiB, allocs estimate: 1.

```

9 ms mean time for MKL, vs 4ms for OpenBLAS!

Note that these were using the same size; OpenBLAS also slowed down by using multiple threads. RFLU was the clear winner for 500x500 LU on Epyc.

```julia
julia> @benchmark RecursiveFactorization.lu!(copyto!($As,$A))
BenchmarkTools.Trial: 2403 samples with 1 evaluation.
 Range (min … max): 2.050 ms … 2.707 ms ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 2.071 ms ┊ GC (median): 0.00%
 Time (mean ± σ): 2.077 ms ± 23.353 μs ┊ GC (mean ± σ): 0.00% ± 0.00%

       ▅▁▂▄█▅▇▅▄▅▂▂▂                                          
  ▂▂▃▃██████████████▇▇▇▅▅▅▅▅▄▄▄▄▃▃▄▃▃▄▅▃▂▃▃▂▂▃▃▂▂▂▂▂▂▂▂▂▂▂▂▁ ▃
  2.05 ms Histogram: frequency by time 2.13 ms <

 Memory estimate: 4.06 KiB, allocs estimate: 1.

```

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 2, 2024, 3:00am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/5 "2024-05-02T03:00:12Z")

</div>

The really big problem is that if you don’t set threads to 1 manually, it will try to use 64 threads to do a 10x10 matmul and is about 100x slower.

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [May 2, 2024, 4:02am UTC](https://discourse.julialang.org/t/there-is-no-julia-for-amd-epyc-is-there/113713/6 "2024-05-02T04:02:53Z")

</div>

I don’t see that.  
I do see that it is worse than OpenBLAS, but not 100x slower:

```julia
julia> N = 10; A = rand(N,N); As = similar(A);

julia> using LinearAlgebra, BenchmarkTools

julia> @benchmark mul!($As, $A, $A)
BenchmarkTools.Trial: 10000 samples with 331 evaluations.
 Range (min … max): 263.834 ns … 1.244 μs ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 282.414 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 282.021 ns ± 14.744 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

        ▁▁ ▂▅▄▃▃▃▂▁▁▂▃▂ ▁ ▁▇█▅▃▆▄▁▄▃ ▂▂ ▂▁ ▂▂ ▂
  ▅▄▁▄▅▇██████▆█████████████████████████████▆███▇██▇▆▇▇▆▅▆▅▆▄▅ █
  264 ns Histogram: log(frequency) by time 299 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> using MKL

julia> @benchmark mul!($As, $A, $A)
BenchmarkTools.Trial: 10000 samples with 227 evaluations.
 Range (min … max): 324.621 ns … 2.547 μs ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 329.559 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 330.965 ns ± 30.569 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

    ▃▅▄▄█▇▆▅▇▅▁                                                 
  ▃▆███████████▆▄▃▃▃▃▃▃▃▄▃▂▂▂▂▂▂▂▁▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂ ▃
  325 ns Histogram: frequency by time 361 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> BLAS.set_num_threads(32);

julia> @benchmark mul!($As, $A, $A)
BenchmarkTools.Trial: 10000 samples with 232 evaluations.
 Range (min … max): 322.366 ns … 21.595 μs ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 327.625 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 330.724 ns ± 212.910 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

   █▇▄▁▂ ▁▁ ▂▅▂                                           
  ▇██████▆▇███▇▇▆▄▅████▅▄▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂ ▄
  322 ns Histogram: frequency by time 355 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 64 × AMD EPYC 7513 32-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 64 default, 0 interactive, 32 GC (on 64 virtual cores)
Environment:
  LD_UN_PATH = /usr/local/lib/x86_64-unknown-linux-gnu/:/usr/local/lib/
  LD_LIBRARY_PATH = /usr/local/lib/x86_64-unknown-linux-gnu/:/usr/local/lib/
  JULIA_PATH = @.
  JULIA_NUM_THREADS = 64

julia> BLAS.get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries: 
├ [ILP64] libmkl_rt.so
└ [LP64] libmkl_rt.so

julia> BLAS.set_num_threads(1);

julia> @benchmark mul!($As, $A, $A)
BenchmarkTools.Trial: 10000 samples with 232 evaluations.
 Range (min … max): 322.284 ns … 9.219 μs ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 324.651 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 326.579 ns ± 89.074 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

  ▅███▇▇▇▆▆▅▄▄▃▂▁▁ ▁▁ ▁ ▃
  █████████████████████▇████▇▇▇▇▇▇▆▆▃▆▃▁▅▄▄▅▆▆▆▆▆▆▆▄▅▃▅▅▄▃▃▄▁▅ █
  322 ns Histogram: log(frequency) by time 353 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

```

Maybe you’re thinking of BLIS, or perhaps MKL fixed it?
