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

**URL:** <https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [September 8, 2022, 2:20pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944 "2022-09-08T14:20:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![icancellare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/icancellare/32/42540_2.png) [@icancellare](https://discourse.julialang.org/u/icancellare)\
**Post date:** [September 8, 2022, 2:20pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/1 "2022-09-08T14:20:37Z")

</div>

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!

```julia
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

```

---

<div class="post-metadata">

**Author:** ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Post date:** [September 8, 2022, 2:24pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/2 "2022-09-08T14:24:14Z")

</div>

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

```julia
code

```

---

<div class="post-metadata">

**Author:** ![icancellare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/icancellare/32/42540_2.png) [@icancellare](https://discourse.julialang.org/u/icancellare)\
**Post date:** [September 8, 2022, 2:27pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/3 "2022-09-08T14:27:33Z")

</div>

Done!

---

<div class="post-metadata">

**Author:** ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Post date:** [September 8, 2022, 2:33pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/4 "2022-09-08T14:33:29Z")

</div>

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](https://github.com/Circuitscape/Circuitscape.jl/issues)

@viralbshah @ranjan ?

---

<div class="post-metadata">

**Author:** ![juthohaegeman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juthohaegeman/32/8620_2.png) [@juthohaegeman](https://discourse.julialang.org/u/juthohaegeman)\
**Post date:** [September 8, 2022, 2:55pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/5 "2022-09-08T14:55:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [September 8, 2022, 3:03pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/6 "2022-09-08T15:03:27Z")

</div>

> [@juthohaegeman](#):
>
> The code producing the error is LAPACK’s `dgesdd` function, where an error code 6 means:  
> ` > 0: DBDSDC did not converge, updating process failed.`

(The following is also not particularly helpful information, just a FYI:) The specific number is ultimately coming from [dlasdq](https://netlib.org/lapack/explore-html/df/dd1/group___o_t_h_e_rauxiliary_gafc8e49b5fff31027da26e1856f8a9b25.html#gafc8e49b5fff31027da26e1856f8a9b25), where it means:

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

---

<div class="post-metadata">

**Author:** ![icancellare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/icancellare/32/42540_2.png) [@icancellare](https://discourse.julialang.org/u/icancellare)\
**Post date:** [September 8, 2022, 3:03pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/7 "2022-09-08T15:03:52Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![icancellare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/icancellare/32/42540_2.png) [@icancellare](https://discourse.julialang.org/u/icancellare)\
**Post date:** [September 8, 2022, 3:48pm UTC](https://discourse.julialang.org/t/error-for-code-that-has-been-running-for-weeks-circuitscape-lapack/86944/8 "2022-09-08T15:48:32Z")

</div>

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.
