Skip to content

syevd! is reporting more errors than syevr! #1313

Open
@VinceNeede

Description

@VinceNeede

syevd! chosen as default algorithm for juliav v1.12.0+beta is reporting more errors respect to syevr!, creating
problems when a large number of eigen decompositions must be performed.

The same matrix can give LAPACKError (with info>0) on a device and pass on another and viceversa, furthermore the same matrix can give error or not based on the number of threads used (what I mean is that a specific matrix raises an error, for example, with 1 thread and not for 2, while another matrix can give an error for a different number of threads), meaning that some instability is present (at least in OpenBLAS, MKL seems to be working fine).

test code with matrix saved in HDF5 The matrix is of medium size $658\times 658$ and resulted from a long computation, so it is stored in a `HDF5` file, if you tell me how can I attach the file for the debug I will send it to you. The code is just the following:
using HDF5
using LinearAlgebra

mat = nothing
h5open("mat_error.h5", "r") do file
	global mat = Hermitian(file["mat"][])
end

@info "exectuing with 2 threads"
BLAS.set_num_threads(2)
eigen(mat)

@info "exectuing with 1 thread"
BLAS.set_num_threads(1)
eigen(mat)
Error obtained The output is
[ Info: exectuing with 2 threads
[ Info: exectuing with 1 thread
ERROR: LoadError: LAPACKException(326121)
Stacktrace:
  [1] chklapackerror_positive(::Int64)
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:44
  [2] chklapackerror
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:40 [inlined]
  [3] _syevd!(jobz::Char, uplo::Char, A::Matrix{Float64})
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:5463
  [4] syevd!
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:5324 [inlined]
  [5] #eigen!#251
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:14 [inlined]
  [6] eigen!
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:12 [inlined]
  [7] #_eigen#253
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:55 [inlined]
  [8] _eigen
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:53 [inlined]
  [9] #eigen#252
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:49 [inlined]
 [10] eigen
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:48 [inlined]
 [11] eigen(A::Hermitian{Float64, Matrix{Float64}})
    @ LinearAlgebra ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/LinearAlgebra/src/symmetriceigen.jl:48
 [12] top-level scope
    @ ~/Tesi/lapack_error/study_from_mat.jl:15
 [13] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:304
 [14] top-level scope
    @ REPL[2]:1
in expression starting at /home/bisogno/Tesi/lapack_error/study_from_mat.jl:15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions