Circuitscape / Circuitscape.jl

Algorithms from circuit theory to predict connectivity in heterogeneous landscapes
https://circuitscape.org
MIT License
128 stars 35 forks source link

ArgumentError: dense matrix construction failed for unknown reasons #334

Closed jaymschoen closed 2 years ago

jaymschoen commented 2 years ago

I am new to running CS in Julia (having used the GUI/Arc previously). I believe I have followed all steps but when trying to test it on a few layers I have successfully used in the past, I get this error:

ERROR: ArgumentError: dense matrix construction failed for unknown reasons. Please submit a bug report.

Thanks in advance for your help! Here is the full terminal output:

Step 10: Would you like to run Circuitscape?
 > Yes
   Later
[ Info: 2021-11-15 16:45:08 : Precision used: Double
[ Info: 2021-11-15 16:45:08 : Starting up Circuitscape to use 2 processes in parallel
[ Info: 2021-11-15 16:45:21 : Reading maps
[ Info: 2021-11-15 16:45:39 : Resistance/Conductance map has 11505688 nodes
[ Info: 2021-11-15 16:45:54 : Solver used: CHOLMOD
┌ Warning: 2021-11-15 16:45:55 : CHOLMOD only works with double precision. Converting single precision matrix to double
└ @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\logging.jl:25
[ Info: 2021-11-15 16:45:56 : Graph has 11505688 nodes, 20 focal points and 1 connected components
[ Info: 2021-11-15 16:45:56 : Total number of pair solves = 190
[ Info: 2021-11-15 16:48:05 : Time taken to construct cholesky factor = 126.6767071
[ Info: 2021-11-15 16:48:13 : Time taken to construct local nodemap = 7.1971147 seconds
[ Info: 2021-11-15 16:48:14 : Solving points 1 to 190
ERROR: ArgumentError: dense matrix construction failed for unknown reasons. Please submit a bug report.
Stacktrace:
  [1] SuiteSparse.CHOLMOD.Dense{Float64}(ptr::Ptr{SuiteSparse.CHOLMOD.C_Dense{Float64}})
    @ SuiteSparse.CHOLMOD C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SuiteSparse\src\cholmod.jl:222
  [2] Dense
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SuiteSparse\src\cholmod.jl:238 [inlined]
  [3] allocate_dense
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SuiteSparse\src\cholmod.jl:414 [inlined]
  [4] SuiteSparse.CHOLMOD.Dense{Float64}(A::Matrix{Float64})
    @ SuiteSparse.CHOLMOD C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SuiteSparse\src\cholmod.jl:810
  [5] \
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\SuiteSparse\src\cholmod.jl:1712 [inlined]
  [6] solve_linear_system(factor::SuiteSparse.CHOLMOD.Factor{Float64}, matrix::SparseArrays.SparseMatrixCSC{Float64, Int64}, rhs::Matrix{Float64})
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\core.jl:633
  [7] solve(prob::Circuitscape.GraphProblem{Float64, Int64, Circuitscape.CholmodSolver}, solver::Circuitscape.CholmodSolver, flags::Circuitscape.RasterFlags, cfg::Dict{String, String}, log::Bool)
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\core.jl:445
  [8] single_ground_all_pairs (repeats 2 times)
    @ C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\core.jl:66 [inlined]
  [9] _pt_file_no_polygons_path(rasterdata::Circuitscape.RasterData{Float64, Int64}, flags::Circuitscape.RasterFlags, cfg::Dict{String, String})
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\raster\pairwise.jl:63
 [10] raster_pairwise(T::Type, V::Type, cfg::Dict{String, String})
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\raster\pairwise.jl:29
 [11] _compute(T::Type, V::Type, cfg::Dict{String, String})
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\run.jl:43
 [12] macro expansion
    @ .\timing.jl:287 [inlined]
 [13] compute(dict::Dict{String, String})
    @ Circuitscape C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\run.jl:74
 [14] step10(name::String, path::String)
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:139
 [15] step9(name::String)
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:131
 [16] step8()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:120
 [17] step7()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:110
 [18] step6()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:97
 [19] step5()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:87
 [20] step4()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:76
 [21] step3()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:47
 [22] step2()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:30
 [23] step1()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:14
 [24] start()
    @ Circuitscape.INIBuilder C:\Users\jayms\.julia\packages\Circuitscape\a9Quh\src\INIBuilder\run.jl:188
 [25] top-level scope
    @ REPL[5]:1
ranjanan commented 2 years ago

Could you attach your files so this can be reproduced? The INI should be saved in this UI.

vlandau commented 2 years ago

HI Jay, sorry about the troubles! Can you share which versions of Julia and Circuitscape you're using? To get the version of Julia, run VERSION in the Julia REPL. To get the version of Circuitscape, run using Pkg; Pkg.status("Circuitscape")

jaymschoen commented 2 years ago

Thanks for getting right back! Julia v1.6.3 and Circuitscape v5.10.0 (I believe these are the latest). As far as the files, the habitat file for this run belongs to a collaborator unfortunately, so I would have to check before sharing. Any way to work around it in the meantime? I could try using different files that are mine (and share if the same issue persists)...

jaymschoen commented 2 years ago

Also, I'm not seeing the INI file in the output folder that I specified (there's only a ".out" file). Should I be looking somewhere else?

ViralBShah commented 2 years ago

The ini file should be part of the input. Also disable parallelism if it is enabled. I am guessing the problem is too big for your memory.

jaymschoen commented 2 years ago

Thank you! Disabling parallelism solved it.