Skip to content

Commit 8df3a63

Browse files
authored
Merge pull request #4 from janbruedigam/updates
Bug fix and CI update
2 parents 92f2b21 + 684d475 commit 8df3a63

File tree

11 files changed

+168
-36
lines changed

11 files changed

+168
-36
lines changed

.github/workflows/TagBot.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: TagBot
22
on:
3-
schedule:
4-
- cron: 0 0 * * *
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
57
jobs:
68
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
710
runs-on: ubuntu-latest
811
steps:
912
- uses: JuliaRegistries/TagBot@v1
1013
with:
11-
token: ${{ secrets.GITHUB_TOKEN }}
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/benchmark.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Run benchmarks
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
Benchmark:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: julia-actions/setup-julia@latest
12+
with:
13+
version: 1
14+
# - uses: julia-actions/julia-buildpkg@latest
15+
- name: Install dependencies
16+
run: julia -e 'using Pkg; pkg"add PkgBenchmark [email protected]"'
17+
- name: Run benchmarks
18+
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge(retune=true,baseline="origin/master")' # retune sometimes necessary to avoid counting compile-time
19+
- name: Print judgement
20+
run: julia -e 'using BenchmarkCI; BenchmarkCI.displayjudgement()'

.github/workflows/ci.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,4 @@ jobs:
3030
arch: ${{ matrix.arch }}
3131
- uses: julia-actions/julia-buildpkg@latest
3232
- uses: julia-actions/julia-runtest@latest
33-
- uses: julia-actions/julia-uploadcodecov@latest
34-
# docs:
35-
# name: Documentation
36-
# runs-on: ubuntu-latest
37-
# steps:
38-
# - uses: actions/checkout@v2
39-
# - uses: julia-actions/setup-julia@latest
40-
# with:
41-
# version: '1.6'
42-
# - run: julia --project=docs -e '
43-
# using Pkg;
44-
# Pkg.develop(PackageSpec(; path=pwd()));
45-
# Pkg.instantiate();'
46-
# - run: julia --project=docs docs/make.jl
47-
# env:
48-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
# DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
33+
- uses: julia-actions/julia-uploadcodecov@latest

benchmark/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"

benchmark/benchmarks.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using BenchmarkTools
2+
3+
SUITE = BenchmarkGroup()
4+
5+
include("example_benchmark.jl")

benchmark/example_benchmark.jl

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using GraphBasedSystems
2+
A = [
3+
0 1 0 1 1 0 1 0 1 0
4+
1 0 1 0 0 0 0 0 0 0
5+
0 1 0 0 0 0 0 0 0 0
6+
1 0 0 0 1 0 0 0 0 0
7+
1 0 0 1 0 1 0 0 0 0
8+
0 0 0 0 1 0 0 0 0 0
9+
1 0 0 0 0 0 0 1 0 0
10+
0 0 0 0 0 0 1 0 1 1
11+
1 0 0 0 0 0 0 1 0 0
12+
0 0 0 0 0 0 0 1 0 0
13+
]
14+
15+
B = [
16+
0 1 0 0 0 1 0 0 0
17+
1 0 0 0 0 1 0 0 0
18+
0 0 0 0 0 1 1 0 1
19+
0 0 0 0 0 0 1 1 0
20+
0 0 0 0 0 0 0 1 1
21+
1 1 1 0 0 0 1 0 0
22+
0 0 1 1 0 1 0 1 1
23+
0 0 0 1 1 0 1 0 1
24+
0 0 1 0 1 0 1 1 0
25+
]
26+
27+
C = [
28+
0 1 1 0 0 0
29+
1 0 0 1 0 0
30+
1 0 0 1 1 0
31+
0 1 1 0 0 1
32+
0 0 1 0 0 1
33+
0 0 0 1 1 0
34+
]
35+
36+
D = [
37+
0 1 1 0 1 0
38+
1 0 0 1 0 1
39+
1 0 0 1 0 0
40+
0 1 1 0 0 0
41+
1 0 0 0 0 1
42+
0 1 0 0 1 0]
43+
44+
ZAA = zeros(Int64,10,10)
45+
ZAB = zeros(Int64,10,9)
46+
ZAC = zeros(Int64,10,6)
47+
ZAD = zeros(Int64,10,6)
48+
ZBB = zeros(Int64,9,9)
49+
ZBC = zeros(Int64,9,6)
50+
ZBD = zeros(Int64,9,6)
51+
ZCC = zeros(Int64,6,6)
52+
ZCD = zeros(Int64,6,6)
53+
54+
ZBA = ZAB'
55+
ZCA = ZAC'
56+
ZDA = ZAD'
57+
ZCB = ZBC'
58+
ZDB = ZBD'
59+
ZDC = ZCD'
60+
61+
62+
# Graph 1 is disconnected, 2-3-4-5 are connected, 6 is disconnected, 7 is disconnected
63+
64+
A = [
65+
A ZAA ZAB ZAC ZAA ZAA ZAD
66+
ZAA A ZAB ZAC ZAA ZAA ZAD
67+
ZBA ZBA B ZBC ZBA ZBA ZBD
68+
ZCA ZCA ZCB C ZCA ZCA ZCD
69+
ZAA ZAA ZAB ZAC A ZAA ZAD
70+
ZAA ZAA ZAB ZAC ZAA A ZAD
71+
ZDA ZDA ZDB ZDC ZDA ZDA D
72+
]
73+
74+
A[13,21] = A[21,13] = 1
75+
A[16,30] = A[30,16] = 1
76+
A[20,36] = A[36,20] = 1
77+
78+
79+
system = System{Float64}(A, rand(0:3,size(A)[1]))
80+
81+
function init!(system)
82+
for entry in system.matrix_entries.nzval
83+
GraphBasedSystems.randomize!(entry)
84+
end
85+
for entry in system.vector_entries
86+
GraphBasedSystems.randomize!(entry)
87+
end
88+
end
89+
90+
SUITE["ldu"] = @benchmarkable ldu_solve!($system) samples=2 setup=(init!($system))
91+
SUITE["lu"] = @benchmarkable lu_solve!($system) samples=2 setup=(init!($system))

src/GraphBasedSystems.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ using Graphs
88
export System,
99
full_matrix,
1010
full_vector,
11+
reordered_matrix,
12+
reordered_vector,
1113
children,
1214
connections,
1315
parents,

src/solvers/ldu.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ function ldu_factorization!(system)
2525
cyclic_children = system.cyclic_children
2626

2727
for v in system.dfs_list
28+
for c in acyclic_children[v]
29+
ldu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
30+
end
2831
for c in cyclic_children[v]
2932
for cc in cyclic_children[v]
3033
cc == c && break
31-
(cc children(system,c) && cc cyclic_children[c]) && continue
34+
(cc children(system,c) && cc cyclic_children[c]) && continue
3235
ldu_factorization_cyclic!(matrix_entries[v,c], matrix_entries[v,cc], matrix_entries[cc,cc], matrix_entries[cc,c])
3336
ldu_factorization_cyclic!(matrix_entries[c,v], matrix_entries[c,cc], matrix_entries[cc,cc], matrix_entries[cc,v])
3437
end
3538
ldu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
3639
end
37-
for c in acyclic_children[v]
38-
ldu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
39-
end
4040
end
4141
return
4242
end

src/solvers/lu.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function lu_factorization!(system)
2424
cyclic_children = system.cyclic_children
2525

2626
for v in system.dfs_list
27+
for c in acyclic_children[v]
28+
lu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
29+
end
2730
for c in cyclic_children[v]
2831
for cc in cyclic_children[v]
2932
cc == c && break
@@ -33,9 +36,6 @@ function lu_factorization!(system)
3336
end
3437
lu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
3538
end
36-
for c in acyclic_children[v]
37-
lu_factorization_acyclic!(matrix_entries[v,v], matrix_entries[v,c], matrix_entries[c,c], matrix_entries[c,v], diagonal_inverses[c])
38-
end
3939
end
4040
return
4141
end

src/system/system.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct System{N,T}
8282

8383
full_dfs_graph = SimpleDiGraph(edgelist)
8484
cyclic_children = [unique(vcat(cycles[i]...)) for i=1:N]
85+
cyclic_children = [intersect(dfs_list,cyclic_children[i]) for i=1:N]
8586

8687
new{N,S}(matrix_entries, vector_entries, diagonal_inverses, acyclic_children, cyclic_children, parents, dfs_list, full_graph, full_dfs_graph)
8788
end
@@ -145,3 +146,6 @@ end
145146
# end
146147

147148
full_vector(system) = vcat(getfield.(system.vector_entries,:value)...)
149+
150+
reordered_matrix(system) = full_matrix(system)[system.dfs_list,system.dfs_list]
151+
reordered_vector(system) = full_vector(system)[system.dfs_list]

0 commit comments

Comments
 (0)