Error for code that has been running for weeks (Circuitscape, LAPACK)

Running Circuitscape models and am getting an error for a new set. I am creating the input files in R, this code/process has been working for weeks, but as I am changing some things in the model I am unsure what this particular error code means. I cannot find anything to tell me what the positive number next to LAPACK indicates?

I am also very new to this program and language, thanks in advance for any assistance!

ERROR: LinearAlgebra.LAPACKException(6)
Stacktrace:
  [1] chklapackerror(ret::Int64)
    @ LinearAlgebra.LAPACK C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\lapack.jl:43
  [2] gesdd!(job::Char, A::Matrix{Float64})
    @ LinearAlgebra.LAPACK C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\lapack.jl:1675
  [3] _svd!
    @ C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\svd.jl:122 [inlined]
  [4] svd!(A::Matrix{Float64}; full::Bool, alg::LinearAlgebra.DivideAndConquer)
    @ LinearAlgebra C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\svd.jl:102
  [5] #svd#101
    @ C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\svd.jl:176 [inlined]
  [6] svd
    @ C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\svd.jl:176 [inlined]
  [7] pinv(A::Matrix{Float64}; atol::Float64, rtol::Float64)
    @ LinearAlgebra C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\dense.jl:1442
  [8] pinv
    @ C:\Users\Imogene\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\LinearAlgebra\src\dense.jl:1428 [inlined]
  [9] AlgebraicMultigrid.Pinv{Float64}(A::SparseArrays.SparseMatrixCSC{Float64, Int64})
    @ AlgebraicMultigrid C:\Users\Imogene\.julia\packages\AlgebraicMultigrid\ASpK7\src\multilevel.jl:57
 [10] AlgebraicMultigrid.Pinv(A::SparseArrays.SparseMatrixCSC{Float64, Int64})
    @ AlgebraicMultigrid C:\Users\Imogene\.julia\packages\AlgebraicMultigrid\ASpK7\src\multilevel.jl:59
 [11] smoothed_aggregation(A::SparseArrays.SparseMatrixCSC{Float64, Int64}, ::Type{Val{1}}; symmetry::AlgebraicMultigrid.HermitianSymmetry, strength::AlgebraicMultigrid.SymmetricStrength{Float64}, aggregate::AlgebraicMultigrid.StandardAggregation, smooth::AlgebraicMultigrid.JacobiProlongation{Float64}, presmoother::AlgebraicMultigrid.GaussSeidel{AlgebraicMultigrid.SymmetricSweep}, postsmoother::AlgebraicMultigrid.GaussSeidel{AlgebraicMultigrid.SymmetricSweep}, improve_candidates::AlgebraicMultigrid.GaussSeidel{AlgebraicMultigrid.SymmetricSweep}, max_levels::Int64, max_coarse::Int64, diagonal_dominance::Bool, keep::Bool, coarse_solver::Type, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ AlgebraicMultigrid C:\Users\Imogene\.julia\packages\AlgebraicMultigrid\ASpK7\src\aggregation.jl:50
 [12] smoothed_aggregation (repeats 2 times)
    @ C:\Users\Imogene\.julia\packages\AlgebraicMultigrid\ASpK7\src\aggregation.jl:16 [inlined]
 [13] macro expansion
    @ .\timing.jl:299 [inlined]
 [14] solve(prob::Circuitscape.GraphProblem{Float64, Int64, Circuitscape.AMGSolver}, #unused#::Circuitscape.AMGSolver, flags::Circuitscape.RasterFlags, cfg::Dict{String, String}, log::Bool)
    @ Circuitscape C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\core.jl:155
 [15] single_ground_all_pairs (repeats 2 times)
    @ C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\core.jl:66 [inlined]
 [16] _pt_file_no_polygons_path(rasterdata::Circuitscape.RasterData{Float64, Int64}, flags::Circuitscape.RasterFlags, cfg::Dict{String, String})
    @ Circuitscape C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\raster\pairwise.jl:63
 [17] raster_pairwise(T::Type, V::Type, cfg::Dict{String, String})
    @ Circuitscape C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\raster\pairwise.jl:29
 [18] _compute(T::Type, V::Type, cfg::Dict{String, String})
    @ Circuitscape C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\run.jl:43
 [19] macro expansion
    @ .\timing.jl:299 [inlined]
 [20] compute(path::String)
    @ Circuitscape C:\Users\Imogene\.julia\packages\Circuitscape\XpftG\src\run.jl:31
 [21] top-level scope
    @ REPL[2]:1
1 Like

A tip: Put the stacktrace between triple backticks to get a code-formatted blockquote, which will make it easier to read:

code

Done!

1 Like

Great! Might also suggest renaming the topic to include the packages involved (Circuitscape, LAPACK).

But I’m also going to @ some people who might be able to help, based on who seems to be active on the Github repository: Issues · Circuitscape/Circuitscape.jl · GitHub

@viralbshah @ranjan ?

1 Like

The code producing the error is LAPACK’s dgesdd function, where an error code 6 means:
> 0: DBDSDC did not converge, updating process failed.

Not particularly helpful thus. It is known that there are two LAPACK functions to compute the singular value decomposition of a matrix, namely _gesdd and _gesvd. The latter is generically slower, but more robust and accurate. Both can be called from Julia, corresponding to the svd keyword argument alg = DivideAndConquer() for the first and alg = QRIteration() for the second (slower, more robust). However, as this is inside the code of a package, it might not be particularly convenient for you to change this.

(The following is also not particularly helpful information, just a FYI:) The specific number is ultimately coming from dlasdq, where it means:

If INFO > 0, the algorithm did not converge, and INFO
specifies how many superdiagonals did not converge.

1 Like

Could this be due to a memory issue? I get this error for a particular environmental variable so assumed it was due to something with these particular matrices. I ask because when I load several models into Julia ( = compute(“file path”), with another variable listed first, I get an OutOfMemoryError(). May post that separately as I cannot figure out how to further reduce things (again, this process has been working for several weeks). Thank you!

Would zero’s in the data cause this? Do I need to set nodata values to something specific? I previously had a threshold but changed it recently (nodata values would be for pixels in a given raster). I do have my cost values set to start at 1, there are no 0’s in those files.