diff --git a/amgprec/amg_base_prec_type.F90 b/amgprec/amg_base_prec_type.F90 index faa2bf69..e1a9ed90 100644 --- a/amgprec/amg_base_prec_type.F90 +++ b/amgprec/amg_base_prec_type.F90 @@ -275,7 +275,8 @@ module amg_base_prec_type integer(psb_ipk_), parameter :: amg_sym_dec_aggr_ = 1 integer(psb_ipk_), parameter :: amg_ext_aggr_ = 2 integer(psb_ipk_), parameter :: amg_coupled_aggr_ = 3 - integer(psb_ipk_), parameter :: amg_max_par_aggr_alg_ = amg_coupled_aggr_ + integer(psb_ipk_), parameter :: amg_newmtc_aggr_ = 4 + integer(psb_ipk_), parameter :: amg_max_par_aggr_alg_ = amg_newmtc_aggr_ ! ! Legal values for entry: amg_aggr_type_ ! @@ -519,6 +520,8 @@ contains val = amg_soc1_ case('NEWMATCH') val = amg_newmatch_ + case('NEWMTC') + val = amg_newmtc_aggr_ case('MATCHBOXP','PARMATCH') val = amg_matchboxp_ case('COUPLED','COUP') diff --git a/amgprec/amg_d_decmatch_mod.f90 b/amgprec/amg_d_decmatch_mod.f90 index 39020925..680b86a9 100644 --- a/amgprec/amg_d_decmatch_mod.f90 +++ b/amgprec/amg_d_decmatch_mod.f90 @@ -40,7 +40,8 @@ module amg_d_decmatch_mod use psb_base_cbind_mod interface new_Match_If - function dnew_Match_If(nr, irp, ja, val, diag, w, mate) bind(c) result(res) + function dnew_Match_If(nr, irp, ja, val, diag, w, mate) & + & bind(c,name="dnew_Match_If") result(res) use iso_c_binding import :: psb_c_ipk_, psb_c_lpk_, psb_c_mpk_, psb_c_epk_ implicit none diff --git a/amgprec/amg_d_newmatch_aggregator_mod.F90 b/amgprec/amg_d_newmatch_aggregator_mod.F90 index e8b1833d..63704e1d 100644 --- a/amgprec/amg_d_newmatch_aggregator_mod.F90 +++ b/amgprec/amg_d_newmatch_aggregator_mod.F90 @@ -392,6 +392,10 @@ contains ag%max_nlevels=val case('NWM_W_SIZE') call ag%bld_default_w(val) + 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/Makefile b/amgprec/impl/aggregator/Makefile index fb0e38de..7b664c48 100644 --- a/amgprec/impl/aggregator/Makefile +++ b/amgprec/impl/aggregator/Makefile @@ -61,6 +61,7 @@ amg_s_parmatch_unsmth_bld.o \ amg_s_parmatch_smth_bld.o \ amg_s_parmatch_spmm_bld_inner.o \ amg_d_newmatch_aggregator_mat_asb.o \ +amg_d_newmatch_aggregator_inner_mat_asb.o \ amg_d_newmatch_aggregator_mat_bld.o \ amg_d_newmatch_aggregator_tprol.o \ amg_d_newmatch_map_to_tprol.o @@ -69,8 +70,10 @@ MPCOBJS= #MatchBoxPC.o \ #algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC.o MPCXXOBJS=MatchBoxPC.o \ -algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC.o - +algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC.o \ +newmatch_interface.o +CXXDEFINES=$(PSBCXXDEFINES) +CXXINCLUDES=-I../../../../ParallelRomaF-main/include -I$(PSBLAS_INCDIR) OBJS = $(FOBJS) $(MPCOBJS) $(MPCXXOBJS) LIBNAME=libamg_prec.a diff --git a/amgprec/impl/aggregator/amg_d_newmatch_aggregator_tprol.F90 b/amgprec/impl/aggregator/amg_d_newmatch_aggregator_tprol.F90 index c2154fa9..6a38b7b8 100644 --- a/amgprec/impl/aggregator/amg_d_newmatch_aggregator_tprol.F90 +++ b/amgprec/impl/aggregator/amg_d_newmatch_aggregator_tprol.F90 @@ -80,7 +80,7 @@ subroutine amg_d_newmatch_aggregator_build_tprol(ag,parms,ag_data,& call amg_check_def(parms%ml_cycle,'Multilevel cycle',& & amg_mult_ml_,is_legal_ml_cycle) call amg_check_def(parms%par_aggr_alg,'Aggregation',& - & amg_coupled_aggr_,is_legal_coupled_par_aggr_alg) + & amg_coupled_aggr_,is_legal_decoupled_par_aggr_alg) call amg_check_def(parms%aggr_ord,'Ordering',& & amg_aggr_ord_nat_,is_legal_ml_aggr_ord) call amg_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs) diff --git a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_inner_mat_asb.F90 b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_inner_mat_asb.F90 index 0b5574d7..aa74dd2c 100644 --- a/amgprec/impl/aggregator/amg_d_parmatch_aggregator_inner_mat_asb.F90 +++ b/amgprec/impl/aggregator/amg_d_parmatch_aggregator_inner_mat_asb.F90 @@ -99,7 +99,7 @@ subroutine amg_d_parmatch_aggregator_inner_mat_asb(ag,parms,a,desc_a,& use psb_base_mod use amg_base_prec_type #if defined(SERIAL_MPI) - use amg_d_parmatch_aggregator_mod + use amg_d_parmatch_aggregator_mod #else use amg_d_parmatch_aggregator_mod, amg_protect_name => amg_d_parmatch_aggregator_inner_mat_asb #endif diff --git a/amgprec/impl/aggregator/newmatch_interface.cpp b/amgprec/impl/aggregator/newmatch_interface.cpp index 7ec204b0..bd06bf87 100644 --- a/amgprec/impl/aggregator/newmatch_interface.cpp +++ b/amgprec/impl/aggregator/newmatch_interface.cpp @@ -9,7 +9,7 @@ extern "C" { psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[], psb_d_t val[], psb_d_t diag[], - psb_d_t w[], psb_i_t mate[]) + psb_d_t w[], psb_i_t mate[]); #ifdef __cplusplus } @@ -31,20 +31,21 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[], vector mateNode; NODE_T u,v; VAL_T weight; - psb_i_t preprocess = atoi(argv[2]); - psb_i_t romaInput = atoi(argv[3]); - VAL_T lambda = atof(argv[4]); + psb_i_t preprocess = 0; // 0 no greedy 1 greedy + psb_i_t romaInput = 1; // 1 sequential 2 parallel + VAL_T lambda = 0.8; // positive real value psb_d_t aii, ajj, aij, wii, wjj, tmp1, tmp2, minabs, edgnrm; - psb_i_t nt; + psb_i_t nt=1; // number of threads, got with 1 for testing purposes. psb_d_t timeDiff; MatchStat pstat; + double eps=1e-16; // fprintf(stderr,"Sanity check: %d %d \n",nr,nc); for (i=1; iu) { // Define Ahat entry aij = val[j-1]; @@ -56,7 +57,7 @@ psb_i_t dnew_Match_If(psb_i_t nr, psb_i_t irp[], psb_i_t ja[], if (edgnrm > eps) { weight = 1.0 - (2*1.0*aij*wii*wjj)/(aii*(wii*wii) + ajj*(wjj*wjj)); } else { - weight = 1e-16; + weight = eps; } // s.push_back(u); @@ -66,8 +67,6 @@ 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); - if (isz < nr) return(-1); - if (nz != nr) return(-2); /* loop here only makes sense when nr==nz */ for (i=0; i< nr; i++) { mate[i] = mateNode[i]+1; diff --git a/samples/advanced/pdegen/Makefile b/samples/advanced/pdegen/Makefile index 79c2d89e..4acd12f6 100644 --- a/samples/advanced/pdegen/Makefile +++ b/samples/advanced/pdegen/Makefile @@ -7,20 +7,21 @@ AMG_LIBS=-L$(AMGLIBDIR) -lpsb_krylov -lamg_prec -lpsb_prec FINCLUDES=$(FMFLAG). $(FMFLAG)$(AMGMODDIR) $(FMFLAG)$(AMGINCDIR) $(PSBLAS_INCLUDES) $(FIFLAG). LINKOPT= +XTRALINK= EXEDIR=./runs all: amg_s_pde3d amg_d_pde3d amg_s_pde2d amg_d_pde2d amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o - $(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) - /bin/mv amg_d_pde3d $(EXEDIR) + $(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(XTRALINK) + /bin/mv amg_d_pde3d $(EXEDIR) amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o $(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o -o amg_s_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) /bin/mv amg_s_pde3d $(EXEDIR) amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o - $(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) + $(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(XTRALINK) /bin/mv amg_d_pde2d $(EXEDIR) amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_box_mod.o data_input.o