diff --git a/amgprec/amg_d_matchboxp_mod.f90 b/amgprec/amg_d_matchboxp_mod.F90 similarity index 98% rename from amgprec/amg_d_matchboxp_mod.f90 rename to amgprec/amg_d_matchboxp_mod.F90 index e19ce617..e129f995 100644 --- a/amgprec/amg_d_matchboxp_mod.f90 +++ b/amgprec/amg_d_matchboxp_mod.F90 @@ -73,6 +73,22 @@ module amg_d_matchboxp_mod use iso_c_binding use psb_base_cbind_mod +#if defined(PSB_SERIAL_MPI) + interface MatchingC + subroutine dMatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,& + & verdistance, mate) bind(c,name='dMatching') + use iso_c_binding + import :: psb_c_ipk_, psb_c_lpk_ + implicit none + + integer(psb_c_lpk_), value :: nlver,nledge + integer(psb_c_lpk_) :: verlocptr(*),verlocind(*), verdistance(*) + integer(psb_c_lpk_) :: mate(*) + real(c_double) :: edgelocweight(*) + end subroutine dMatchingC + end interface MatchingC + +#else interface MatchBoxPC subroutine dMatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,& & verdistance, mate, myrank, numprocs, icomm,& @@ -93,7 +109,7 @@ module amg_d_matchboxp_mod real(c_double) :: msgpercent(*) end subroutine dMatchBoxPC end interface MatchBoxPC - +#endif interface amg_i_aggr_assign module procedure amg_i_d_aggr_assign end interface amg_i_aggr_assign @@ -1129,11 +1145,15 @@ contains call psb_barrier(ictxt) if (me == 0) write(0,*)' Calling MatchBoxP ' end if - +#if defined(PSB_SERIAL_MPI) + call MatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,& + & verdistance, mate) +#else call MatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,& & verdistance, mate, mrank, mnp, icomm,& & msgindsent,msgactualsent,msgpercent,& & ph0_time, ph1_time, ph2_time, ph1_card, ph2_card) +#endif verlocptr(:) = verlocptr(:) + 1 verlocind(:) = verlocind(:) + 1 verdistance(:) = verdistance(:) + 1 diff --git a/amgprec/amg_d_parmatch_aggregator_mod.F90 b/amgprec/amg_d_parmatch_aggregator_mod.F90 index 45611f1f..b48f677e 100644 --- a/amgprec/amg_d_parmatch_aggregator_mod.F90 +++ b/amgprec/amg_d_parmatch_aggregator_mod.F90 @@ -119,10 +119,6 @@ module amg_d_parmatch_aggregator_mod use amg_d_base_aggregator_mod use amg_d_matchboxp_mod -#if defined(PSB_SERIAL_MPI) - type, extends(amg_d_base_aggregator_type) :: amg_d_parmatch_aggregator_type - end type amg_d_parmatch_aggregator_type -#else type, extends(amg_d_base_aggregator_type) :: amg_d_parmatch_aggregator_type integer(psb_ipk_) :: matching_alg integer(psb_ipk_) :: n_sweeps ! When n_sweeps >1 we need an auxiliary descriptor @@ -685,5 +681,4 @@ contains return end subroutine amg_d_parmatch_aggregator_bld_map -#endif end module amg_d_parmatch_aggregator_mod diff --git a/amgprec/amg_s_matchboxp_mod.f90 b/amgprec/amg_s_matchboxp_mod.F90 similarity index 98% rename from amgprec/amg_s_matchboxp_mod.f90 rename to amgprec/amg_s_matchboxp_mod.F90 index a7f41c24..67706ca6 100644 --- a/amgprec/amg_s_matchboxp_mod.f90 +++ b/amgprec/amg_s_matchboxp_mod.F90 @@ -73,6 +73,22 @@ module amg_s_matchboxp_mod use iso_c_binding use psb_base_cbind_mod +#if defined(PSB_SERIAL_MPI) + interface MatchingC + subroutine sMatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,& + & verdistance, mate) bind(c,name='sMatching') + use iso_c_binding + import :: psb_c_ipk_, psb_c_lpk_ + implicit none + + integer(psb_c_lpk_), value :: nlver,nledge + integer(psb_c_lpk_) :: verlocptr(*),verlocind(*), verdistance(*) + integer(psb_c_lpk_) :: mate(*) + real(c_float) :: edgelocweight(*) + end subroutine sMatchingC + end interface MatchingC + +#else interface MatchBoxPC subroutine sMatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,& & verdistance, mate, myrank, numprocs, icomm,& @@ -93,7 +109,7 @@ module amg_s_matchboxp_mod real(c_double) :: msgpercent(*) end subroutine sMatchBoxPC end interface MatchBoxPC - +#endif interface amg_i_aggr_assign module procedure amg_i_s_aggr_assign end interface amg_i_aggr_assign @@ -1129,11 +1145,15 @@ contains call psb_barrier(ictxt) if (me == 0) write(0,*)' Calling MatchBoxP ' end if - +#if defined(PSB_SERIAL_MPI) + call MatchingC(nlver,nledge,verlocptr,verlocind,edgelocweight,& + & verdistance, mate) +#else call MatchBoxPC(nlver,nledge,verlocptr,verlocind,edgelocweight,& & verdistance, mate, mrank, mnp, icomm,& & msgindsent,msgactualsent,msgpercent,& & ph0_time, ph1_time, ph2_time, ph1_card, ph2_card) +#endif verlocptr(:) = verlocptr(:) + 1 verlocind(:) = verlocind(:) + 1 verdistance(:) = verdistance(:) + 1 diff --git a/amgprec/amg_s_parmatch_aggregator_mod.F90 b/amgprec/amg_s_parmatch_aggregator_mod.F90 index e4d0c34c..16caacfe 100644 --- a/amgprec/amg_s_parmatch_aggregator_mod.F90 +++ b/amgprec/amg_s_parmatch_aggregator_mod.F90 @@ -119,10 +119,6 @@ module amg_s_parmatch_aggregator_mod use amg_s_base_aggregator_mod use amg_s_matchboxp_mod -#if defined(PSB_SERIAL_MPI) - type, extends(amg_s_base_aggregator_type) :: amg_s_parmatch_aggregator_type - end type amg_s_parmatch_aggregator_type -#else type, extends(amg_s_base_aggregator_type) :: amg_s_parmatch_aggregator_type integer(psb_ipk_) :: matching_alg integer(psb_ipk_) :: n_sweeps ! When n_sweeps >1 we need an auxiliary descriptor @@ -685,5 +681,4 @@ contains return end subroutine amg_s_parmatch_aggregator_bld_map -#endif end module amg_s_parmatch_aggregator_mod diff --git a/amgprec/impl/aggregator/Makefile b/amgprec/impl/aggregator/Makefile index 11027ac1..6697210c 100644 --- a/amgprec/impl/aggregator/Makefile +++ b/amgprec/impl/aggregator/Makefile @@ -5,7 +5,8 @@ MODDIR=../../../modules HERE=../.. FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES) -CXXINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/. +CXXINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/. -I$(PSBLAS_INCDIR) +CINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(FMFLAG)/. -I$(PSBLAS_INCDIR) #CINCLUDES= -I${SUPERLU_INCDIR} -I${HSL_INCDIR} -I${SPRAL_INCDIR} -I/home/users/pasqua/Ambra/BootCMatch/include -lBCM -L/home/users/pasqua/Ambra/BootCMatch/lib -lm @@ -61,7 +62,8 @@ amg_s_parmatch_unsmth_bld.o \ amg_s_parmatch_smth_bld.o \ amg_s_parmatch_spmm_bld_inner.o -MPCOBJS=MatchBoxPC.o \ +MPCOBJS=Matching.o \ +MatchBoxPC.o \ sendBundledMessages.o \ initialize.o \ extractUChunk.o \ diff --git a/amgprec/impl/aggregator/MatchBoxPC.cpp b/amgprec/impl/aggregator/MatchBoxPC.cpp index 8295c0af..e4fb8995 100644 --- a/amgprec/impl/aggregator/MatchBoxPC.cpp +++ b/amgprec/impl/aggregator/MatchBoxPC.cpp @@ -40,15 +40,17 @@ // ************************************************************************ #include #include -#if !defined(SERIAL_MPI) +#include "amg_config.h" +#include "MatchBoxPC.h" +#if !defined(PSB_SERIAL_MPI) #include #endif -#include "MatchBoxPC.h" #ifdef __cplusplus extern "C" { #endif +#if !defined(PSB_SERIAL_MPI) void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanReal* edgeLocWeight, @@ -58,7 +60,6 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanLongInt* ph1_card, MilanLongInt* ph2_card ) { -#if !defined(SERIAL_MPI) MPI_Comm C_comm=MPI_Comm_f2c(icomm); #ifdef DEBUG @@ -72,7 +73,7 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, double tmr = MPI_Wtime(); #endif -#if defined(OPENMP) +#if defined(PSB_OPENMP) //fprintf(stderr,"Warning: using buggy OpenMP matching!\n"); dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge, verLocPtr, verLocInd, edgeLocWeight, @@ -97,7 +98,6 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, fprintf(stderr, "Elaboration time: %f for %ld nodes\n", tmr, NLVer); #endif -#endif } void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, @@ -108,13 +108,12 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanLongInt* ph1_card, MilanLongInt* ph2_card ) { -#if !defined(SERIAL_MPI) MPI_Comm C_comm=MPI_Comm_f2c(icomm); #ifdef DEBUG fprintf(stderr,"MatchBoxPC: rank %d nlver %ld nledge %ld [ %ld %ld ]\n", myRank,NLVer, NLEdge,verDistance[0],verDistance[1]); #endif -#if defined(OPENMP) +#if defined(PSB_OPENMP) //fprintf(stderr,"Warning: using buggy OpenMP matching!\n"); salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge, verLocPtr, verLocInd, edgeLocWeight, @@ -132,9 +131,10 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, ph0_time, ph1_time, ph2_time, ph1_card, ph2_card ); #endif -#endif } +#endif + #ifdef __cplusplus } #endif diff --git a/amgprec/impl/aggregator/MatchBoxPC.h b/amgprec/impl/aggregator/MatchBoxPC.h index 0afc9b3c..f412c64f 100644 --- a/amgprec/impl/aggregator/MatchBoxPC.h +++ b/amgprec/impl/aggregator/MatchBoxPC.h @@ -59,7 +59,10 @@ #include #include #include -#ifdef OPENMP +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) + +#ifdef PSB_OPENMP // OpenMP is included and used if and only if the OpenMP version of the matching // is required #include "omp.h" @@ -82,7 +85,6 @@ const int BundleTag = 9; // Predefined tag static vector DEFAULT_VECTOR; -#if !defined(SERIAL_MPI) // MPI type map template @@ -95,14 +97,12 @@ template <> inline MPI_Datatype TypeMap() { return MPI_DOUBLE; } template <> inline MPI_Datatype TypeMap() { return MPI_FLOAT; } -#endif #ifdef __cplusplus extern "C" { #endif -#if !defined(SERIAL_MPI) #define MilanMpiLongInt MPI_LONG_LONG @@ -630,8 +630,9 @@ is disabled there is no reason to actually compile or reference them. */ MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time, MilanLongInt *ph1_card, MilanLongInt *ph2_card); -#endif + #ifdef __cplusplus } #endif #endif +#endif diff --git a/amgprec/impl/aggregator/Matching.c b/amgprec/impl/aggregator/Matching.c new file mode 100644 index 00000000..fa7ab67f --- /dev/null +++ b/amgprec/impl/aggregator/Matching.c @@ -0,0 +1,227 @@ +#include "amg_config.h" +#if defined(PSB_SERIAL_MPI) +#include +#include "psb_types.h" + +psb_l_t d_trymatch(psb_l_t rowindex, psb_l_t colindex, + psb_l_t nrows_W, psb_l_t *W_i, psb_l_t *W_j, psb_d_t *W_data, + psb_l_t *jrowindex, psb_l_t ljrowindex, + psb_l_t *jcolindex, psb_l_t ljcolindex, psb_l_t *rmatch) +{ + + psb_l_t tryrowmatch, trycolmatch; + psb_l_t i, j, k, nzrow_W, startj, kindex; + psb_d_t cweight, nweight; + + // psb_l_t *W_i = bcm_CSRMatrixI(W); + // psb_l_t *W_j = bcm_CSRMatrixJ(W); + // psb_l_t nrows_W = bcm_CSRMatrixNumRows(W); + // psb_d_t *W_data=bcm_CSRMatrixData(W); + + k=-1; + i=0; + while (i= 0) + { + ljrowindex=ljrowindex-1; + for(i=k; i= 0) + { + ljcolindex=ljcolindex-1; + for(i=k; i cweight && rmatch[tryrowmatch]==-1) + { + + nzrow_W=W_i[tryrowmatch+1]-W_i[tryrowmatch]; + psb_l_t *trymatchindexrow; + trymatchindexrow= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t)); + + startj=W_i[tryrowmatch]; + for(k=0; k cweight && rmatch[trycolmatch]==-1) + { + nzrow_W=W_i[trycolmatch+1]-W_i[trycolmatch]; + psb_l_t *trymatchindexcol; + trymatchindexcol= (psb_l_t *) calloc(nzrow_W, sizeof(psb_l_t)); + + startj=W_i[trycolmatch]; + for(k=0; k amg_d_parmatch_aggregator_inner_mat_asb -#endif implicit none class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag type(amg_dml_parms), intent(inout) :: parms @@ -133,8 +129,6 @@ subroutine amg_d_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& ictxt = desc_a%get_context() call psb_info(ictxt,me,np) -#if !defined(PSB_SERIAL_MPI) - if (debug) write(0,*) me,' ',trim(name),' Start:',& & allocated(ag%ac),allocated(ag%desc_ac), allocated(ag%prol),allocated(ag%restr) @@ -146,16 +140,17 @@ subroutine amg_d_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& case(amg_repl_mat_) ! ! - info = psb_err_internal_error_ - call psb_errpush(info,name,a_err='no repl coarse_mat_ here') - goto 9999 - + if (np>1) then + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='no repl coarse_mat_ here') + goto 9999 + end if case default info = psb_err_internal_error_ call psb_errpush(info,name,a_err='invalid amg_coarse_mat_') goto 9999 end select -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_asb.F90 b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_asb.F90 index 4340d9f5..6a5698a6 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_asb.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_asb.F90 @@ -98,11 +98,7 @@ subroutine amg_d_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& & ac,desc_ac, op_prol,op_restr,info) use psb_base_mod use amg_base_prec_type -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_mat_asb -#endif implicit none class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag type(amg_dml_parms), intent(inout) :: parms @@ -135,8 +131,6 @@ subroutine amg_d_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& return end if - -#if !defined(PSB_SERIAL_MPI) if (debug) write(0,*) me,' ',trim(name),' Start:',& & allocated(ag%ac),allocated(ag%desc_ac), allocated(ag%prol),allocated(ag%restr) @@ -199,7 +193,7 @@ subroutine amg_d_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& call psb_errpush(info,name,a_err='invalid amg_coarse_mat_') goto 9999 end select -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_bld.F90 b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_bld.F90 index ac3cb57f..dfeb6239 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_bld.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_mat_bld.F90 @@ -135,11 +135,7 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& use psb_base_mod use amg_d_inner_mod use amg_base_prec_type -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_mat_bld -#endif implicit none class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag @@ -176,7 +172,6 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& ! algorithm specified by ! -#if !defined(PSB_SERIAL_MPI) call clean_shortcuts(ag) ! ! When requesting smoothed aggregation we cannot use the @@ -212,14 +207,12 @@ subroutine amg_d_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& call psb_errpush(psb_err_from_subroutine_,name,a_err='Inner aggrmat asb') goto 9999 end if -#endif call psb_erractionrestore(err_act) return 9999 call psb_error_handler(err_act) return -#if !defined(PSB_SERIAL_MPI) contains subroutine clean_shortcuts(ag) @@ -248,5 +241,4 @@ contains end if end if end subroutine clean_shortcuts -#endif end subroutine amg_d_parmatch_aggregator_mat_bld diff --git a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_tprol.F90 b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_tprol.F90 index 67b31a16..69cc2f89 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_tprol.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_tprol.F90 @@ -47,11 +47,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,& use psb_base_mod use amg_base_prec_type use amg_d_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_build_tprol -#endif use iso_c_binding implicit none class(amg_d_parmatch_aggregator_type), target, intent(inout) :: ag @@ -120,8 +116,6 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,& & amg_aggr_ord_nat_,is_legal_ml_aggr_ord) call amg_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs) -#if !defined(PSB_SERIAL_MPI) - match_algorithm = ag%matching_alg n_sweeps = ag%n_sweeps if (2**n_sweeps /= ag%orig_aggr_size) then @@ -466,7 +460,7 @@ subroutine amg_d_parmatch_aggregator_build_tprol(ag,parms,ag_data,& call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_bootCMatch_if') goto 9999 end if -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_smth_bld.F90 b/amgprec/impl/aggregator/amg_d_parmatch_smth_bld.F90 index cdb40203..0af4b0a1 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_smth_bld.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_smth_bld.F90 @@ -110,11 +110,7 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& use amg_base_prec_type use amg_d_inner_mod use amg_d_base_aggregator_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_smth_bld -#endif implicit none ! Arguments @@ -194,8 +190,6 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& if (do_timings) call psb_tic(idx_phase1) -#if !defined(PSB_SERIAL_MPI) - naggr = nlaggr(me+1) ntaggr = sum(nlaggr) naggrm1 = sum(nlaggr(1:me)) @@ -403,7 +397,7 @@ subroutine amg_d_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done smooth_aggregate ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld.F90 b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld.F90 index 3342d326..ff46a024 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld.F90 @@ -99,11 +99,7 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_d_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld -#endif implicit none ! Arguments @@ -140,7 +136,6 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() -#if !defined(PSB_SERIAL_MPI) call a%cp_to(acsr) call amg_d_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,& @@ -154,7 +149,7 @@ subroutine amg_d_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done spmm_bld ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_inner.F90 b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_inner.F90 index a5cca5ad..a5c4eda2 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_inner.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_inner.F90 @@ -99,11 +99,7 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_d_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld_inner -#endif implicit none ! Arguments @@ -139,7 +135,6 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& info=psb_success_ call psb_erractionsave(err_act) - ictxt = desc_a%get_context() call psb_info(ictxt, me, np) debug_unit = psb_get_debug_unit() @@ -163,7 +158,6 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& naggrm1 = sum(nlaggr(1:me)) naggrp1 = sum(nlaggr(1:me+1)) -#if !defined(PSB_SERIAL_MPI) ! ! Here T_PROL should be arriving with GLOBAL indices on the cols ! and LOCAL indices on the rows. @@ -203,11 +197,10 @@ subroutine amg_d_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& goto 9999 end if - if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done smooth_aggregate ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_ov.F90 b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_ov.F90 index 68546ddc..e83594e5 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_ov.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_spmm_bld_ov.F90 @@ -99,11 +99,7 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_d_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_spmm_bld_ov -#endif implicit none ! Arguments @@ -141,8 +137,6 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() -#if !defined(PSB_SERIAL_MPI) - call a%mv_to(acsr) call amg_d_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,& @@ -158,7 +152,6 @@ subroutine amg_d_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done spmm_bld ' -#endif call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_d_parmatch_unsmth_bld.F90 b/amgprec/impl/aggregator/amg_d_parmatch_unsmth_bld.F90 index 8cf14250..05374433 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_unsmth_bld.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_unsmth_bld.F90 @@ -109,11 +109,7 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& use amg_base_prec_type use amg_d_inner_mod use amg_d_base_aggregator_mod -#if defined(PSB_SERIAL_MPI) - use amg_d_parmatch_aggregator_mod -#else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_unsmth_bld -#endif implicit none ! Arguments @@ -168,7 +164,6 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& goto 9999 end if -#if !defined(PSB_SERIAL_MPI) nglob = desc_a%get_global_rows() nrow = desc_a%get_local_rows() ncol = desc_a%get_local_cols() @@ -209,7 +204,8 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& call op_prol%mv_from(coo_prol) if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus() - if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr + if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),& + & ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr ! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros() if (debug) then @@ -236,7 +232,6 @@ subroutine amg_d_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& goto 9999 end if -#endif call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_inner_mat_asb.F90 b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_inner_mat_asb.F90 index 00009e9c..1834b3eb 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_inner_mat_asb.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_inner_mat_asb.F90 @@ -98,11 +98,7 @@ subroutine amg_s_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& & ac,desc_ac, op_prol,op_restr,info) use psb_base_mod use amg_base_prec_type -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_aggregator_inner_mat_asb -#endif implicit none class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag type(amg_sml_parms), intent(inout) :: parms @@ -133,8 +129,6 @@ subroutine amg_s_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& ictxt = desc_a%get_context() call psb_info(ictxt,me,np) -#if !defined(PSB_SERIAL_MPI) - if (debug) write(0,*) me,' ',trim(name),' Start:',& & allocated(ag%ac),allocated(ag%desc_ac), allocated(ag%prol),allocated(ag%restr) @@ -146,16 +140,17 @@ subroutine amg_s_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& case(amg_repl_mat_) ! ! - info = psb_err_internal_error_ - call psb_errpush(info,name,a_err='no repl coarse_mat_ here') - goto 9999 - + if (np>1) then + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='no repl coarse_mat_ here') + goto 9999 + end if case default info = psb_err_internal_error_ call psb_errpush(info,name,a_err='invalid amg_coarse_mat_') goto 9999 end select -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_asb.F90 b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_asb.F90 index 412c7b5e..edd187ad 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_asb.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_asb.F90 @@ -98,11 +98,7 @@ subroutine amg_s_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& & ac,desc_ac, op_prol,op_restr,info) use psb_base_mod use amg_base_prec_type -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_aggregator_mat_asb -#endif implicit none class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag type(amg_sml_parms), intent(inout) :: parms @@ -135,8 +131,6 @@ subroutine amg_s_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& return end if - -#if !defined(PSB_SERIAL_MPI) if (debug) write(0,*) me,' ',trim(name),' Start:',& & allocated(ag%ac),allocated(ag%desc_ac), allocated(ag%prol),allocated(ag%restr) @@ -199,7 +193,7 @@ subroutine amg_s_parmatch_aggregator_mat_asb(ag,parms,a,desc_a,& call psb_errpush(info,name,a_err='invalid amg_coarse_mat_') goto 9999 end select -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_bld.F90 b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_bld.F90 index 51b8bfcd..39d6dd01 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_bld.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_mat_bld.F90 @@ -135,11 +135,7 @@ subroutine amg_s_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& use psb_base_mod use amg_s_inner_mod use amg_base_prec_type -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_aggregator_mat_bld -#endif implicit none class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag @@ -176,7 +172,6 @@ subroutine amg_s_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& ! algorithm specified by ! -#if !defined(PSB_SERIAL_MPI) call clean_shortcuts(ag) ! ! When requesting smoothed aggregation we cannot use the @@ -212,14 +207,12 @@ subroutine amg_s_parmatch_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,& call psb_errpush(psb_err_from_subroutine_,name,a_err='Inner aggrmat asb') goto 9999 end if -#endif call psb_erractionrestore(err_act) return 9999 call psb_error_handler(err_act) return -#if !defined(PSB_SERIAL_MPI) contains subroutine clean_shortcuts(ag) @@ -248,5 +241,4 @@ contains end if end if end subroutine clean_shortcuts -#endif end subroutine amg_s_parmatch_aggregator_mat_bld diff --git a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_tprol.F90 b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_tprol.F90 index e9cadd0c..847bbd2c 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_aggregator_tprol.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_aggregator_tprol.F90 @@ -47,11 +47,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,& use psb_base_mod use amg_base_prec_type use amg_s_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_aggregator_build_tprol -#endif use iso_c_binding implicit none class(amg_s_parmatch_aggregator_type), target, intent(inout) :: ag @@ -120,8 +116,6 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,& & amg_aggr_ord_nat_,is_legal_ml_aggr_ord) call amg_check_def(parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs) -#if !defined(PSB_SERIAL_MPI) - match_algorithm = ag%matching_alg n_sweeps = ag%n_sweeps if (2**n_sweeps /= ag%orig_aggr_size) then @@ -466,7 +460,7 @@ subroutine amg_s_parmatch_aggregator_build_tprol(ag,parms,ag_data,& call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_bootCMatch_if') goto 9999 end if -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_smth_bld.F90 b/amgprec/impl/aggregator/amg_s_parmatch_smth_bld.F90 index 871f8808..9e3e532f 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_smth_bld.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_smth_bld.F90 @@ -110,11 +110,7 @@ subroutine amg_s_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& use amg_base_prec_type use amg_s_inner_mod use amg_s_base_aggregator_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_smth_bld -#endif implicit none ! Arguments @@ -194,8 +190,6 @@ subroutine amg_s_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& if (do_timings) call psb_tic(idx_phase1) -#if !defined(PSB_SERIAL_MPI) - naggr = nlaggr(me+1) ntaggr = sum(nlaggr) naggrm1 = sum(nlaggr(1:me)) @@ -403,7 +397,7 @@ subroutine amg_s_parmatch_smth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done smooth_aggregate ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld.F90 b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld.F90 index 586353d6..9e2e0ea8 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld.F90 @@ -99,11 +99,7 @@ subroutine amg_s_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_s_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_spmm_bld -#endif implicit none ! Arguments @@ -140,7 +136,6 @@ subroutine amg_s_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() -#if !defined(PSB_SERIAL_MPI) call a%cp_to(acsr) call amg_s_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,& @@ -154,7 +149,7 @@ subroutine amg_s_parmatch_spmm_bld(a,desc_a,ilaggr,nlaggr,parms,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done spmm_bld ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_inner.F90 b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_inner.F90 index 93a58a74..c92d61ae 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_inner.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_inner.F90 @@ -99,11 +99,7 @@ subroutine amg_s_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_s_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_spmm_bld_inner -#endif implicit none ! Arguments @@ -139,7 +135,6 @@ subroutine amg_s_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& info=psb_success_ call psb_erractionsave(err_act) - ictxt = desc_a%get_context() call psb_info(ictxt, me, np) debug_unit = psb_get_debug_unit() @@ -163,7 +158,6 @@ subroutine amg_s_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& naggrm1 = sum(nlaggr(1:me)) naggrp1 = sum(nlaggr(1:me+1)) -#if !defined(PSB_SERIAL_MPI) ! ! Here T_PROL should be arriving with GLOBAL indices on the cols ! and LOCAL indices on the rows. @@ -203,11 +197,10 @@ subroutine amg_s_parmatch_spmm_bld_inner(a_csr,desc_a,ilaggr,nlaggr,parms,& goto 9999 end if - if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done smooth_aggregate ' -#endif + call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_ov.F90 b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_ov.F90 index b79920df..a381b1d2 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_ov.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_spmm_bld_ov.F90 @@ -99,11 +99,7 @@ subroutine amg_s_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& & ac,desc_ac,op_prol,op_restr,t_prol,info) use psb_base_mod use amg_s_inner_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_spmm_bld_ov -#endif implicit none ! Arguments @@ -141,8 +137,6 @@ subroutine amg_s_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() -#if !defined(PSB_SERIAL_MPI) - call a%mv_to(acsr) call amg_s_parmatch_spmm_bld_inner(acsr,desc_a,ilaggr,nlaggr,parms,& @@ -158,7 +152,6 @@ subroutine amg_s_parmatch_spmm_bld_ov(a,desc_a,ilaggr,nlaggr,parms,& if (debug_level >= psb_debug_outer_) & & write(debug_unit,*) me,' ',trim(name),& & 'Done spmm_bld ' -#endif call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/amg_s_parmatch_unsmth_bld.F90 b/amgprec/impl/aggregator/amg_s_parmatch_unsmth_bld.F90 index c2a2d9d5..31a2c716 100644 --- a/amgprec/impl/aggregator/amg_s_parmatch_unsmth_bld.F90 +++ b/amgprec/impl/aggregator/amg_s_parmatch_unsmth_bld.F90 @@ -109,11 +109,7 @@ subroutine amg_s_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& use amg_base_prec_type use amg_s_inner_mod use amg_s_base_aggregator_mod -#if defined(PSB_SERIAL_MPI) - use amg_s_parmatch_aggregator_mod -#else use amg_s_parmatch_aggregator_mod, amg_protect_name => amg_s_parmatch_unsmth_bld -#endif implicit none ! Arguments @@ -168,7 +164,6 @@ subroutine amg_s_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& goto 9999 end if -#if !defined(PSB_SERIAL_MPI) nglob = desc_a%get_global_rows() nrow = desc_a%get_local_rows() ncol = desc_a%get_local_cols() @@ -209,7 +204,8 @@ subroutine amg_s_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& call op_prol%mv_from(coo_prol) if (debug) write(0,*) me,' ',trim(name),' After mv_from',psb_get_errstatus() - if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr + if (debug) write(0,*) me,' ',trim(name),' ',ac%get_fmt(),ac%get_nrows(),& + & ac%get_ncols(),ac%get_nzeros(),naggr,ntaggr ! write(0,*) me,' ',trim(name),' Final AC newstyle ',ac%get_fmt(),ac%get_nrows(),ac%get_ncols(),ac%get_nzeros() if (debug) then @@ -236,7 +232,6 @@ subroutine amg_s_parmatch_unsmth_bld(dol1smoothing,ag,a,desc_a,ilaggr,nlaggr,& goto 9999 end if -#endif call psb_erractionrestore(err_act) return diff --git a/amgprec/impl/aggregator/clean.cpp b/amgprec/impl/aggregator/clean.cpp index a3109dc3..cc664ba2 100644 --- a/amgprec/impl/aggregator/clean.cpp +++ b/amgprec/impl/aggregator/clean.cpp @@ -1,6 +1,6 @@ #include "MatchBoxPC.h" // TODO comment -#if !defined(SERIAL_MPI) +#if !defined(PSB_SERIAL_MPI) void clean(MilanLongInt NLVer, MilanInt myRank, diff --git a/amgprec/impl/aggregator/computeCandidateMate.cpp b/amgprec/impl/aggregator/computeCandidateMate.cpp index d0692d65..4271bac5 100644 --- a/amgprec/impl/aggregator/computeCandidateMate.cpp +++ b/amgprec/impl/aggregator/computeCandidateMate.cpp @@ -8,6 +8,7 @@ * @param edgeLocWeight * @return */ +#if !defined(PSB_SERIAL_MPI) MilanLongInt firstComputeCandidateMateD(MilanLongInt adj1, MilanLongInt adj2, @@ -136,3 +137,4 @@ MilanLongInt computeCandidateMateS(MilanLongInt adj1, return w; } +#endif diff --git a/amgprec/impl/aggregator/dataStrStaticQueue.h b/amgprec/impl/aggregator/dataStrStaticQueue.h index c6e6882a..04fa3acc 100644 --- a/amgprec/impl/aggregator/dataStrStaticQueue.h +++ b/amgprec/impl/aggregator/dataStrStaticQueue.h @@ -41,7 +41,10 @@ #ifndef _static_Queue_ #define _static_Queue_ +#include "amg_config.h" + +#if !defined(PSB_SERIAL_MPI) #include "primitiveDataTypeDefinitions.h" #include "preProcessorDirectives.h" @@ -199,3 +202,4 @@ class staticQueue }; #endif +#endif diff --git a/amgprec/impl/aggregator/extractUChunk.cpp b/amgprec/impl/aggregator/extractUChunk.cpp index 9f5bdfe2..09ebb8e8 100644 --- a/amgprec/impl/aggregator/extractUChunk.cpp +++ b/amgprec/impl/aggregator/extractUChunk.cpp @@ -1,4 +1,8 @@ +#include "amg_config.h" #include "MatchBoxPC.h" + +#if !defined(PSB_SERIAL_MPI) + void extractUChunk( vector &UChunkBeingProcessed, vector &U, @@ -28,3 +32,4 @@ void extractUChunk( } // End of critical U // End of critical U } +#endif diff --git a/amgprec/impl/aggregator/findOwnerOfGhost.cpp b/amgprec/impl/aggregator/findOwnerOfGhost.cpp index 779a5e7f..2a0dbf44 100644 --- a/amgprec/impl/aggregator/findOwnerOfGhost.cpp +++ b/amgprec/impl/aggregator/findOwnerOfGhost.cpp @@ -1,4 +1,6 @@ +#include "amg_config.h" #include "MatchBoxPC.h" +#if !defined(PSB_SERIAL_MPI) /// Find the owner of a ghost node: MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance, MilanInt myRank, MilanInt numProcs) @@ -26,3 +28,4 @@ MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance, return Current; } // End of findOwnerOfGhost() +#endif diff --git a/amgprec/impl/aggregator/initialize.cpp b/amgprec/impl/aggregator/initialize.cpp index baac9e8c..413ee9f4 100644 --- a/amgprec/impl/aggregator/initialize.cpp +++ b/amgprec/impl/aggregator/initialize.cpp @@ -1,4 +1,7 @@ +#include "amg_config.h" #include "MatchBoxPC.h" +#if !defined(PSB_SERIAL_MPI) + void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt StartIndex, MilanLongInt EndIndex, MilanLongInt *numGhostEdges, @@ -301,3 +304,4 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, } // End of single region } // End of parallel region } +#endif diff --git a/amgprec/impl/aggregator/isAlreadyMatched.cpp b/amgprec/impl/aggregator/isAlreadyMatched.cpp index 62cdca4b..92e5f643 100644 --- a/amgprec/impl/aggregator/isAlreadyMatched.cpp +++ b/amgprec/impl/aggregator/isAlreadyMatched.cpp @@ -1,4 +1,7 @@ +#include "amg_config.h" #include "MatchBoxPC.h" +#if !defined(PSB_SERIAL_MPI) + /** * //TODO documentation * @param k @@ -43,3 +46,4 @@ bool isAlreadyMatched(MilanLongInt node, return val >= 0; // Already matched } +#endif diff --git a/amgprec/impl/aggregator/parallelComputeCandidateMateB.cpp b/amgprec/impl/aggregator/parallelComputeCandidateMateB.cpp index 7c3033be..276fbcf9 100644 --- a/amgprec/impl/aggregator/parallelComputeCandidateMateB.cpp +++ b/amgprec/impl/aggregator/parallelComputeCandidateMateB.cpp @@ -1,4 +1,6 @@ +#include "amg_config.h" #include "MatchBoxPC.h" +#if !defined(PSB_SERIAL_MPI) void PARALLEL_COMPUTE_CANDIDATE_MATE_BD(MilanLongInt NLVer, MilanLongInt *verLocPtr, @@ -53,4 +55,4 @@ void PARALLEL_COMPUTE_CANDIDATE_MATE_BS(MilanLongInt NLVer, } } } - +#endif diff --git a/amgprec/impl/aggregator/preProcessorDirectives.h b/amgprec/impl/aggregator/preProcessorDirectives.h index 5c796cf0..fcdebb4b 100644 --- a/amgprec/impl/aggregator/preProcessorDirectives.h +++ b/amgprec/impl/aggregator/preProcessorDirectives.h @@ -41,6 +41,8 @@ #ifndef _preprocessor_Directives_ #define _preprocessor_Directives_ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) //I/O #include @@ -72,10 +74,10 @@ #include //MPI: -#if !defined(SERIAL_MPI) +#if !defined(PSB_SERIAL_MPI) #include "mpi.h" #endif - +#endif #endif diff --git a/amgprec/impl/aggregator/primitiveDataTypeDefinitions.h b/amgprec/impl/aggregator/primitiveDataTypeDefinitions.h index fd75f265..a8bc4d5b 100644 --- a/amgprec/impl/aggregator/primitiveDataTypeDefinitions.h +++ b/amgprec/impl/aggregator/primitiveDataTypeDefinitions.h @@ -41,6 +41,8 @@ #ifndef _primitiveDataType_Definition_ #define _primitiveDataType_Definition_ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "preProcessorDirectives.h" @@ -152,5 +154,5 @@ const float FMINUS_INFINITY = -FPLUS_INFINITY; #endif - +#endif #endif diff --git a/amgprec/impl/aggregator/processCrossEdge.cpp b/amgprec/impl/aggregator/processCrossEdge.cpp index d9d557a6..411e6be4 100644 --- a/amgprec/impl/aggregator/processCrossEdge.cpp +++ b/amgprec/impl/aggregator/processCrossEdge.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" void PROCESS_CROSS_EDGE(MilanLongInt *edge, MilanLongInt *S) @@ -21,3 +23,4 @@ void PROCESS_CROSS_EDGE(MilanLongInt *edge, // End: PARALLEL_PROCESS_CROSS_EDGE_B } +#endif diff --git a/amgprec/impl/aggregator/processExposedVertex.cpp b/amgprec/impl/aggregator/processExposedVertex.cpp index e55f6ff3..5c503b4d 100644 --- a/amgprec/impl/aggregator/processExposedVertex.cpp +++ b/amgprec/impl/aggregator/processExposedVertex.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer, MilanLongInt *candidateMate, @@ -367,3 +369,4 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_BS(MilanLongInt NLVer, } // End of parallel region } +#endif diff --git a/amgprec/impl/aggregator/processMatchedVertices.cpp b/amgprec/impl/aggregator/processMatchedVertices.cpp index b071d662..15d2ba45 100644 --- a/amgprec/impl/aggregator/processMatchedVertices.cpp +++ b/amgprec/impl/aggregator/processMatchedVertices.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" void processMatchedVerticesD( MilanLongInt NLVer, @@ -583,3 +585,4 @@ void processMatchedVerticesS( } // End of parallel region } +#endif diff --git a/amgprec/impl/aggregator/processMatchedVerticesAndSendMessages.cpp b/amgprec/impl/aggregator/processMatchedVerticesAndSendMessages.cpp index 72bf3f7b..c9642032 100644 --- a/amgprec/impl/aggregator/processMatchedVerticesAndSendMessages.cpp +++ b/amgprec/impl/aggregator/processMatchedVerticesAndSendMessages.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" //#define DEBUG_HANG_ void processMatchedVerticesAndSendMessagesD( @@ -589,3 +591,4 @@ void processMatchedVerticesAndSendMessagesS( #endif } +#endif diff --git a/amgprec/impl/aggregator/processMessages.cpp b/amgprec/impl/aggregator/processMessages.cpp index aeb03808..6300f9ee 100644 --- a/amgprec/impl/aggregator/processMessages.cpp +++ b/amgprec/impl/aggregator/processMessages.cpp @@ -1,6 +1,7 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" //#define DEBUG_HANG_ -#if !defined(SERIAL_MPI) void processMessagesD( MilanLongInt NLVer, diff --git a/amgprec/impl/aggregator/queueTransfer.cpp b/amgprec/impl/aggregator/queueTransfer.cpp index 82d30ae2..e96dee89 100644 --- a/amgprec/impl/aggregator/queueTransfer.cpp +++ b/amgprec/impl/aggregator/queueTransfer.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" void queuesTransfer(vector &U, vector &privateU, @@ -31,3 +33,4 @@ void queuesTransfer(vector &U, } +#endif diff --git a/amgprec/impl/aggregator/sendBundledMessages.cpp b/amgprec/impl/aggregator/sendBundledMessages.cpp index debabf7e..2290c2d1 100644 --- a/amgprec/impl/aggregator/sendBundledMessages.cpp +++ b/amgprec/impl/aggregator/sendBundledMessages.cpp @@ -1,3 +1,5 @@ +#include "amg_config.h" +#if !defined(PSB_SERIAL_MPI) #include "MatchBoxPC.h" void sendBundledMessages(MilanLongInt *numGhostEdges, MilanInt *BufferSize, @@ -154,7 +156,7 @@ void sendBundledMessages(MilanLongInt *numGhostEdges, #pragma omp task depend(inout : OneMessageSize, *BufferSize) depend(out : numMessagesToSend) depend(in : *numGhostEdges) { - + #ifdef PRINT_DEBUG_INFO_ cout << "\n(" << myRank << ")Number of Ghost edges = " << *numGhostEdges; cout << "\n(" << myRank << ")Total number of potential message X 2 = " << *numGhostEdges * 2; @@ -206,3 +208,4 @@ void sendBundledMessages(MilanLongInt *numGhostEdges, } } } +#endif diff --git a/amgprec/impl/level/amg_c_base_onelev_csetc.F90 b/amgprec/impl/level/amg_c_base_onelev_csetc.F90 index 22bfd112..8c82192c 100644 --- a/amgprec/impl/level/amg_c_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_c_base_onelev_csetc.F90 @@ -252,15 +252,9 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) allocate(amg_c_dec_aggregator_type :: lv%aggr, stat=info) case('SYMDEC') allocate(amg_c_symdec_aggregator_type :: lv%aggr, stat=info) -#if !defined(PSB_SERIAL_MPI) -#endif case default info = psb_err_internal_error_ -#if !defined(PSB_SERIAL_MPI) call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG') -#else - call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (PSB_SERIAL_MPI on)') -#endif goto 9999 end select if (info == psb_success_) call lv%aggr%default() diff --git a/amgprec/impl/level/amg_d_base_onelev_csetc.F90 b/amgprec/impl/level/amg_d_base_onelev_csetc.F90 index 3ad55b07..65409908 100644 --- a/amgprec/impl/level/amg_d_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_d_base_onelev_csetc.F90 @@ -42,9 +42,7 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_d_base_aggregator_mod use amg_d_dec_aggregator_mod use amg_d_symdec_aggregator_mod -#if !defined(PSB_SERIAL_MPI) use amg_d_parmatch_aggregator_mod -#endif use amg_d_poly_smoother use amg_d_jac_smoother use amg_d_as_smoother @@ -280,17 +278,11 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info) case('SYMDEC') allocate(amg_d_symdec_aggregator_type :: lv%aggr, stat=info) -#if !defined(PSB_SERIAL_MPI) case('COUP','COUPLED') allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info) -#endif case default info = psb_err_internal_error_ -#if !defined(PSB_SERIAL_MPI) call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG') -#else - call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (PSB_SERIAL_MPI on)') -#endif goto 9999 end select if (info == psb_success_) call lv%aggr%default() diff --git a/amgprec/impl/level/amg_s_base_onelev_csetc.F90 b/amgprec/impl/level/amg_s_base_onelev_csetc.F90 index 05583ee3..a1c0a7a8 100644 --- a/amgprec/impl/level/amg_s_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_s_base_onelev_csetc.F90 @@ -42,9 +42,7 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_s_base_aggregator_mod use amg_s_dec_aggregator_mod use amg_s_symdec_aggregator_mod -#if !defined(PSB_SERIAL_MPI) use amg_s_parmatch_aggregator_mod -#endif use amg_s_poly_smoother use amg_s_jac_smoother use amg_s_as_smoother @@ -260,17 +258,11 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info) case('SYMDEC') allocate(amg_s_symdec_aggregator_type :: lv%aggr, stat=info) -#if !defined(PSB_SERIAL_MPI) case('COUP','COUPLED') allocate(amg_s_parmatch_aggregator_type :: lv%aggr, stat=info) -#endif case default info = psb_err_internal_error_ -#if !defined(PSB_SERIAL_MPI) call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG') -#else - call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (PSB_SERIAL_MPI on)') -#endif goto 9999 end select if (info == psb_success_) call lv%aggr%default() diff --git a/amgprec/impl/level/amg_z_base_onelev_csetc.F90 b/amgprec/impl/level/amg_z_base_onelev_csetc.F90 index 6df9e7dd..512f0ec0 100644 --- a/amgprec/impl/level/amg_z_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_z_base_onelev_csetc.F90 @@ -272,15 +272,9 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) allocate(amg_z_dec_aggregator_type :: lv%aggr, stat=info) case('SYMDEC') allocate(amg_z_symdec_aggregator_type :: lv%aggr, stat=info) -#if !defined(PSB_SERIAL_MPI) -#endif case default info = psb_err_internal_error_ -#if !defined(PSB_SERIAL_MPI) call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG') -#else - call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (PSB_SERIAL_MPI on)') -#endif goto 9999 end select if (info == psb_success_) call lv%aggr%default() diff --git a/samples/advanced/pdegen/runs/amg_pde3d.inp b/samples/advanced/pdegen/runs/amg_pde3d.inp index 8be7e3ec..68d4fba5 100644 --- a/samples/advanced/pdegen/runs/amg_pde3d.inp +++ b/samples/advanced/pdegen/runs/amg_pde3d.inp @@ -58,8 +58,8 @@ VCYCLE ! Type of multilevel CYCLE: VCYCLE WCYCLE KCYCLE MUL -3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default -3 ! Target coarse matrix size per process; if <0, lib default SMOOTHED ! Type of aggregation: SMOOTHED UNSMOOTHED -DEC ! Parallel aggregation: DEC, SYMDEC, COUPLED -SOC1 ! aggregation measure SOC1, MATCHBOXP +COUPLED ! Parallel aggregation: DEC, SYMDEC, COUPLED +MATCHBOXP ! aggregation measure SOC1, MATCHBOXP 8 ! Requested size of the aggregates for MATCHBOXP NATURAL ! Ordering of aggregation NATURAL DEGREE -1.5 ! Coarsening ratio, if < 0 use library default