From f2cf59c2760ff020a6a5993f88e530b0a1c2c402 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 20 Sep 2021 10:15:54 -0400 Subject: [PATCH] Fix interface to matching method. --- amgprec/amg_d_decmatch_mod.f90 | 7 ++++++- amgprec/amg_d_newmatch_aggregator_mod.F90 | 3 +-- amgprec/impl/aggregator/newmatch_interface.cpp | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/amgprec/amg_d_decmatch_mod.f90 b/amgprec/amg_d_decmatch_mod.f90 index 680b86a9..2a34a599 100644 --- a/amgprec/amg_d_decmatch_mod.f90 +++ b/amgprec/amg_d_decmatch_mod.f90 @@ -224,6 +224,7 @@ contains wtemp(k) = w(k)/abs(w(k)) nlsingl = nlsingl + 1 end if +!!$ write(0,*) k,mate(k),ilaggr(k),' negative match ',abs(w(k)), epsilon(nrmagg) else if (idx > nc) then write(0,*) 'Impossible: mate(k) > nc' cycle @@ -313,7 +314,11 @@ contains ! Shift all indices already assigned (i.e. >0) ! do k=1,nr - if (ilaggr(k) > 0) ilaggr(k) = ilaggr(k) + naggrm1 + if (ilaggr(k) > 0) then + ilaggr(k) = ilaggr(k) + naggrm1 +!!$ else +!!$ write(0,*) 'Leftover ILAGGR',k,ilaggr(k),mate(k),abs(w(k)),epsilon(nrmagg) + end if end do call psb_halo(ilaggr,desc_a,info) call psb_halo(wtemp,desc_a,info) diff --git a/amgprec/amg_d_newmatch_aggregator_mod.F90 b/amgprec/amg_d_newmatch_aggregator_mod.F90 index 63704e1d..7266e09b 100644 --- a/amgprec/amg_d_newmatch_aggregator_mod.F90 +++ b/amgprec/amg_d_newmatch_aggregator_mod.F90 @@ -381,7 +381,7 @@ contains ! For now we ignore IDX - select case(what) + select case(psb_toupper(trim(what))) case('NWM_MATCH_ALG') ag%matching_alg=val case('NWM_SWEEPS') @@ -395,7 +395,6 @@ contains case('AGGR_SIZE') ag%orig_aggr_size = val ag%n_sweeps=max(1,ceiling(log(val*1.0)/log(2.0))) - write(0,*) 'Check: ', val,ag%orig_aggr_size, ag%n_sweeps, 2**ag%n_sweeps case default ! Do nothing end select diff --git a/amgprec/impl/aggregator/newmatch_interface.cpp b/amgprec/impl/aggregator/newmatch_interface.cpp index bd06bf87..0d444a87 100644 --- a/amgprec/impl/aggregator/newmatch_interface.cpp +++ b/amgprec/impl/aggregator/newmatch_interface.cpp @@ -69,7 +69,13 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[], runRomaWrapper(s,t,weights, nr, mateNode,preprocess,romaInput,lambda ,nt, pstat, timeDiff); /* loop here only makes sense when nr==nz */ for (i=0; i< nr; i++) { - mate[i] = mateNode[i]+1; + //fprintf(stderr,"From runRomaWrapper: %d %d\n",i,mateNode[i]); + if (mateNode[i]>=0) { + mate[i] = mateNode[i]+1; + } else { + mate[i] = mateNode[i]; + //fprintf(stderr,"From runRomaWrapper: %d %d\n",i,mateNode[i]); + } } return(0); }