Skip to content

Commit 395fa61

Browse files
committed
fixed bug in updated psaprse_consistent_impl!
1 parent ae538ba commit 395fa61

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/p_sparse_matrix.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,10 +1889,10 @@ function psparse_consistent_impl(A::PSparseMatrix{V,B,C,D,Tv} where {V,B,C,D},
18891889
# global_to_ghost_col = global_to_ghost(cols_co)
18901890
is_own_condition = k -> global_to_own_col[k]!=0
18911891
is_own = is_own_condition.(J_rcv_data)
1892+
is_ghost = map(!,is_own) # inverse is_own bitvector to effectively represent is_ghost mask
18921893
I_rcv_own = I_rcv_data[is_own]
18931894
J_rcv_own = J_rcv_data[is_own]
18941895
V_rcv_own = V_rcv_data[is_own]
1895-
is_ghost = map!(!,is_own, is_own) # inverse is_own bitvector to effectively represent is_ghost mask
18961896
I_rcv_ghost = I_rcv_data[is_ghost]
18971897
J_rcv_ghost = J_rcv_data[is_ghost]
18981898
V_rcv_ghost = V_rcv_data[is_ghost]
@@ -1921,7 +1921,7 @@ function psparse_consistent_impl(A::PSparseMatrix{V,B,C,D,Tv} where {V,B,C,D},
19211921
V_rcv = cache_rcv.V_rcv
19221922
parts_snd = cache_snd.parts_snd
19231923
parts_rcv = cache_rcv.parts_rcv
1924-
cache = (;parts_snd,parts_rcv,k_snd,V_snd,V_rcv,V_rcv_own,V_rcv_ghost,K_own,K_ghost)
1924+
cache = (;parts_snd,parts_rcv,k_snd,V_snd,V_rcv,is_own,is_ghost,V_rcv_own,V_rcv_ghost,K_own,K_ghost)
19251925
values,cache
19261926
end
19271927

@@ -1962,6 +1962,7 @@ function psparse_consistent_impl(A::PSparseMatrix{V,B,C,D,Tv} where {V,B,C,D},
19621962
end
19631963
_psparse_consistent_impl(A,T,rows_co;reuse)
19641964
end
1965+
19651966
# End new consistent
19661967
####################
19671968

@@ -1982,10 +1983,14 @@ function psparse_consistent_impl!(B,A,::Type{<:AbstractSplitMatrix},cache)
19821983
end
19831984
end
19841985
function setup_rcv(B,cache)
1986+
is_own = cache.is_own
1987+
is_ghost = cache.is_ghost
1988+
V_rcv_data = cache.V_rcv.data
19851989
K_own = cache.K_own
19861990
K_ghost = cache.K_ghost
1987-
V_rcv_own = cache.V_rcv_own
1988-
V_rcv_ghost = cache.V_rcv_ghost
1991+
# Allocates memory, while cache.V_rcv_own/ghost could be reused.
1992+
V_rcv_own = V_rcv_data[is_own]
1993+
V_rcv_ghost = V_rcv_data[is_ghost]
19891994
setcoofast!(B.blocks.ghost_own,V_rcv_own,K_own)
19901995
setcoofast!(B.blocks.ghost_ghost,V_rcv_ghost,K_ghost)
19911996
B

test/p_sparse_matrix_tests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ function p_sparse_matrix_tests(distribute)
378378
A_seq = centralize(A)
379379
spmm!(B,Z,A,cacheB)
380380
@test centralize(B) Z_seq*(A_seq)
381-
382381
B = transpose(Z)*A
383382
@test centralize(B) transpose(Z_seq)*A_seq
384383

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ using Test
55
@testset "jagged_array" begin include("jagged_array_tests.jl") end
66
@testset "sparse_utils" begin include("sparse_utils_tests.jl") end
77
@testset "debug_array" begin include("debug_array/runtests.jl") end
8-
@testset "mpi_array" begin include("mpi_array/runtests.jl") end
8+
# @testset "mpi_array" begin include("mpi_array/runtests.jl") end
99

1010
end # module

times.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Dict{String, @NamedTuple{min::Float64, max::Float64, avg::Float64}}("Phase 143" => (min = 0.2010888, max = 0.2010888, avg = 0.2010888), "Phase 3" => (min = 1.0e-7, max = 1.0e-7, avg = 1.0e-7), "Matrix Assembly" => (min = 0.4020026, max = 0.4020026, avg = 0.4020026), "Phase 1" => (min = 5.0e-7, max = 5.0e-7, avg = 5.0e-7))
1+
Dict{String, @NamedTuple{min::Float64, max::Float64, avg::Float64}}("Phase 143" => (min = 0.2188811, max = 0.2188811, avg = 0.2188811), "Phase 3" => (min = 0.0, max = 0.0, avg = 0.0), "Matrix Assembly" => (min = 0.4098738, max = 0.4098738, avg = 0.4098738), "Phase 1" => (min = 5.0e-7, max = 5.0e-7, avg = 5.0e-7))

0 commit comments

Comments
 (0)