Debug for matchboxp

omp-walther
Salvatore Filippone 2 years ago
parent ebe9b45177
commit a612cea167

@ -143,7 +143,7 @@ contains
type(psb_ld_coo_sparse_mat) :: tmpcoo type(psb_ld_coo_sparse_mat) :: tmpcoo
logical :: display_out_, print_out_, reproducible_ logical :: display_out_, print_out_, reproducible_
logical, parameter :: dump=.false., debug=.false., dump_mate=.false., & logical, parameter :: dump=.false., debug=.false., dump_mate=.false., &
& debug_ilaggr=.false., debug_sync=.false. & debug_ilaggr=.false., debug_sync=.false., debug_mate=.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 integer, parameter :: ilaggr_neginit=-1, ilaggr_nonlocal=-2
@ -214,7 +214,20 @@ contains
call psb_barrier(ictxt) call psb_barrier(ictxt)
if (iam == 0) write(0,*)' out from buildmatching:', info if (iam == 0) write(0,*)' out from buildmatching:', info
end if end if
if (debug_mate) then
block
integer(psb_lpk_), allocatable :: ckmate(:)
allocate(ckmate(nr))
ckmate(1:nr) = mate(1:nr)
call psb_msort(ckmate(1:nr))
do i=1,nr-1
if ((ckmate(i)>0) .and. (ckmate(i) == ckmate(i+1))) then
write(0,*) iam,' Duplicate mate entry at',i,' :',ckmate(i)
end if
end do
end block
end if
if (info == 0) then if (info == 0) then
if (do_timings) call psb_tic(idx_phase2) if (do_timings) call psb_tic(idx_phase2)
if (debug_sync) then if (debug_sync) then
@ -276,6 +289,9 @@ contains
ilaggr(idx) = nlaggr(iam) ilaggr(idx) = nlaggr(iam)
wtemp(k) = w(k)/nrmagg wtemp(k) = w(k)/nrmagg
wtemp(idx) = w(idx)/nrmagg wtemp(idx) = w(idx)/nrmagg
else
write(0,*) iam,' Inconsistent mate? ',k,mate(k),idx,&
&mate(idx),ilaggr(idx)
end if end if
nlpairs = nlpairs+1 nlpairs = nlpairs+1
else if (idx <= nc) then else if (idx <= nc) then
@ -326,6 +342,12 @@ contains
nlsingl = nlsingl + 1 nlsingl = nlsingl + 1
end if end if
end if end if
if (ilaggr(k) == ilaggr_neginit) then
write(0,*) iam,' Error: no update to ',k,mate(k),&
& abs(w(k)),nrmagg,epsilon(nrmagg),wtemp(k)
end if
else
if (ilaggr(k)<0) write(0,*) 'Strange? ',k,ilaggr(k)
end if end if
end if end if
end do end do
@ -360,9 +382,14 @@ contains
else else
write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx) write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx)
end if end if
end if else if (ilaggr(k) <0) then
if (ilaggr(k) <0) then write(0,*) iam,'Matchboxp: Funny number: ',k,ilv(k),ilaggr(k),wtemp(k)
write(0,*) 'Matchboxp: Funny number: ',k,ilv(k),ilaggr(k),wtemp(k) write(0,*) iam,' : : ',nr,nc,mate(k)
if (mate(k) <= nr) then
write(0,*) iam,' : : ',ilaggr(mate(k)),mate(mate(k)),&
& ilv(k),ilv(mate(k)), ilv(mate(mate(k))),ilaggr(mate(mate(k)))
end if
flush(0)
end if end if
end do end do
if (debug_sync) then if (debug_sync) then
@ -415,7 +442,7 @@ contains
end block end block
if (iam == 0) then if (iam == 0) then
write(0,*) 'Matching statistics: Unmatched nodes ',& write(0,*) iam,'Matching statistics: Unmatched nodes ',&
& nunmatched,' Singletons:',nlsingl,' Pairs:',nlpairs & nunmatched,' Singletons:',nlsingl,' Pairs:',nlpairs
end if end if

@ -143,7 +143,7 @@ contains
type(psb_ls_coo_sparse_mat) :: tmpcoo type(psb_ls_coo_sparse_mat) :: tmpcoo
logical :: display_out_, print_out_, reproducible_ logical :: display_out_, print_out_, reproducible_
logical, parameter :: dump=.false., debug=.false., dump_mate=.false., & logical, parameter :: dump=.false., debug=.false., dump_mate=.false., &
& debug_ilaggr=.false., debug_sync=.false. & debug_ilaggr=.false., debug_sync=.false., debug_mate=.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 integer, parameter :: ilaggr_neginit=-1, ilaggr_nonlocal=-2
@ -214,7 +214,20 @@ contains
call psb_barrier(ictxt) call psb_barrier(ictxt)
if (iam == 0) write(0,*)' out from buildmatching:', info if (iam == 0) write(0,*)' out from buildmatching:', info
end if end if
if (debug_mate) then
block
integer(psb_lpk_), allocatable :: ckmate(:)
allocate(ckmate(nr))
ckmate(1:nr) = mate(1:nr)
call psb_msort(ckmate(1:nr))
do i=1,nr-1
if ((ckmate(i)>0) .and. (ckmate(i) == ckmate(i+1))) then
write(0,*) iam,' Duplicate mate entry at',i,' :',ckmate(i)
end if
end do
end block
end if
if (info == 0) then if (info == 0) then
if (do_timings) call psb_tic(idx_phase2) if (do_timings) call psb_tic(idx_phase2)
if (debug_sync) then if (debug_sync) then
@ -276,6 +289,9 @@ contains
ilaggr(idx) = nlaggr(iam) ilaggr(idx) = nlaggr(iam)
wtemp(k) = w(k)/nrmagg wtemp(k) = w(k)/nrmagg
wtemp(idx) = w(idx)/nrmagg wtemp(idx) = w(idx)/nrmagg
else
write(0,*) iam,' Inconsistent mate? ',k,mate(k),idx,&
&mate(idx),ilaggr(idx)
end if end if
nlpairs = nlpairs+1 nlpairs = nlpairs+1
else if (idx <= nc) then else if (idx <= nc) then
@ -326,6 +342,12 @@ contains
nlsingl = nlsingl + 1 nlsingl = nlsingl + 1
end if end if
end if end if
if (ilaggr(k) == ilaggr_neginit) then
write(0,*) iam,' Error: no update to ',k,mate(k),&
& abs(w(k)),nrmagg,epsilon(nrmagg),wtemp(k)
end if
else
if (ilaggr(k)<0) write(0,*) 'Strange? ',k,ilaggr(k)
end if end if
end if end if
end do end do
@ -360,9 +382,14 @@ contains
else else
write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx) write(0,*) 'Error : unresolved (paired) index ',k,idx,i,nr,nc, ilv(k),ilv(idx)
end if end if
end if else if (ilaggr(k) <0) then
if (ilaggr(k) <0) then write(0,*) iam,'Matchboxp: Funny number: ',k,ilv(k),ilaggr(k),wtemp(k)
write(0,*) 'Matchboxp: Funny number: ',k,ilv(k),ilaggr(k),wtemp(k) write(0,*) iam,' : : ',nr,nc,mate(k)
if (mate(k) <= nr) then
write(0,*) iam,' : : ',ilaggr(mate(k)),mate(mate(k)),&
& ilv(k),ilv(mate(k)), ilv(mate(mate(k))),ilaggr(mate(mate(k)))
end if
flush(0)
end if end if
end do end do
if (debug_sync) then if (debug_sync) then
@ -415,7 +442,7 @@ contains
end block end block
if (iam == 0) then if (iam == 0) then
write(0,*) 'Matching statistics: Unmatched nodes ',& write(0,*) iam,'Matching statistics: Unmatched nodes ',&
& nunmatched,' Singletons:',nlsingl,' Pairs:',nlpairs & nunmatched,' Singletons:',nlsingl,' Pairs:',nlpairs
end if end if

Loading…
Cancel
Save