-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Large matrices cause LAPACK ArgumentError #870
Comments
Argument JuliaLang/julia#11 is Parameter verification logic: LAPACK: dsygvd |
The LAPACK source suggests that this can only happen if the value of julia> reinterpret(Int32, [typemax(Int32)+1])
2-element reinterpret(Int32, ::Vector{Int64}):
-2147483648
0 It would be useful if somebody could check the value of |
Running with julia> spectralpositions(10000)
work[1] = 2.0006f8
lwork[] = -1
** On entry to SSYGVDNon-unitLeft parameter number 11 had an illegal value
work[1] = 2.0006f8
lwork[] = 200060000
ERROR: ArgumentError: invalid argument JuliaLang/julia#11 to LAPACK call |
Ha. julia> eps(2.0006f8)
16.0f0 So in the query call, the minimal work space is computed as julia> N = 10000
10000
julia> lwork = 1 + 6*N + 2*N^2
200060001
julia> Int(Float32(lwork)) < lwork
true this condition is satisfied. This must be considered a LAPACK bug. They should ensure that round tripping between integer and Flaot32 doesn't return a smaller value. I'll file an issue tonight. |
I find it hard to believe that we are the first people to run into this! |
Indeed we weren't Reference-LAPACK/lapack#600 |
@r3tex On Julia 1.7 RCs, can you try this with MKL? Just do |
Julia 1.7.0 rc1 + MKL.jl works fine. julia> versioninfo()
Julia Version 1.7.0-rc1
Commit 9eade6195e (2021-09-12 06:45 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
(@v1.7) pkg> st
Status `C:\Users\woclass\.julia\environments\v1.7\Project.toml`
[33e6dc65] MKL v0.4.2
julia> using LinearAlgebra
julia> using MKL
julia> BLAS.get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries:
└ [ILP64] mkl_rt.1.dll
julia> mirror!(A) = for i in 1:size(A, 1), j in (i + 1):size(A, 2); A[i, j] = A[j, i] = A[i, j] + A[j, i]; end
mirror! (generic function with 1 method)
julia> function spectralpositions(n)
g = rand(0:1, n, n)
mirror!(g)
ϕ = Matrix(Diagonal(vec(sum(g; dims=1)) - diag(g)))
λ = Float32[i == j ? ϕ[i, j] : -g[i, j] for i in 1:n, j in 1:n]
eigvecs(λ, ϕ)
end
spectralpositions (generic function with 1 method)
julia> spectralpositions(10000)
10000×10000 Matrix{Float32}:
.... |
It looks like this has already been fixed in LAPACK master so we should be able to close this issue once a new release of LAPACK makes it into OpenBLAS. |
Reference-LAPACK/lapack#600 (comment) suggests the whole problem is not fixed but maybe that does not affect us? |
There are two somewhat separate issues there and the one that causes the example here to fail should be handled by the fix. The other issue is when the required workspace is larger than an Int32 but that shouldn't be an issue for use because we use Int64 in BLAS. |
We could consider moving the work space computation to Julia as a workaround for this while we are waiting for new LAPACK release. There is a small risk that we'll forget it and that LAPACK later changes the workspace requirements. |
Can't we just apply the LAPACK patch to our openblas build? Shouldn't be too difficult. |
Here is a small way to reproduce the problem.
When giving an argument close to 10000 it fails.
@ViralBShah @andreasnoack
The text was updated successfully, but these errors were encountered: