|
|
@ -146,6 +146,7 @@ contains
|
|
|
|
& debug_ilaggr=.false., debug_sync=.false.
|
|
|
|
& debug_ilaggr=.false., debug_sync=.false.
|
|
|
|
integer(psb_ipk_), save :: idx_bldmtc=-1, idx_phase1=-1, idx_phase2=-1, idx_phase3=-1
|
|
|
|
integer(psb_ipk_), save :: idx_bldmtc=-1, idx_phase1=-1, idx_phase2=-1, idx_phase3=-1
|
|
|
|
logical, parameter :: do_timings=.true.
|
|
|
|
logical, parameter :: do_timings=.true.
|
|
|
|
|
|
|
|
integer, parameter :: ilaggr_neginit=-1, ilaggr_nonlocal=-2
|
|
|
|
|
|
|
|
|
|
|
|
ictxt = desc_a%get_ctxt()
|
|
|
|
ictxt = desc_a%get_ctxt()
|
|
|
|
call psb_info(ictxt,iam,np)
|
|
|
|
call psb_info(ictxt,iam,np)
|
|
|
@ -187,7 +188,7 @@ contains
|
|
|
|
call desc_a%l2gip(ilv,info,owned=.false.)
|
|
|
|
call desc_a%l2gip(ilv,info,owned=.false.)
|
|
|
|
|
|
|
|
|
|
|
|
call psb_geall(ilaggr,desc_a,info)
|
|
|
|
call psb_geall(ilaggr,desc_a,info)
|
|
|
|
ilaggr = -1
|
|
|
|
ilaggr = ilaggr_neginit
|
|
|
|
call psb_geasb(ilaggr,desc_a,info)
|
|
|
|
call psb_geasb(ilaggr,desc_a,info)
|
|
|
|
nr = a%get_nrows()
|
|
|
|
nr = a%get_nrows()
|
|
|
|
nc = a%get_ncols()
|
|
|
|
nc = a%get_ncols()
|
|
|
@ -259,7 +260,7 @@ contains
|
|
|
|
cycle
|
|
|
|
cycle
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
if (ilaggr(k) == -1) then
|
|
|
|
if (ilaggr(k) == ilaggr_neginit) then
|
|
|
|
|
|
|
|
|
|
|
|
wk = w(k)
|
|
|
|
wk = w(k)
|
|
|
|
widx = w(idx)
|
|
|
|
widx = w(idx)
|
|
|
@ -267,7 +268,7 @@ contains
|
|
|
|
nrmagg = wmax*sqrt((wk/wmax)**2+(widx/wmax)**2)
|
|
|
|
nrmagg = wmax*sqrt((wk/wmax)**2+(widx/wmax)**2)
|
|
|
|
if (nrmagg > epsilon(nrmagg)) then
|
|
|
|
if (nrmagg > epsilon(nrmagg)) then
|
|
|
|
if (idx <= nr) then
|
|
|
|
if (idx <= nr) then
|
|
|
|
if (ilaggr(idx) == -1) then
|
|
|
|
if (ilaggr(idx) == ilaggr_neginit) then
|
|
|
|
! Now, if both vertices are local, the aggregate is local
|
|
|
|
! Now, if both vertices are local, the aggregate is local
|
|
|
|
! (kinda obvious).
|
|
|
|
! (kinda obvious).
|
|
|
|
nlaggr(iam) = nlaggr(iam) + 1
|
|
|
|
nlaggr(iam) = nlaggr(iam) + 1
|
|
|
@ -294,7 +295,7 @@ contains
|
|
|
|
ilaggr(k) = nlaggr(iam)
|
|
|
|
ilaggr(k) = nlaggr(iam)
|
|
|
|
nlpairs = nlpairs+1
|
|
|
|
nlpairs = nlpairs+1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ilaggr(k) = -2
|
|
|
|
ilaggr(k) = ilaggr_nonlocal
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
else
|
|
|
|
else
|
|
|
|
! Use a statistically unbiased tie-breaking rule,
|
|
|
|
! Use a statistically unbiased tie-breaking rule,
|
|
|
@ -309,7 +310,7 @@ contains
|
|
|
|
ilaggr(k) = nlaggr(iam)
|
|
|
|
ilaggr(k) = nlaggr(iam)
|
|
|
|
nlpairs = nlpairs+1
|
|
|
|
nlpairs = nlpairs+1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ilaggr(k) = -2
|
|
|
|
ilaggr(k) = ilaggr_nonlocal
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end if
|
|
|
@ -332,7 +333,7 @@ contains
|
|
|
|
if (do_timings) call psb_tic(idx_phase3)
|
|
|
|
if (do_timings) call psb_tic(idx_phase3)
|
|
|
|
|
|
|
|
|
|
|
|
! Ok, now compute offsets, gather halo and fix non-local
|
|
|
|
! Ok, now compute offsets, gather halo and fix non-local
|
|
|
|
! aggregates (those where ilaggr == -2)
|
|
|
|
! aggregates (those where ilaggr == ilaggr_nonlocal)
|
|
|
|
call psb_sum(ictxt,nlaggr)
|
|
|
|
call psb_sum(ictxt,nlaggr)
|
|
|
|
ntaggr = sum(nlaggr(0:np-1))
|
|
|
|
ntaggr = sum(nlaggr(0:np-1))
|
|
|
|
naggrm1 = sum(nlaggr(0:iam-1))
|
|
|
|
naggrm1 = sum(nlaggr(0:iam-1))
|
|
|
@ -347,7 +348,7 @@ contains
|
|
|
|
call psb_halo(wtemp,desc_a,info)
|
|
|
|
call psb_halo(wtemp,desc_a,info)
|
|
|
|
! Cleanup as yet unmarked entries
|
|
|
|
! Cleanup as yet unmarked entries
|
|
|
|
do k=1,nr
|
|
|
|
do k=1,nr
|
|
|
|
if (ilaggr(k) == -2) then
|
|
|
|
if (ilaggr(k) == ilaggr_nonlocal) then
|
|
|
|
idx = mate(k)
|
|
|
|
idx = mate(k)
|
|
|
|
if (idx > nr) then
|
|
|
|
if (idx > nr) then
|
|
|
|
i = ilaggr(idx)
|
|
|
|
i = ilaggr(idx)
|
|
|
@ -1109,7 +1110,7 @@ contains
|
|
|
|
verlocptr(:) = verlocptr(:) + 1
|
|
|
|
verlocptr(:) = verlocptr(:) + 1
|
|
|
|
verlocind(:) = verlocind(:) + 1
|
|
|
|
verlocind(:) = verlocind(:) + 1
|
|
|
|
verdistance(:) = verdistance(:) + 1
|
|
|
|
verdistance(:) = verdistance(:) + 1
|
|
|
|
if (me==0) write(0,*) 'Ph0/1/2 time ',ph0_time, ph1_time, ph2_time
|
|
|
|
|
|
|
|
if (debug_sync) then
|
|
|
|
if (debug_sync) then
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
if (me == 0) write(0,*)' Done MatchBoxP '
|
|
|
|
if (me == 0) write(0,*)' Done MatchBoxP '
|
|
|
|