Skip to content

Commit

Permalink
Merge pull request #35 from j-fu/jf-parallel2
Browse files Browse the repository at this point in the history
Restructuring for parallelization
  • Loading branch information
j-fu authored Jul 16, 2024
2 parents d0cacb0 + 24f73ab commit 91aa015
Show file tree
Hide file tree
Showing 31 changed files with 5,463 additions and 462 deletions.
7 changes: 5 additions & 2 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
style = "sciml"
style = "yas"
always_for_in = false
separate_kwargs_with_semicolon = true
format_markdown = true
import_to_using = false
pipe_to_function_call = false
short_to_long_function_def = false
always_use_return = false
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@ jobs:
fail-fast: false
matrix:
version:
- '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'.
- '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'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
- 'nightly'
os:
- ubuntu-latest
- macos-latest
- windows-latest
- macos-latest # arm
- macOS-13 # intel
arch:
- x64
- aarch64
exclude:
- os: ubuntu-latest
arch: aarch64
- os: windows-latest
arch: aarch64
- os: macOS-13
arch: aarch64
- os: macos-latest
arch: x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
Expand All @@ -42,6 +53,8 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
JULIA_NUM_THREADS: 4
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
docs:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
QUARRY
docs/build
*~
Manifest.toml
Manifest*.toml
.repl_history
quarry

8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name = "ExtendableSparse"
uuid = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>"]
version = "1.4.1"
version = "1.5.0"

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

[compat]
AMGCLWrap = "0.3.1,0.4"
AMGCLWrap = "0.4"
AlgebraicMultigrid = "0.4,0.5,0.6"
DocStringExtensions = "0.8, 0.9"
ILUZero = "0.2"
Expand All @@ -38,7 +40,7 @@ Pardiso = "0.5.1"
Requires = "1.1.3"
Sparspak = "0.3.6"
StaticArrays = "1.5.24"
julia = "1.6"
julia = "1.9"

