docker-library / julia

Docker Official Image packaging for julia

Home Page:http://julialang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latest docker fails on iMac Pro (2017) due to OpenBLAS bug

gabor1 opened this issue · comments

Using default tag: latest
latest: Pulling from library/julia
123275d6e508: Pull complete 
1003677cbe41: Pull complete 
a8d00b251851: Pull complete 
Digest: sha256:897d4307b3e7745cf19888b1ba860db0676c4429360250221aeabe10cea374b7
Status: Downloaded newer image for julia:latest
docker.io/library/julia:latest
104:tmp gabor$ docker run -it  julia
Invalid instruction at 0x7f0d910cdba8: 0x62, 0xf1, 0x7d, 0x48, 0xef, 0xc0, 0xc3, 0x90, 0x89, 0xc2, 0x83, 0xe2, 0xe0, 0x0f, 0x8e

signal (4): Illegal instruction
in expression starting at none:0
dot_compute at /usr/local/julia/bin/../lib/julia/libopenblas64_.so (unknown line)
Allocations: 2505 (Pool: 2496; Big: 9); GC: 0
104:tmp gabor$ 

I think it's related to JuliaLang/julia#34097

I can't reproduce: 😕

$ docker pull julia
Using default tag: latest
latest: Pulling from library/julia
Digest: sha256:897d4307b3e7745cf19888b1ba860db0676c4429360250221aeabe10cea374b7
Status: Image is up to date for julia:latest
docker.io/library/julia:latest

$ docker run -it --rm julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.1 (2020-04-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> 2 + 2
4

Can't reproduce either -- I think that OpenBLAS bug is specific to some hardware, see JuliaLang/julia#29652 and fixed in OpenBLAS 0.36. Unfortunately Julia 1.4 uses 0.35. Comments in that issue suggests that it was only broken inside docker, does Julia 1.4.1 work outside docker for you?

You could try this suggestion: JuliaLang/julia#34097 (comment) and upgrade to OpenBLAS 0.39. Here is a Dockerfile (can't verify it fixes your problem since I can't reproduce it though):

FROM julia:1.4.1
RUN mkdir /tmp/blas && \
    curl -L -o /tmp/blas/blas.tar.gz "https://github.com/JuliaBinaryWrappers/OpenBLAS_jll.jl/releases/download/OpenBLAS-v0.3.9+2/OpenBLAS.v0.3.9.x86_64-linux-gnu-libgfortran4.tar.gz" && \
    tar -C /tmp/blas -xzf /tmp/blas/blas.tar.gz && \
    cp /tmp/blas/lib/libopenblas* /usr/local/julia/lib/julia/ && \
    rm -r /tmp/blas

(You might have to change the URL if you have another architechture, see https://github.com/JuliaBinaryWrappers/OpenBLAS_jll.jl/blob/bc012a71eea6796b7fb332c2ed519014148ec639/Artifacts.toml.)

Result:

$ docker build -t julia:1.4.1-blasfix .

$ docker run -ti --rm julia:1.4.1-blasfix julia -E 'import LinearAlgebra.BLAS; BLAS.openblas_get_config()'
"OpenBLAS 0.3.9  USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=32"

and the original image has 0.3.5:

$ docker run -ti --rm julia:1.4.1 julia -E 'import LinearAlgebra.BLAS; BLAS.openblas_get_config()'
"OpenBLAS 0.3.5  USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=32"

This worked, thanks for the tip! I'll keep it in there until julia deigns to update its openblas. why does it use its own openblas anyway?

Yeah this bug requires:

  1. An old enough version of OpenBLAS
  2. Some kind of virtualization. Docker for Mac uses a virtualization layer.
  3. Specific CPUs, including but not limited to CPUs with the Skylake or Coffee Lake microarch.

Julia 1.4 has an old version of OpenBLAS. But Julia 1.5/Julia 1.6/Julia nightly/Julia master has a new enough version of OpenBLAS, so this bug doesn't occur with Julia 1.5 or later.

So I think this issue can be closed?