Skip to content

Commit 91aa015

Browse files
authored
Merge pull request #35 from j-fu/jf-parallel2
Restructuring for parallelization
2 parents d0cacb0 + 24f73ab commit 91aa015

31 files changed

+5463
-462
lines changed

.JuliaFormatter.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
style = "sciml"
1+
style = "yas"
22
always_for_in = false
3-
separate_kwargs_with_semicolon = true
43
format_markdown = true
4+
import_to_using = false
5+
pipe_to_function_call = false
6+
short_to_long_function_def = false
7+
always_use_return = false

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,26 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
version:
18-
- '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
18+
- '1.9' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
1919
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
2020
- 'nightly'
2121
os:
2222
- ubuntu-latest
23-
- macos-latest
2423
- windows-latest
24+
- macos-latest # arm
25+
- macOS-13 # intel
2526
arch:
2627
- x64
28+
- aarch64
29+
exclude:
30+
- os: ubuntu-latest
31+
arch: aarch64
32+
- os: windows-latest
33+
arch: aarch64
34+
- os: macOS-13
35+
arch: aarch64
36+
- os: macos-latest
37+
arch: x64
2738
steps:
2839
- uses: actions/checkout@v4
2940
- uses: julia-actions/setup-julia@v1
@@ -42,6 +53,8 @@ jobs:
4253
${{ runner.os }}-
4354
- uses: julia-actions/julia-buildpkg@v1
4455
- uses: julia-actions/julia-runtest@v1
56+
env:
57+
JULIA_NUM_THREADS: 4
4558
- uses: julia-actions/julia-processcoverage@v1
4659
- uses: codecov/codecov-action@v3
4760
docs:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
QUARRY
22
docs/build
33
*~
4-
Manifest.toml
4+
Manifest*.toml
55
.repl_history
66
quarry
77

Project.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name = "ExtendableSparse"
22
uuid = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3"
33
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>"]
4-
version = "1.4.1"
4+
version = "1.5.0"
55

66
[deps]
77
AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288"
88
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
99
ILUZero = "88f59080-6952-5380-9ea5-54057fb9a43f"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11+
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b"
12+
OhMyThreads = "67456a42-1dca-4109-a031-0a68de7e3ad5"
1113
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1214
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1315
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -29,7 +31,7 @@ ExtendableSparseIncompleteLUExt = "IncompleteLU"
2931
ExtendableSparsePardisoExt = "Pardiso"
3032

3133
[compat]
32-
AMGCLWrap = "0.3.1,0.4"
34+
AMGCLWrap = "0.4"
3335
AlgebraicMultigrid = "0.4,0.5,0.6"
3436
DocStringExtensions = "0.8, 0.9"
3537
ILUZero = "0.2"
@@ -38,7 +40,7 @@ Pardiso = "0.5.1"
3840
Requires = "1.1.3"
3941
Sparspak = "0.3.6"
4042
StaticArrays = "1.5.24"
41-
julia = "1.6"
43+
julia = "1.9"
4244

4345
[extras]
4446
AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288"

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function mkdocs()
55
makedocs(; sitename = "ExtendableSparse.jl",
66
modules = [ExtendableSparse],
77
doctest = false,
8+
warnonly = true,
89
clean = false,
910
authors = "J. Fuhrmann",
1011
repo = "https://github.com/j-fu/ExtendableSparse.jl",

docs/src/internal.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ Pages = ["sparsematrixlnk.jl"]
1313
Modules = [ExtendableSparse]
1414
Pages = ["sparsematrixcsc.jl"]
1515
```
16+
## New API
17+
Under development - aimed at multithreading
18+
```@autodocs
19+
Modules = [ExtendableSparse]
20+
Pages = ["abstractsparsematrixextension.jl",
21+
"abstractextendablesparsematrixcsc.jl",
22+
"sparsematrixdilnkc.jl",
23+
"genericextendablesparsematrixcsc.jl",
24+
"genericmtextendablesparsematrixcsc.jl"]
25+
```
26+
1627

1728
## Misc methods
1829

src/ExtendableSparse.jl

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
module ExtendableSparse
2-
using SparseArrays,StaticArrays
3-
using LinearAlgebra
4-
using Sparspak
5-
using ILUZero
62

7-
if !isdefined(Base, :get_extension)
8-
using Requires
9-
end
3+
using DocStringExtensions: DocStringExtensions, SIGNATURES, TYPEDEF,TYPEDFIELDS
4+
using ILUZero: ILUZero, ldiv!, nnz
5+
using OhMyThreads: @tasks
6+
using LinearAlgebra: LinearAlgebra, Diagonal, Hermitian, Symmetric, Tridiagonal,
7+
cholesky, cholesky!, convert, lu!, mul!, norm, transpose
8+
using SparseArrays: SparseArrays, AbstractSparseMatrix, SparseMatrixCSC,
9+
dropzeros!, findnz, nzrange, sparse, spzeros
10+
using Sparspak: Sparspak, sparspaklu, sparspaklu!
11+
using StaticArrays: StaticArrays, SMatrix, SVector
12+
using SuiteSparse: SuiteSparse
13+
import SparseArrays: AbstractSparseMatrixCSC, rowvals, getcolptr, nonzeros
14+
1015

1116
# Define our own constant here in order to be able to
1217
# test things at least a little bit..
@@ -17,58 +22,57 @@ if USE_GPL_LIBS
1722
end
1823

1924

20-
using DocStringExtensions
21-
22-
import SparseArrays: AbstractSparseMatrixCSC, rowvals, getcolptr, nonzeros
2325

2426
include("matrix/sparsematrixcsc.jl")
27+
include("matrix/abstractsparsematrixextension.jl")
2528
include("matrix/sparsematrixlnk.jl")
29+
include("matrix/sparsematrixdilnkc.jl")
30+
include("matrix/abstractextendablesparsematrixcsc.jl")
2631
include("matrix/extendable.jl")
32+
include("matrix/genericmtextendablesparsematrixcsc.jl")
33+
include("matrix/genericextendablesparsematrixcsc.jl")
34+
35+
const ExtendableSparseMatrix=ExtendableSparseMatrixCSC
36+
const MTExtendableSparseMatrixCSC{Tv,Ti}=GenericMTExtendableSparseMatrixCSC{SparseMatrixDILNKC{Tv,Ti},Tv,Ti}
37+
MTExtendableSparseMatrixCSC(m,n,args...)=MTExtendableSparseMatrixCSC{Float64,Int64}(m,n,args...)
38+
39+
const STExtendableSparseMatrixCSC{Tv,Ti}=GenericExtendableSparseMatrixCSC{SparseMatrixDILNKC{Tv,Ti},Tv,Ti}
40+
STExtendableSparseMatrixCSC(m,n,args...)=STExtendableSparseMatrixCSC{Float64,Int64}(m,n,args...)
2741

28-
export SparseMatrixLNK,
29-
ExtendableSparseMatrix, flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse
42+
43+
export ExtendableSparseMatrixCSC, MTExtendableSparseMatrixCSC, STExtendableSparseMatrixCSC, GenericMTExtendableSparseMatrixCSC
44+
export SparseMatrixLNK, ExtendableSparseMatrix,flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse, reset!, nnznew
45+
export partitioning!
3046

3147
export eliminate_dirichlet, eliminate_dirichlet!, mark_dirichlet
3248

3349
include("factorizations/factorizations.jl")
3450

51+
include("experimental/Experimental.jl")
52+
53+
include("factorizations/simple_iteration.jl")
54+
export simple, simple!
55+
56+
include("matrix/sprand.jl")
57+
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark
58+
59+
export rawupdateindex!, updateindex!
60+
61+
62+
63+
3564
export JacobiPreconditioner,
3665
ILU0Preconditioner,
3766
ILUZeroPreconditioner,
3867
PointBlockILUZeroPreconditioner,
3968
ParallelJacobiPreconditioner,
4069
ParallelILU0Preconditioner,
41-
BlockPreconditioner,allow_views,
42-
reorderlinsys
70+
BlockPreconditioner,allow_views
4371

4472
export AbstractFactorization, LUFactorization, CholeskyFactorization, SparspakLU
4573
export issolver
4674
export factorize!, update!
4775

48-
include("factorizations/simple_iteration.jl")
49-
export simple, simple!
50-
51-
include("matrix/sprand.jl")
52-
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark
53-
54-
55-
@static if !isdefined(Base, :get_extension)
56-
function __init__()
57-
@require Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2" begin
58-
include("../ext/ExtendableSparsePardisoExt.jl")
59-
end
60-
@require IncompleteLU = "40713840-3770-5561-ab4c-a76e7d0d7895" begin
61-
include("../ext/ExtendableSparseIncompleteLUExt.jl")
62-
end
63-
@require AlgebraicMultigrid = "2169fc97-5a83-5252-b627-83903c6c433c" begin
64-
include("../ext/ExtendableSparseAlgebraicMultigridExt.jl")
65-
end
66-
@require AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288" begin
67-
include("../ext/ExtendableSparseAMGCLWrapExt.jl")
68-
end
69-
end
70-
end
71-
7276
"""
7377
```
7478
ILUTPreconditioner(;droptol=1.0e-3)

src/experimental/Experimental.jl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module Experimental
2+
using ExtendableSparse, SparseArrays
3+
using LinearAlgebra
4+
using SparseArrays: AbstractSparseMatrixCSC
5+
import SparseArrays: nonzeros, getcolptr,nzrange
6+
import ExtendableSparse: flush!, reset!, rawupdateindex!, findindex
7+
using ExtendableSparse: ColEntry, AbstractPreconditioner, @makefrommatrix, phash
8+
using ExtendableSparse: AbstractExtendableSparseMatrixCSC, AbstractSparseMatrixExtension
9+
using DocStringExtensions
10+
using Metis
11+
using Base.Threads
12+
using OhMyThreads: @tasks
13+
import ExtendableSparse: factorize!, update!, partitioning!
14+
15+
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "ExtendableSparseParallel.jl"))
16+
17+
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "ilu_Al-Kurdi_Mittal.jl"))
18+
#using .ILUAM
19+
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "pilu_Al-Kurdi_Mittal.jl"))
20+
#using .PILUAM
21+
22+
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel" ,"iluam.jl"))
23+
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "piluam.jl"))
24+
25+
@eval begin
26+
@makefrommatrix ILUAMPreconditioner
27+
@makefrommatrix PILUAMPreconditioner
28+
end
29+
30+
function factorize!(p::PILUAMPreconditioner, A::ExtendableSparseMatrixParallel)
31+
p.A = A
32+
update!(p)
33+
p
34+
end
35+
36+
export ExtendableSparseMatrixParallel, SuperSparseMatrixLNK
37+
export addtoentry!, reset!, dummy_assembly!, preparatory_multi_ps_less_reverse, fr, addtoentry!, compare_matrices_light
38+
export ILUAMPreconditioner, PILUAMPreconditioner
39+
export reorderlinsys, nnz_noflush
40+
41+
42+
43+
end
44+

0 commit comments

Comments
 (0)