[extras]
AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288"
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function mkdocs()
makedocs(; sitename = "ExtendableSparse.jl",
modules = [ExtendableSparse],
doctest = false,
warnonly = true,
clean = false,
authors = "J. Fuhrmann",
repo = "https://github.com/j-fu/ExtendableSparse.jl",
Expand Down
11 changes: 11 additions & 0 deletions docs/src/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ Pages = ["sparsematrixlnk.jl"]
Modules = [ExtendableSparse]
Pages = ["sparsematrixcsc.jl"]
```
## New API
Under development - aimed at multithreading
```@autodocs
Modules = [ExtendableSparse]
Pages = ["abstractsparsematrixextension.jl",
"abstractextendablesparsematrixcsc.jl",
"sparsematrixdilnkc.jl",
"genericextendablesparsematrixcsc.jl",
"genericmtextendablesparsematrixcsc.jl"]
```


## Misc methods

Expand Down
80 changes: 42 additions & 38 deletions src/ExtendableSparse.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
module ExtendableSparse
using SparseArrays,StaticArrays
using LinearAlgebra
using Sparspak
using ILUZero

if !isdefined(Base, :get_extension)
using Requires
end
using DocStringExtensions: DocStringExtensions, SIGNATURES, TYPEDEF,TYPEDFIELDS
using ILUZero: ILUZero, ldiv!, nnz
using OhMyThreads: @tasks
using LinearAlgebra: LinearAlgebra, Diagonal, Hermitian, Symmetric, Tridiagonal,
cholesky, cholesky!, convert, lu!, mul!, norm, transpose
using SparseArrays: SparseArrays, AbstractSparseMatrix, SparseMatrixCSC,
dropzeros!, findnz, nzrange, sparse, spzeros
using Sparspak: Sparspak, sparspaklu, sparspaklu!
using StaticArrays: StaticArrays, SMatrix, SVector
using SuiteSparse: SuiteSparse
import SparseArrays: AbstractSparseMatrixCSC, rowvals, getcolptr, nonzeros


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


using DocStringExtensions

import SparseArrays: AbstractSparseMatrixCSC, rowvals, getcolptr, nonzeros

include("matrix/sparsematrixcsc.jl")
include("matrix/abstractsparsematrixextension.jl")
include("matrix/sparsematrixlnk.jl")
include("matrix/sparsematrixdilnkc.jl")
include("matrix/abstractextendablesparsematrixcsc.jl")
include("matrix/extendable.jl")
include("matrix/genericmtextendablesparsematrixcsc.jl")
include("matrix/genericextendablesparsematrixcsc.jl")

const ExtendableSparseMatrix=ExtendableSparseMatrixCSC
const MTExtendableSparseMatrixCSC{Tv,Ti}=GenericMTExtendableSparseMatrixCSC{SparseMatrixDILNKC{Tv,Ti},Tv,Ti}
MTExtendableSparseMatrixCSC(m,n,args...)=MTExtendableSparseMatrixCSC{Float64,Int64}(m,n,args...)

const STExtendableSparseMatrixCSC{Tv,Ti}=GenericExtendableSparseMatrixCSC{SparseMatrixDILNKC{Tv,Ti},Tv,Ti}
STExtendableSparseMatrixCSC(m,n,args...)=STExtendableSparseMatrixCSC{Float64,Int64}(m,n,args...)

export SparseMatrixLNK,
ExtendableSparseMatrix, flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse

export ExtendableSparseMatrixCSC, MTExtendableSparseMatrixCSC, STExtendableSparseMatrixCSC, GenericMTExtendableSparseMatrixCSC
export SparseMatrixLNK, ExtendableSparseMatrix,flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse, reset!, nnznew
export partitioning!

export eliminate_dirichlet, eliminate_dirichlet!, mark_dirichlet

include("factorizations/factorizations.jl")

include("experimental/Experimental.jl")

include("factorizations/simple_iteration.jl")
export simple, simple!

include("matrix/sprand.jl")
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark

export rawupdateindex!, updateindex!




export JacobiPreconditioner,
ILU0Preconditioner,
ILUZeroPreconditioner,
PointBlockILUZeroPreconditioner,
ParallelJacobiPreconditioner,
ParallelILU0Preconditioner,
BlockPreconditioner,allow_views,
reorderlinsys
BlockPreconditioner,allow_views

export AbstractFactorization, LUFactorization, CholeskyFactorization, SparspakLU
export issolver
export factorize!, update!

include("factorizations/simple_iteration.jl")
export simple, simple!

include("matrix/sprand.jl")
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark


@static if !isdefined(Base, :get_extension)
function __init__()
@require Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2" begin
include("../ext/ExtendableSparsePardisoExt.jl")
end
@require IncompleteLU = "40713840-3770-5561-ab4c-a76e7d0d7895" begin
include("../ext/ExtendableSparseIncompleteLUExt.jl")
end
@require AlgebraicMultigrid = "2169fc97-5a83-5252-b627-83903c6c433c" begin
include("../ext/ExtendableSparseAlgebraicMultigridExt.jl")
end
@require AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288" begin
include("../ext/ExtendableSparseAMGCLWrapExt.jl")
end
end
end

"""
```
ILUTPreconditioner(;droptol=1.0e-3)
Expand Down
44 changes: 44 additions & 0 deletions src/experimental/Experimental.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module Experimental
using ExtendableSparse, SparseArrays
using LinearAlgebra
using SparseArrays: AbstractSparseMatrixCSC
import SparseArrays: nonzeros, getcolptr,nzrange
import ExtendableSparse: flush!, reset!, rawupdateindex!, findindex
using ExtendableSparse: ColEntry, AbstractPreconditioner, @makefrommatrix, phash
using ExtendableSparse: AbstractExtendableSparseMatrixCSC, AbstractSparseMatrixExtension
using DocStringExtensions
using Metis
using Base.Threads
using OhMyThreads: @tasks
import ExtendableSparse: factorize!, update!, partitioning!

include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "ExtendableSparseParallel.jl"))

include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "ilu_Al-Kurdi_Mittal.jl"))
#using .ILUAM
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "pilu_Al-Kurdi_Mittal.jl"))
#using .PILUAM

include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel" ,"iluam.jl"))
include(joinpath(@__DIR__, "ExtendableSparseMatrixParallel", "piluam.jl"))

@eval begin
@makefrommatrix ILUAMPreconditioner
@makefrommatrix PILUAMPreconditioner
end

function factorize!(p::PILUAMPreconditioner, A::ExtendableSparseMatrixParallel)
p.A = A
update!(p)
p
end

export ExtendableSparseMatrixParallel, SuperSparseMatrixLNK
export addtoentry!, reset!, dummy_assembly!, preparatory_multi_ps_less_reverse, fr, addtoentry!, compare_matrices_light
export ILUAMPreconditioner, PILUAMPreconditioner
export reorderlinsys, nnz_noflush



end

Loading

2 comments on commit 91aa015

@j-fu
Copy link
Owner Author

@j-fu j-fu commented on 91aa015 Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111187

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.5.0 -m "<description of version>" 91aa0152c9597c8c7f9af5727e3faf624286b1cc
git push origin v1.5.0

Please sign in to comment.