Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with openblas in IJulia/vscode/Juno in 1.6.4 #888

Closed
ctkelley opened this issue Nov 27, 2021 · 14 comments
Closed

Problems with openblas in IJulia/vscode/Juno in 1.6.4 #888

ctkelley opened this issue Nov 27, 2021 · 14 comments

Comments

@ctkelley
Copy link

This line of code

n=512; L=rand(n,n); z=rand(n); b=L\z;

runs in the REPL and in IJUlia with 1.6.3. I get a StackOverflowError: in IJulia under 1.6.4. Running Monterey. Others report the same problem in vscode and Juno.

Please see
https://discourse.julialang.org/t/downgrade-to-1-6-3/72129/2

@metab0t
Copy link

metab0t commented Nov 27, 2021

图片

Reproduced on Windows 10 with Julia 1.6.4 and IJulia 1.23.2.
It is strange that it works when n <= 65 and fails when n > 65.

@KristofferC
Copy link
Member

I wonder if it has something to do with https://github.com/JuliaLang/julia/issues/43008

@daviehh
Copy link

daviehh commented Nov 27, 2021

With https://github.com/JuliaLang/julia/issues/43008, I can somewhat get around the stackoverflow with setting blas thread to 1 with BLAS.set_num_threads(1), does it work for you?

@metab0t
Copy link

metab0t commented Nov 28, 2021

With #886, I can somewhat get around the stackoverflow with setting blas thread to 1 with BLAS.set_num_threads(1), does it work for you?

Yes, it works for me and solves the problem.

@KristofferC
Copy link
Member

KristofferC commented Nov 28, 2021

I guess JuliaLang/julia@b8e63b9 was the change on 1.6.4 that caused this? @ViralBShah, is the JuliaPackaging/Yggdrasil#3732 change to change the number of threads also now getting applied when new builds of e.g. OpenBLAS 0.3.10 are created? They all seem to include this common file https://github.com/JuliaPackaging/Yggdrasil/blob/b7f1359fb814e02d67a1e6ea80767b2d1d9188d5/O/OpenBLAS/OpenBLAS%400.3.10/build_tarballs.jl#L3 so it seems so?

@ctkelley
Copy link
Author

It's a workaround, but not a solution. I need all the blas threads I can get, so I'm sticking with 1.6.3.

@ViralBShah
Copy link
Member

ViralBShah commented Nov 28, 2021

AFAICT, you have to explicitly bump the BB_REL version to get the new openblas builds on 1.6.

I believe other patches were required which needed a new BB_REL version to be built and that would have picked up other changes from common.jl.

@ctkelley
Copy link
Author

ctkelley commented Dec 1, 2021

Still a problem in 1.7.0 on Macbook Pro running M1.

@ViralBShah
Copy link
Member

Unfortunately I have not tried M1 - but this may be an M1 specific problem with openblas.

@ctkelley
Copy link
Author

ctkelley commented Dec 1, 2021

No joy on intel Macs either. Same problem.

@ViralBShah
Copy link
Member

ViralBShah commented Dec 2, 2021

This works fine on Intel macs for me using the official binaries.

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

julia> a = randn(66,66); b = rand(66); norm(b-a*(a\b))
4.2670948674214197e-13

julia> a = randn(1666,1666); b = rand(1666); norm(b-a*(a\b))
1.6409946780787127e-11

@ViralBShah ViralBShah changed the title Problems with IJulia/vscode/Juno in 1.6.4 Problems with openblas in IJulia/vscode/Juno in 1.6.4 Dec 2, 2021
@BenjaminBorn
Copy link
Contributor

It works for me in a standard REPL. But in the VS Code REPL, it only works if I manually set the number of BLAS threads to 1 (see below), even setting it to 2 threads results in an error.

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

julia> a = randn(66,66); b = rand(66); norm(b-a*(a\b))
ERROR: ReadOnlyMemoryError()

julia> BLAS.set_num_threads(1)

julia> a = randn(66,66); b = rand(66); norm(b-a*(a\b))
1.9695810178621183e-13

@ctkelley
Copy link
Author

ctkelley commented Dec 2, 2021

It always worked for me in the REPL, and fails in IJulia in 1.6.4 and 1.7.0 on both M1 macs and Intel Macs.

@ViralBShah
Copy link
Member

I believe this is the same as #890. Closing this as a duplicate, since that one already discusses the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants