From c3d57d91db5d8a70afd72c7df0cc69efebbc9f58 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 29 Feb 2016 17:12:34 +0000 Subject: [PATCH] mld2p4-2: tests/pdegen/Makefile tests/pdegen/ppde2d.f90 tests/pdegen/ppde3d.f90 tests/pdegen/runs/ppde.inp tests/pdegen/spde2d.f90 tests/pdegen/spde3d.f90 Fixed sample programs for new GS interface. --- tests/pdegen/Makefile | 8 +-- tests/pdegen/ppde2d.f90 | 122 +++++++++++++++++++------------------ tests/pdegen/ppde3d.f90 | 45 ++++++++------ tests/pdegen/runs/ppde.inp | 1 + tests/pdegen/spde2d.f90 | 84 +++++++++++++------------ tests/pdegen/spde3d.f90 | 84 +++++++++++++------------ 6 files changed, 184 insertions(+), 160 deletions(-) diff --git a/tests/pdegen/Makefile b/tests/pdegen/Makefile index c6c3a2a5..69d3d52e 100644 --- a/tests/pdegen/Makefile +++ b/tests/pdegen/Makefile @@ -11,7 +11,7 @@ FINCLUDES=$(FMFLAG). $(FMFLAG)$(MLDINCDIR) $(FMFLAG)$(PSBINCDIR) $(FIFLAG). EXEDIR=./runs -all: spde3d ppde3d spde2d ppde2d ppde3d_gs +all: spde3d ppde3d spde2d ppde2d ppde3d: ppde3d.o data_input.o $(F90LINK) ppde3d.o data_input.o -o ppde3d $(MLD_LIB) $(PSBLAS_LIB) $(LDLIBS) @@ -30,11 +30,7 @@ spde2d: spde2d.o data_input.o $(F90LINK) spde2d.o data_input.o -o spde2d $(MLD_LIB) $(PSBLAS_LIB) $(LDLIBS) /bin/mv spde2d $(EXEDIR) -ppde3d_gs: ppde3d_gs.o data_input.o - $(F90LINK) ppde3d_gs.o data_input.o -o ppde3d_gs $(MLD_LIB) $(PSBLAS_LIB) $(LDLIBS) - /bin/mv ppde3d_gs $(EXEDIR) - -ppde3d_gs.o ppde3d.o spde3d.o ppde2d.o spde2d.o: data_input.o +ppde3d.o spde3d.o ppde2d.o spde2d.o: data_input.o check: all cd runs && ./ppde2d = dzero) & - & call mld_precset(prec,mld_aggr_thresh_, prectype%athres, info) - call mld_precset(prec,mld_coarse_solve_, prectype%csolve, info) - call mld_precset(prec,mld_coarse_subsolve_, prectype%csbsolve,info) - call mld_precset(prec,mld_coarse_mat_, prectype%cmat, info) - call mld_precset(prec,mld_coarse_fillin_, prectype%cfill, info) - call mld_precset(prec,mld_coarse_iluthrs_, prectype%cthres, info) - call mld_precset(prec,mld_coarse_sweeps_, prectype%cjswp, info) - call mld_precset(prec,mld_coarse_aggr_size_, prectype%csize, info) + & call mld_precset(prec,'aggr_thresh', prectype%athres, info) + call mld_precset(prec,'coarse_solve', prectype%csolve, info) + call mld_precset(prec,'coarse_subsolve', prectype%csbsolve,info) + call mld_precset(prec,'coarse_mat', prectype%cmat, info) + call mld_precset(prec,'coarse_fillin', prectype%cfill, info) + call mld_precset(prec,'coarse_iluthrs', prectype%cthres, info) + call mld_precset(prec,'coarse_sweeps', prectype%cjswp, info) + call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) else nlv = 1 - call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,mld_smoother_sweeps_, prectype%jsweeps, info) - call mld_precset(prec,mld_sub_ovr_, prectype%novr, info) - call mld_precset(prec,mld_sub_restr_, prectype%restr, info) - call mld_precset(prec,mld_sub_prol_, prectype%prol, info) - call mld_precset(prec,mld_sub_solve_, prectype%solve, info) - call mld_precset(prec,mld_sub_fillin_, prectype%fill1, info) - call mld_precset(prec,mld_sub_iluthrs_, prectype%thr1, info) + call mld_precinit(prec,prectype%prec, info, nlev=nlv) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) end if - + call psb_barrier(ictxt) t1 = psb_wtime() call mld_precbld(a,desc_a,prec,info) @@ -364,30 +369,31 @@ contains call read_data(itrace,psb_inp_unit) call read_data(irst,psb_inp_unit) call read_data(eps,psb_inp_unit) - call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec - call read_data(prectype%prec,psb_inp_unit) ! overall prectype - call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers - call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as - call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as - call read_data(prectype%solve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. - call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 - call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) - call read_data(prectype%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC + call read_data(prectype%descr,psb_inp_unit) ! verbose description of the prec + call read_data(prectype%prec,psb_inp_unit) ! overall prectype + call read_data(prectype%novr,psb_inp_unit) ! number of overlap layers + call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as + call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as + call read_data(prectype%solve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps + call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 + call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) + call read_data(prectype%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC if (psb_toupper(prectype%prec) == 'ML') then - call read_data(prectype%smther,psb_inp_unit) ! Smoother type. - call read_data(prectype%nlev,psb_inp_unit) ! Number of levels in multilevel prec. - call read_data(prectype%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin - call read_data(prectype%aggr_alg,psb_inp_unit) ! local or global aggregation - call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec - call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing - call read_data(prectype%cmat,psb_inp_unit) ! coarse mat - call read_data(prectype%csolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. - call read_data(prectype%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. - call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 - call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) - call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps - call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh - call read_data(prectype%csize,psb_inp_unit) ! coarse size + call read_data(prectype%smther,psb_inp_unit) ! Smoother type. + call read_data(prectype%nlev,psb_inp_unit) ! Number of levels in multilevel prec. + call read_data(prectype%aggrkind,psb_inp_unit) ! smoothed/raw aggregatin + call read_data(prectype%aggr_alg,psb_inp_unit) ! local or global aggregation + call read_data(prectype%mltype,psb_inp_unit) ! additive or multiplicative 2nd level prec + call read_data(prectype%smthpos,psb_inp_unit) ! side: pre, post, both smoothing + call read_data(prectype%cmat,psb_inp_unit) ! coarse mat + call read_data(prectype%csolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%csbsolve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%cfill,psb_inp_unit) ! Fill-in for factorization 1 + call read_data(prectype%cthres,psb_inp_unit) ! Threshold for fact. 1 ILU(T) + call read_data(prectype%cjswp,psb_inp_unit) ! Jacobi sweeps + call read_data(prectype%athres,psb_inp_unit) ! smoother aggr thresh + call read_data(prectype%csize,psb_inp_unit) ! coarse size end if end if @@ -408,6 +414,7 @@ contains call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(ictxt,prectype%solve) ! Factorization type: ILU, SuperLU, UMFPACK. + call psb_bcast(ictxt,prectype%svsweeps) ! Sweeps for inner GS solver call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(ictxt,prectype%jsweeps) ! Jacobi sweeps @@ -463,4 +470,3 @@ contains end subroutine pr_usage end program ppde2d - diff --git a/tests/pdegen/ppde3d.f90 b/tests/pdegen/ppde3d.f90 index 5168c2e7..e130a538 100644 --- a/tests/pdegen/ppde3d.f90 +++ b/tests/pdegen/ppde3d.f90 @@ -72,19 +72,19 @@ contains use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: b1 real(psb_dpk_), intent(in) :: x,y,z - b1=1.d0/sqrt(3.d0) + b1=0.d0/sqrt(3.d0) end function b1 function b2(x,y,z) use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: b2 real(psb_dpk_), intent(in) :: x,y,z - b2=1.d0/sqrt(3.d0) + b2=0.d0/sqrt(3.d0) end function b2 function b3(x,y,z) use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: b3 real(psb_dpk_), intent(in) :: x,y,z - b3=1.d0/sqrt(3.d0) + b3=0.d0/sqrt(3.d0) end function b3 function c(x,y,z) use psb_base_mod, only : psb_dpk_ @@ -96,19 +96,19 @@ contains use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: a1 real(psb_dpk_), intent(in) :: x,y,z - a1=1.d0/80 + a1=1.d0!/80 end function a1 function a2(x,y,z) use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: a2 real(psb_dpk_), intent(in) :: x,y,z - a2=1.d0/80 + a2=1.d0!/80 end function a2 function a3(x,y,z) use psb_base_mod, only : psb_dpk_ real(psb_dpk_) :: a3 real(psb_dpk_), intent(in) :: x,y,z - a3=1.d0/80 + a3=1.d0!/80 end function a3 function g(x,y,z) use psb_base_mod, only : psb_dpk_, done, dzero @@ -146,13 +146,13 @@ program ppde3d type(mld_dprec_type) :: prec ! descriptor type(psb_desc_type) :: desc_a - ! dense matrices + ! dense vectors type(psb_d_vect_type) :: x,b - ! blacs parameters - integer(psb_ipk_) :: ictxt, iam, np + ! parallel environment + integer(psb_ipk_) :: ictxt, iam, np ! solver parameters - integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv + integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_long_int_k_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, eps @@ -165,6 +165,7 @@ program ppde3d character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 + integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_dpk_) :: thr1 ! Threshold for fact. 1 ILU(T) character(len=16) :: smther ! Smoother integer(psb_ipk_) :: nlev ! Number of levels in multilevel prec. @@ -184,7 +185,7 @@ program ppde3d type(precdata) :: prectype type(psb_d_coo_sparse_mat) :: acoo ! other variables - integer(psb_ipk_) :: info + integer(psb_ipk_) :: info, i character(len=20) :: name,ch_err info=psb_success_ @@ -249,6 +250,7 @@ program ppde3d call mld_precset(prec,'sub_prol', prectype%prol, info) call mld_precset(prec,'sub_solve', prectype%solve, info) call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) call mld_precset(prec,'aggr_kind', prectype%aggrkind,info) call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info) @@ -265,15 +267,17 @@ program ppde3d call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) else nlv = 1 - call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) - call mld_precset(prec,'sub_ovr', prectype%novr, info) - call mld_precset(prec,'sub_restr', prectype%restr, info) - call mld_precset(prec,'sub_prol', prectype%prol, info) - call mld_precset(prec,'sub_solve', prectype%solve, info) - call mld_precset(prec,'sub_fillin', prectype%fill1, info) - call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) + call mld_precinit(prec,prectype%prec, info, nlev=nlv) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) end if + call psb_barrier(ictxt) t1 = psb_wtime() call mld_precbld(a,desc_a,prec,info) @@ -384,6 +388,7 @@ contains call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as call read_data(prectype%solve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prectype%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC @@ -422,6 +427,7 @@ contains call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(ictxt,prectype%solve) ! Factorization type: ILU, SuperLU, UMFPACK. + call psb_bcast(ictxt,prectype%svsweeps) ! Sweeps for inner GS solver call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(ictxt,prectype%jsweeps) ! Jacobi sweeps @@ -475,5 +481,6 @@ contains write(iout,*)' >= 1 do tracing every itrace' write(iout,*)' iterations ' end subroutine pr_usage + end program ppde3d diff --git a/tests/pdegen/runs/ppde.inp b/tests/pdegen/runs/ppde.inp index 8b376268..b5ed33a2 100644 --- a/tests/pdegen/runs/ppde.inp +++ b/tests/pdegen/runs/ppde.inp @@ -12,6 +12,7 @@ ML ! Preconditioner NONE JACOBI BJAC AS ML HALO ! Restriction operator NONE HALO NONE ! Prolongation operator NONE SUM AVG ILU ! Subdomain solver DSCALE ILU MILU ILUT UMF SLU +1 ! sweeps for GS 0 ! Level-set N for ILU(N), and P for ILUT 1.d-4 ! Threshold T for ILU(T,P) 1 ! Smoother/Jacobi sweeps diff --git a/tests/pdegen/spde2d.f90 b/tests/pdegen/spde2d.f90 index 180be402..b6decae2 100644 --- a/tests/pdegen/spde2d.f90 +++ b/tests/pdegen/spde2d.f90 @@ -72,13 +72,13 @@ contains use psb_base_mod, only : psb_spk_ real(psb_spk_) :: b1 real(psb_spk_), intent(in) :: x,y - b1=1.e0/sqrt(2.e0) + b1=0.e0/sqrt(2.e0) end function b1 function b2(x,y) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: b2 real(psb_spk_), intent(in) :: x,y - b2=1.e0/sqrt(2.e0) + b2=0.e0/sqrt(2.e0) end function b2 function c(x,y) use psb_base_mod, only : psb_spk_ @@ -90,13 +90,13 @@ contains use psb_base_mod, only : psb_spk_ real(psb_spk_) :: a1 real(psb_spk_), intent(in) :: x,y - a1=1.e0/80 + a1=1.e0!/80 end function a1 function a2(x,y) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: a2 real(psb_spk_), intent(in) :: x,y - a2=1.e0/80 + a2=1.e0!/80 end function a2 function g(x,y) use psb_base_mod, only : psb_spk_, sone, szero @@ -134,10 +134,10 @@ program spde2d type(mld_sprec_type) :: prec ! descriptor type(psb_desc_type) :: desc_a - ! dense matrices + ! dense vectors type(psb_s_vect_type) :: x,b - ! blacs parameters - integer(psb_ipk_) :: ictxt, iam, np + ! parallel environment + integer(psb_ipk_) :: ictxt, iam, np ! solver parameters integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv @@ -153,6 +153,7 @@ program spde2d character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 + integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_spk_) :: thr1 ! Threshold for fact. 1 ILU(T) character(len=16) :: smther ! Smoother integer(psb_ipk_) :: nlev ! Number of levels in multilevel prec. @@ -172,7 +173,7 @@ program spde2d type(precdata) :: prectype type(psb_s_coo_sparse_mat) :: acoo ! other variables - integer(psb_ipk_) :: info + integer(psb_ipk_) :: info, i character(len=20) :: name,ch_err info=psb_success_ @@ -196,6 +197,7 @@ program spde2d write(*,*) 'Welcome to MLD2P4 version: ',mld_version_string_ write(*,*) 'This is the ',trim(name),' sample program' end if + ! ! get parameters ! @@ -206,7 +208,8 @@ program spde2d ! call psb_barrier(ictxt) t1 = psb_wtime() - call psb_gen_pde2d(ictxt,idim,a,b,x,desc_a,afmt,a1,a2,b1,b2,c,g,info) + call psb_gen_pde2d(ictxt,idim,a,b,x,desc_a,afmt,& + & a1,a2,b1,b2,c,g,info) call psb_barrier(ictxt) t2 = psb_wtime() - t1 if(info /= psb_success_) then @@ -227,38 +230,41 @@ program spde2d if (psb_toupper(prectype%prec) == 'ML') then nlv = prectype%nlev call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,mld_smoother_type_, prectype%smther, info) - call mld_precset(prec,mld_smoother_sweeps_, prectype%jsweeps, info) - call mld_precset(prec,mld_sub_ovr_, prectype%novr, info) - call mld_precset(prec,mld_sub_restr_, prectype%restr, info) - call mld_precset(prec,mld_sub_prol_, prectype%prol, info) - call mld_precset(prec,mld_sub_solve_, prectype%solve, info) - call mld_precset(prec,mld_sub_fillin_, prectype%fill1, info) - call mld_precset(prec,mld_sub_iluthrs_, prectype%thr1, info) - call mld_precset(prec,mld_aggr_kind_, prectype%aggrkind,info) - call mld_precset(prec,mld_aggr_alg_, prectype%aggr_alg,info) - call mld_precset(prec,mld_ml_type_, prectype%mltype, info) - call mld_precset(prec,mld_smoother_pos_, prectype%smthpos, info) - if (prectype%athres >= szero) & - & call mld_precset(prec,mld_aggr_thresh_, prectype%athres, info) - call mld_precset(prec,mld_coarse_solve_, prectype%csolve, info) - call mld_precset(prec,mld_coarse_subsolve_, prectype%csbsolve,info) - call mld_precset(prec,mld_coarse_mat_, prectype%cmat, info) - call mld_precset(prec,mld_coarse_fillin_, prectype%cfill, info) - call mld_precset(prec,mld_coarse_iluthrs_, prectype%cthres, info) - call mld_precset(prec,mld_coarse_sweeps_, prectype%cjswp, info) - call mld_precset(prec,mld_coarse_aggr_size_, prectype%csize, info) + call mld_precset(prec,'smoother_type', prectype%smther, info) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) + call mld_precset(prec,'aggr_kind', prectype%aggrkind,info) + call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info) + call mld_precset(prec,'ml_type', prectype%mltype, info) + call mld_precset(prec,'smoother_pos', prectype%smthpos, info) + if (prectype%athres >= dzero) & + & call mld_precset(prec,'aggr_thresh', prectype%athres, info) + call mld_precset(prec,'coarse_solve', prectype%csolve, info) + call mld_precset(prec,'coarse_subsolve', prectype%csbsolve,info) + call mld_precset(prec,'coarse_mat', prectype%cmat, info) + call mld_precset(prec,'coarse_fillin', prectype%cfill, info) + call mld_precset(prec,'coarse_iluthrs', prectype%cthres, info) + call mld_precset(prec,'coarse_sweeps', prectype%cjswp, info) + call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) else nlv = 1 - call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,mld_smoother_sweeps_, prectype%jsweeps, info) - call mld_precset(prec,mld_sub_ovr_, prectype%novr, info) - call mld_precset(prec,mld_sub_restr_, prectype%restr, info) - call mld_precset(prec,mld_sub_prol_, prectype%prol, info) - call mld_precset(prec,mld_sub_solve_, prectype%solve, info) - call mld_precset(prec,mld_sub_fillin_, prectype%fill1, info) - call mld_precset(prec,mld_sub_iluthrs_, prectype%thr1, info) + call mld_precinit(prec,prectype%prec, info, nlev=nlv) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) end if + call psb_barrier(ictxt) t1 = psb_wtime() call mld_precbld(a,desc_a,prec,info) @@ -369,6 +375,7 @@ contains call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as call read_data(prectype%solve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prectype%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC @@ -407,6 +414,7 @@ contains call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(ictxt,prectype%solve) ! Factorization type: ILU, SuperLU, UMFPACK. + call psb_bcast(ictxt,prectype%svsweeps) ! Sweeps for inner GS solver call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(ictxt,prectype%jsweeps) ! Jacobi sweeps diff --git a/tests/pdegen/spde3d.f90 b/tests/pdegen/spde3d.f90 index 49b7e623..ce397f94 100644 --- a/tests/pdegen/spde3d.f90 +++ b/tests/pdegen/spde3d.f90 @@ -72,19 +72,19 @@ contains use psb_base_mod, only : psb_spk_ real(psb_spk_) :: b1 real(psb_spk_), intent(in) :: x,y,z - b1=1.e0/sqrt(3.e0) + b1=0.e0/sqrt(3.e0) end function b1 function b2(x,y,z) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: b2 real(psb_spk_), intent(in) :: x,y,z - b2=1.e0/sqrt(3.e0) + b2=0.e0/sqrt(3.e0) end function b2 function b3(x,y,z) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: b3 real(psb_spk_), intent(in) :: x,y,z - b3=1.e0/sqrt(3.e0) + b3=0.e0/sqrt(3.e0) end function b3 function c(x,y,z) use psb_base_mod, only : psb_spk_ @@ -96,19 +96,19 @@ contains use psb_base_mod, only : psb_spk_ real(psb_spk_) :: a1 real(psb_spk_), intent(in) :: x,y,z - a1=1.e0/80 + a1=1.e0!/80 end function a1 function a2(x,y,z) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: a2 real(psb_spk_), intent(in) :: x,y,z - a2=1.e0/80 + a2=1.e0!/80 end function a2 function a3(x,y,z) use psb_base_mod, only : psb_spk_ real(psb_spk_) :: a3 real(psb_spk_), intent(in) :: x,y,z - a3=1.e0/80 + a3=1.e0!/80 end function a3 function g(x,y,z) use psb_base_mod, only : psb_spk_, sone, szero @@ -146,10 +146,10 @@ program spde3d type(mld_sprec_type) :: prec ! descriptor type(psb_desc_type) :: desc_a - ! dense matrices + ! dense vectors type(psb_s_vect_type) :: x,b - ! blacs parameters - integer(psb_ipk_) :: ictxt, iam, np + ! parallel environment + integer(psb_ipk_) :: ictxt, iam, np ! solver parameters integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv @@ -165,6 +165,7 @@ program spde3d character(len=16) :: prol ! prolongation over application of as character(len=16) :: solve ! Solver type: ILU, SuperLU, UMFPACK. integer(psb_ipk_) :: fill1 ! Fill-in for factorization 1 + integer(psb_ipk_) :: svsweeps ! Solver sweeps for GS real(psb_spk_) :: thr1 ! Threshold for fact. 1 ILU(T) character(len=16) :: smther ! Smoother integer(psb_ipk_) :: nlev ! Number of levels in multilevel prec. @@ -184,7 +185,7 @@ program spde3d type(precdata) :: prectype type(psb_s_coo_sparse_mat) :: acoo ! other variables - integer(psb_ipk_) :: info + integer(psb_ipk_) :: info, i character(len=20) :: name,ch_err info=psb_success_ @@ -242,38 +243,41 @@ program spde3d if (psb_toupper(prectype%prec) == 'ML') then nlv = prectype%nlev call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,mld_smoother_type_, prectype%smther, info) - call mld_precset(prec,mld_smoother_sweeps_, prectype%jsweeps, info) - call mld_precset(prec,mld_sub_ovr_, prectype%novr, info) - call mld_precset(prec,mld_sub_restr_, prectype%restr, info) - call mld_precset(prec,mld_sub_prol_, prectype%prol, info) - call mld_precset(prec,mld_sub_solve_, prectype%solve, info) - call mld_precset(prec,mld_sub_fillin_, prectype%fill1, info) - call mld_precset(prec,mld_sub_iluthrs_, prectype%thr1, info) - call mld_precset(prec,mld_aggr_kind_, prectype%aggrkind,info) - call mld_precset(prec,mld_aggr_alg_, prectype%aggr_alg,info) - call mld_precset(prec,mld_ml_type_, prectype%mltype, info) - call mld_precset(prec,mld_smoother_pos_, prectype%smthpos, info) - if (prectype%athres >= szero) & - & call mld_precset(prec,mld_aggr_thresh_, prectype%athres, info) - call mld_precset(prec,mld_coarse_solve_, prectype%csolve, info) - call mld_precset(prec,mld_coarse_subsolve_, prectype%csbsolve,info) - call mld_precset(prec,mld_coarse_mat_, prectype%cmat, info) - call mld_precset(prec,mld_coarse_fillin_, prectype%cfill, info) - call mld_precset(prec,mld_coarse_iluthrs_, prectype%cthres, info) - call mld_precset(prec,mld_coarse_sweeps_, prectype%cjswp, info) - call mld_precset(prec,mld_coarse_aggr_size_, prectype%csize, info) + call mld_precset(prec,'smoother_type', prectype%smther, info) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) + call mld_precset(prec,'aggr_kind', prectype%aggrkind,info) + call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info) + call mld_precset(prec,'ml_type', prectype%mltype, info) + call mld_precset(prec,'smoother_pos', prectype%smthpos, info) + if (prectype%athres >= dzero) & + & call mld_precset(prec,'aggr_thresh', prectype%athres, info) + call mld_precset(prec,'coarse_solve', prectype%csolve, info) + call mld_precset(prec,'coarse_subsolve', prectype%csbsolve,info) + call mld_precset(prec,'coarse_mat', prectype%cmat, info) + call mld_precset(prec,'coarse_fillin', prectype%cfill, info) + call mld_precset(prec,'coarse_iluthrs', prectype%cthres, info) + call mld_precset(prec,'coarse_sweeps', prectype%cjswp, info) + call mld_precset(prec,'coarse_aggr_size', prectype%csize, info) else nlv = 1 - call mld_precinit(prec,prectype%prec, info, nlev=nlv) - call mld_precset(prec,mld_smoother_sweeps_, prectype%jsweeps, info) - call mld_precset(prec,mld_sub_ovr_, prectype%novr, info) - call mld_precset(prec,mld_sub_restr_, prectype%restr, info) - call mld_precset(prec,mld_sub_prol_, prectype%prol, info) - call mld_precset(prec,mld_sub_solve_, prectype%solve, info) - call mld_precset(prec,mld_sub_fillin_, prectype%fill1, info) - call mld_precset(prec,mld_sub_iluthrs_, prectype%thr1, info) + call mld_precinit(prec,prectype%prec, info, nlev=nlv) + call mld_precset(prec,'smoother_sweeps', prectype%jsweeps, info) + call mld_precset(prec,'sub_ovr', prectype%novr, info) + call mld_precset(prec,'sub_restr', prectype%restr, info) + call mld_precset(prec,'sub_prol', prectype%prol, info) + call mld_precset(prec,'sub_solve', prectype%solve, info) + call mld_precset(prec,'sub_fillin', prectype%fill1, info) + call mld_precset(prec,'solver_sweeps', prectype%svsweeps, info) + call mld_precset(prec,'sub_iluthrs', prectype%thr1, info) end if + call psb_barrier(ictxt) t1 = psb_wtime() call mld_precbld(a,desc_a,prec,info) @@ -384,6 +388,7 @@ contains call read_data(prectype%restr,psb_inp_unit) ! restriction over application of as call read_data(prectype%prol,psb_inp_unit) ! prolongation over application of as call read_data(prectype%solve,psb_inp_unit) ! Factorization type: ILU, SuperLU, UMFPACK. + call read_data(prectype%svsweeps,psb_inp_unit) ! Solver sweeps call read_data(prectype%fill1,psb_inp_unit) ! Fill-in for factorization 1 call read_data(prectype%thr1,psb_inp_unit) ! Threshold for fact. 1 ILU(T) call read_data(prectype%jsweeps,psb_inp_unit) ! Jacobi sweeps for PJAC @@ -422,6 +427,7 @@ contains call psb_bcast(ictxt,prectype%restr) ! restriction over application of as call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as call psb_bcast(ictxt,prectype%solve) ! Factorization type: ILU, SuperLU, UMFPACK. + call psb_bcast(ictxt,prectype%svsweeps) ! Sweeps for inner GS solver call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1 call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T) call psb_bcast(ictxt,prectype%jsweeps) ! Jacobi sweeps