Skip to content

Commit

Permalink
CHOLMOD can now solve matrices with float32 values (#418)
Browse files Browse the repository at this point in the history
* Circuitscape can now solve matrices with float32 values.
This is because the underlying CHOLMOD solver supports this now.
This needs Julia 1.11.
Bump version and julia compat.

* Update CI
  • Loading branch information
ViralBShah authored Jul 24, 2024
1 parent 4385ff3 commit 79e0984
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ jobs:
- '1'
os:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- x64
include:
- os: macOS-latest
arch: aarch64
version: '1'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down Expand Up @@ -65,7 +68,7 @@ jobs:
julia --project=docs -e '
using Documenter: doctest
using Circuitscape
doctest(Circuitscape)'
doctest(Circuitscape)'
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Circuitscape"
uuid = "2b7a1792-8151-5239-925d-e2b8fdfa3201"
version = "5.13.3"
version = "5.14.0"

[deps]
AlgebraicMultigrid = "2169fc97-5a83-5252-b627-83903c6c433c"
Expand All @@ -21,11 +21,11 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
AlgebraicMultigrid = "0.5, 0.6"
AlgebraicMultigrid = "0.6"
ArchGDAL = "0.10"
DelimitedFiles = "1"
GZip = "0.5.1, 0.6"
GZip = "0.6"
Graphs = "1"
IterativeSolvers = "0.9"
SimpleWeightedGraphs = "1.2"
julia = "1.9"
SimpleWeightedGraphs = "1.4"
julia = "1.11"
10 changes: 1 addition & 9 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ struct CholmodNode{T}
points_idx::Tuple{T,T}
end

function _check_eltype(a, solver::CholmodSolver)
cswarn("CHOLMOD only works with double precision. Converting single precision matrix to double")
Float64.(a)
end

function solve(prob::GraphProblem{T,V}, solver::Union{CholmodSolver, MKLPardisoSolver}, flags,
cfg, log) where {T,V}

Expand All @@ -314,9 +309,6 @@ function solve(prob::GraphProblem{T,V}, solver::Union{CholmodSolver, MKLPardisoS
# Cumulative current map
cum = prob.cum

# Check - CHOLMOD solver mode works only in double precision
a = _check_eltype(a, solver)

# Batchsize
batch_size = solver.bs

Expand Down Expand Up @@ -649,7 +641,7 @@ function postprocess(output, component_data, flags, shortcut, cfg)
end

# TODO: Even though this function is called write_cur_maps
# actually writing the calculated maps depends on some flags.
# actually writing the calculated maps depends on some flags.
t = @elapsed write_cur_maps(name, output, component_data,
[-9999.], flags, cfg)
csinfo("Time taken to calculate current maps = $t seconds", cfg["suppress_messages"] in TRUELIST)
Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Circuitscape
using Test
import Circuitscape: compute_single, compute_cholmod, compute_mklpardiso,
compute_parallel,
import Circuitscape: compute_single, compute_cholmod, compute_parallel,
runtests
using Logging
Logging.disable_logging(Logging.Info)
Expand Down

0 comments on commit 79e0984

Please sign in to comment.