Batch of fixes from initial test. Still more to go.

TestFerdous
Salvatore Filippone 3 years ago
parent 9609ea262f
commit fa2f8f53d5

@ -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')

@ -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

@ -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

@ -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

@ -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)

@ -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

@ -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<NODE_T> 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; i<nr; i++) {
for (j=irp[i-1]; j<irp[i]; j++) {
v = i-1; // I
u = ja[j-1]; // J
u = ja[j-1] - 1; // J
if (v>u) {
// 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;

@ -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

Loading…
Cancel
Save