Compare commits

...
6 Commits
41 changed files with 831 additions and 352 deletions
+2 -2
View File
@@ -3,9 +3,9 @@ include Make.inc
all: objs lib
objs: amgp cbnd
objs: libdir amgp cbnd
lib: libdir objs
lib: objs
cd amgprec && $(MAKE) lib
cd cbind && $(MAKE) lib
+4 -1
View File
@@ -403,7 +403,10 @@ contains
info = psb_success_
call sv%a%free()
call sv%dv%free(info)
if (allocated(sv%dv)) then
call sv%dv%free(info)
deallocate(sv%dv)
end if
if (allocated(sv%d)) deallocate(sv%d)
call psb_erractionrestore(err_act)
+4 -1
View File
@@ -403,7 +403,10 @@ contains
info = psb_success_
call sv%a%free()
call sv%dv%free(info)
if (allocated(sv%dv)) then
call sv%dv%free(info)
deallocate(sv%dv)
end if
if (allocated(sv%d)) deallocate(sv%d)
call psb_erractionrestore(err_act)
+4 -1
View File
@@ -403,7 +403,10 @@ contains
info = psb_success_
call sv%a%free()
call sv%dv%free(info)
if (allocated(sv%dv)) then
call sv%dv%free(info)
deallocate(sv%dv)
end if
if (allocated(sv%d)) deallocate(sv%d)
call psb_erractionrestore(err_act)
+4 -1
View File
@@ -403,7 +403,10 @@ contains
info = psb_success_
call sv%a%free()
call sv%dv%free(info)
if (allocated(sv%dv)) then
call sv%dv%free(info)
deallocate(sv%dv)
end if
if (allocated(sv%d)) deallocate(sv%d)
call psb_erractionrestore(err_act)
+1 -1
View File
@@ -42,7 +42,6 @@
#include <stdlib.h>
#if !defined(SERIAL_MPI)
#include <mpi.h>
#endif
#include "MatchBoxPC.h"
#ifdef __cplusplus
@@ -127,3 +126,4 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
#ifdef __cplusplus
}
#endif
#endif
+3
View File
@@ -78,6 +78,8 @@ const int BundleTag = 9; // Predefined tag
static vector<MilanLongInt> DEFAULT_VECTOR;
#if !defined(SERIAL_MPI)
// MPI type map
template <typename T>
MPI_Datatype TypeMap();
@@ -89,6 +91,7 @@ template <>
inline MPI_Datatype TypeMap<double>() { return MPI_DOUBLE; }
template <>
inline MPI_Datatype TypeMap<float>() { return MPI_FLOAT; }
#endif
#ifdef __cplusplus
extern "C"
+2
View File
@@ -1,6 +1,7 @@
#include "MatchBoxPC.h"
// TODO comment
#if !defined(SERIAL_MPI)
void clean(MilanLongInt NLVer,
MilanInt myRank,
@@ -89,3 +90,4 @@ void clean(MilanLongInt NLVer,
}
}
}
#endif
@@ -9,6 +9,8 @@
* @param edgeLocWeight
* @return
*/
#if !defined(SERIAL_MPI)
MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2,
MilanLongInt *verLocInd,
@@ -71,3 +73,4 @@ MilanLongInt computeCandidateMate(MilanLongInt adj1,
return w;
}
#endif
@@ -1,4 +1,5 @@
#include "MatchBoxPC.h"
#if !defined(SERIAL_MPI)
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
MilanLongInt *verLocPtr,
@@ -25,3 +26,4 @@ void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
}
}
}
#endif
@@ -1,4 +1,5 @@
#include "MatchBoxPC.h"
#if !defined(SERIAL_MPI)
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
MilanLongInt *candidateMate,
@@ -193,3 +194,4 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
} // End of parallel region
}
#endif
@@ -1,5 +1,6 @@
#include "MatchBoxPC.h"
#if !defined(SERIAL_MPI)
void processMatchedVertices(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
@@ -292,3 +293,4 @@ void processMatchedVertices(
#endif
} // End of parallel region
}
#endif
@@ -1,5 +1,6 @@
#include "MatchBoxPC.h"
//#define DEBUG_HANG_
#if !defined(SERIAL_MPI)
void processMatchedVerticesAndSendMessages(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
@@ -306,3 +307,4 @@ void processMatchedVerticesAndSendMessages(
cout << myRank<<" Done sending messages"<<endl;
#endif
}
#endif
@@ -1,5 +1,6 @@
#include "MatchBoxPC.h"
//#define DEBUG_HANG_
#if !defined(SERIAL_MPI)
void processMessages(
MilanLongInt NLVer,
@@ -313,3 +314,4 @@ void processMessages(
return;
}
#endif
@@ -1,5 +1,5 @@
#include "MatchBoxPC.h"
#if !defined(SERIAL_MPI)
void sendBundledMessages(MilanLongInt *numGhostEdges,
MilanInt *BufferSize,
MilanLongInt *Buffer,
@@ -207,3 +207,4 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
}
}
}
#endif
+13 -1
View File
@@ -42,6 +42,8 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
use amg_c_base_aggregator_mod
use amg_c_dec_aggregator_mod
use amg_c_symdec_aggregator_mod
#if !defined(SERIAL_MPI)
#endif
use amg_c_jac_smoother
use amg_c_as_smoother
use amg_c_diag_solver
@@ -246,6 +248,8 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
if (info == 0) deallocate(lv%aggr,stat=info)
if (info /= 0) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='aggregator deallocation?')
goto 9999
return
end if
end if
@@ -255,8 +259,16 @@ 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)
case default
#if !defined(SERIAL_MPI)
#endif
case default
info = psb_err_internal_error_
#if !defined(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 (SERIAL_MPI on)')
#endif
goto 9999
end select
if (info == psb_success_) call lv%aggr%default()
+13 -1
View File
@@ -42,7 +42,9 @@ 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(SERIAL_MPI)
use amg_d_parmatch_aggregator_mod
#endif
use amg_d_jac_smoother
use amg_d_as_smoother
use amg_d_diag_solver
@@ -267,6 +269,8 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
if (info == 0) deallocate(lv%aggr,stat=info)
if (info /= 0) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='aggregator deallocation?')
goto 9999
return
end if
end if
@@ -276,10 +280,18 @@ 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(SERIAL_MPI)
case('COUP','COUPLED')
allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info)
case default
#endif
case default
info = psb_err_internal_error_
#if !defined(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 (SERIAL_MPI on)')
#endif
goto 9999
end select
if (info == psb_success_) call lv%aggr%default()
+13 -1
View File
@@ -42,7 +42,9 @@ 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(SERIAL_MPI)
use amg_s_parmatch_aggregator_mod
#endif
use amg_s_jac_smoother
use amg_s_as_smoother
use amg_s_diag_solver
@@ -247,6 +249,8 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
if (info == 0) deallocate(lv%aggr,stat=info)
if (info /= 0) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='aggregator deallocation?')
goto 9999
return
end if
end if
@@ -256,10 +260,18 @@ 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(SERIAL_MPI)
case('COUP','COUPLED')
allocate(amg_s_parmatch_aggregator_type :: lv%aggr, stat=info)
case default
#endif
case default
info = psb_err_internal_error_
#if !defined(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 (SERIAL_MPI on)')
#endif
goto 9999
end select
if (info == psb_success_) call lv%aggr%default()
+13 -1
View File
@@ -42,6 +42,8 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
use amg_z_base_aggregator_mod
use amg_z_dec_aggregator_mod
use amg_z_symdec_aggregator_mod
#if !defined(SERIAL_MPI)
#endif
use amg_z_jac_smoother
use amg_z_as_smoother
use amg_z_diag_solver
@@ -266,6 +268,8 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
if (info == 0) deallocate(lv%aggr,stat=info)
if (info /= 0) then
info = psb_err_internal_error_
call psb_errpush(info,name,a_err='aggregator deallocation?')
goto 9999
return
end if
end if
@@ -275,8 +279,16 @@ 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)
case default
#if !defined(SERIAL_MPI)
#endif
case default
info = psb_err_internal_error_
#if !defined(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 (SERIAL_MPI on)')
#endif
goto 9999
end select
if (info == psb_success_) call lv%aggr%default()
+16 -12
View File
@@ -8,23 +8,27 @@ FINCLUDES=$(FMFLAG). $(FMFLAG)$(AMGMODDIR) $(FMFLAG)$(AMGINCDIR) $(PSBLAS_INCLUD
LINKOPT=
EXEDIR=./runs
DGEN2D=amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_gauss_mod.o amg_d_pde2d_box_mod.o
DGEN3D=amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o amg_d_pde3d_box_mod.o
SGEN2D=amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_gauss_mod.o amg_s_pde2d_box_mod.o
SGEN3D=amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o amg_s_pde3d_box_mod.o
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)
amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
/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)
amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) data_input.o
$(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) 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)
amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
/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
$(FLINK) $(LINKOPT) 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 -o amg_s_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o
$(FLINK) $(LINKOPT) amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o -o amg_s_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
/bin/mv amg_s_pde2d $(EXEDIR)
amg_d_pde3d_rebld: amg_d_pde3d_rebld.o data_input.o
@@ -33,10 +37,10 @@ amg_d_pde3d_rebld: amg_d_pde3d_rebld.o data_input.o
amg_d_pde3d.o amg_s_pde3d.o amg_d_pde2d.o amg_s_pde2d.o: data_input.o
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
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
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
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
amg_d_pde3d.o: amg_d_genpde_mod.o $(DGEN3D)
amg_s_pde3d.o: amg_s_genpde_mod.o $(SGEN3D)
amg_d_pde2d.o: amg_d_genpde_mod.o $(DGEN2D)
amg_s_pde2d.o: amg_s_genpde_mod.o $(SGEN2D)
check: all
cd runs && ./amg_d_pde2d <amg_pde2d.inp && ./amg_s_pde2d<amg_pde2d.inp
+24 -20
View File
@@ -72,6 +72,7 @@ program amg_d_pde2d
use amg_d_pde2d_base_mod
use amg_d_pde2d_exp_mod
use amg_d_pde2d_box_mod
use amg_d_pde2d_gauss_mod
use amg_d_genpde_mod
#if defined(OPENMP)
use omp_lib
@@ -124,16 +125,16 @@ program amg_d_pde2d
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
! AMG cycles for ML
! general AMG data
character(len=16) :: mlcycle ! AMG cycle type
character(len=32) :: mlcycle ! AMG cycle type
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
@@ -141,39 +142,39 @@ program amg_d_pde2d
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr ! restriction over application of AS
character(len=32) :: prol ! prolongation over application of AS
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
character(len=16) :: variant ! AINV variant: LLK, etc
character(len=32) :: variant ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
real(psb_dpk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr2 ! restriction over application of AS
character(len=32) :: prol2 ! prolongation over application of AS
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
character(len=16) :: variant2 ! AINV variant: LLK, etc
character(len=32) :: variant2 ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
@@ -241,13 +242,16 @@ program amg_d_pde2d
select case(psb_toupper(trim(pdecoeff)))
case("CONST")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1,a2,b1,b2,c,g,info)
& a1_base,a2_base,b1_base,b2_base,c_base,g_base,info)
case("EXP")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_exp,a2_exp,b1_exp,b2_exp,c_exp,g_exp,info)
case("BOX")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_box,a2_box,b1_box,b2_box,c_box,g_box,info)
case("GAUSS")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_gauss,a2_gauss,b1_gauss,b2_gauss,c_gauss,g_gauss,info)
case default
info=psb_err_from_subroutine_
ch_err='amg_gen_pdecoeff'
@@ -38,52 +38,52 @@ module amg_d_pde2d_base_mod
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_base(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_base
!
! functions parametrizing the differential equation
!
function b1(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: b1
function b1_base(x,y)
implicit none
real(psb_dpk_) :: b1_base
real(psb_dpk_), intent(in) :: x,y
b1 = dzero/1.414_psb_dpk_
end function b1
function b2(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: b2
b1_base = dzero/1.414_psb_dpk_
end function b1_base
function b2_base(x,y)
implicit none
real(psb_dpk_) :: b2_base
real(psb_dpk_), intent(in) :: x,y
b2 = dzero/1.414_psb_dpk_
end function b2
function c(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: c
b2_base = dzero/1.414_psb_dpk_
end function b2_base
function c_base(x,y)
implicit none
real(psb_dpk_) :: c_base
real(psb_dpk_), intent(in) :: x,y
c = dzero
end function c
function a1(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: a1
c_base = dzero
end function c_base
function a1_base(x,y)
implicit none
real(psb_dpk_) :: a1_base
real(psb_dpk_), intent(in) :: x,y
a1=done*epsilon
end function a1
function a2(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: a2
a1_base=done*epsilon
end function a1_base
function a2_base(x,y)
implicit none
real(psb_dpk_) :: a2_base
real(psb_dpk_), intent(in) :: x,y
a2=done*epsilon
end function a2
function g(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: g
a2_base=done*epsilon
end function a2_base
function g_base(x,y)
implicit none
real(psb_dpk_) :: g_base
real(psb_dpk_), intent(in) :: x,y
g = dzero
g_base = dzero
if (x == done) then
g = done
g_base = done
else if (x == dzero) then
g = done
g_base = done
end if
end function g
end function g_base
end module amg_d_pde2d_base_mod
@@ -38,45 +38,45 @@ module amg_d_pde2d_box_mod
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_box(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_box
!
! functions parametrizing the differential equation
!
function b1_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: b1_box
real(psb_dpk_), intent(in) :: x,y
b1_box = done/1.414_psb_dpk_
end function b1_box
function b2_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: b2_box
real(psb_dpk_), intent(in) :: x,y
b2_box = done/1.414_psb_dpk_
end function b2_box
function c_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: c_box
real(psb_dpk_), intent(in) :: x,y
c_box = dzero
end function c_box
function a1_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: a1_box
real(psb_dpk_), intent(in) :: x,y
a1_box=done*epsilon
end function a1_box
function a2_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: a2_box
real(psb_dpk_), intent(in) :: x,y
a2_box=done*epsilon
end function a2_box
function g_box(x,y)
use psb_base_mod, only : psb_dpk_, dzero, done
implicit none
real(psb_dpk_) :: g_box
real(psb_dpk_), intent(in) :: x,y
g_box = dzero
+10 -10
View File
@@ -38,45 +38,45 @@ module amg_d_pde2d_exp_mod
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_exp(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_exp
!
! functions parametrizing the differential equation
!
function b1_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: b1_exp
real(psb_dpk_), intent(in) :: x,y
b1_exp = dzero
end function b1_exp
function b2_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: b2_exp
real(psb_dpk_), intent(in) :: x,y
b2_exp = dzero
end function b2_exp
function c_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: c_exp
real(psb_dpk_), intent(in) :: x,y
c_exp = dzero
end function c_exp
function a1_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: a1_exp
real(psb_dpk_), intent(in) :: x,y
a1=done*epsilon*exp(-(x+y))
a1_exp=done*epsilon*exp(-(x+y))
end function a1_exp
function a2_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: a2_exp
real(psb_dpk_), intent(in) :: x,y
a2=done*epsilon*exp(-(x+y))
a2_exp=done*epsilon*exp(-(x+y))
end function a2_exp
function g_exp(x,y)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: g_exp
real(psb_dpk_), intent(in) :: x,y
g_exp = dzero
@@ -0,0 +1,89 @@
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_d_pde2d_gauss_mod
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm2d_gauss(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm2d_gauss
!
! functions parametrizing the differential equation
!
function b1_gauss(x,y)
implicit none
real(psb_dpk_) :: b1_gauss
real(psb_dpk_), intent(in) :: x,y
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2))
end function b1_gauss
function b2_gauss(x,y)
implicit none
real(psb_dpk_) :: b2_gauss
real(psb_dpk_), intent(in) :: x,y
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2))
end function b2_gauss
function c_gauss(x,y)
implicit none
real(psb_dpk_) :: c_gauss
real(psb_dpk_), intent(in) :: x,y
c_gauss=dzero
end function c_gauss
function a1_gauss(x,y)
implicit none
real(psb_dpk_) :: a1_gauss
real(psb_dpk_), intent(in) :: x,y
a1_gauss=epsilon*exp(-(x**2+y**2))
end function a1_gauss
function a2_gauss(x,y)
implicit none
real(psb_dpk_) :: a2_gauss
real(psb_dpk_), intent(in) :: x,y
a2_gauss=epsilon*exp(-(x**2+y**2))
end function a2_gauss
function g_gauss(x,y)
implicit none
real(psb_dpk_) :: g_gauss
real(psb_dpk_), intent(in) :: x,y
g_gauss = dzero
if (x == done) then
g_gauss = done
else if (x == dzero) then
g_gauss = done
end if
end function g_gauss
end module amg_d_pde2d_gauss_mod
+25 -21
View File
@@ -72,6 +72,7 @@ program amg_d_pde3d
use data_input
use amg_d_pde3d_base_mod
use amg_d_pde3d_exp_mod
use amg_d_pde3d_box_mod
use amg_d_pde3d_gauss_mod
use amg_d_genpde_mod
#if defined(OPENMP)
@@ -125,16 +126,16 @@ program amg_d_pde3d
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
! AMG cycles for ML
! general AMG data
character(len=16) :: mlcycle ! AMG cycle type
character(len=32) :: mlcycle ! AMG cycle type
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
@@ -142,39 +143,39 @@ program amg_d_pde3d
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr ! restriction over application of AS
character(len=32) :: prol ! prolongation over application of AS
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
character(len=16) :: variant ! AINV variant: LLK, etc
character(len=32) :: variant ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
real(psb_dpk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr2 ! restriction over application of AS
character(len=32) :: prol2 ! prolongation over application of AS
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
character(len=16) :: variant2 ! AINV variant: LLK, etc
character(len=32) :: variant2 ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
@@ -243,10 +244,13 @@ program amg_d_pde3d
select case(psb_toupper(trim(pdecoeff)))
case("CONST")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1,a2,a3,b1,b2,b3,c,g,info)
& a1_base,a2_base,a3_base,b1_base,b2_base,b3_base,c_base,g_base,info)
case("EXP")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_exp,a2_exp,a3_exp,b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
case("BOX")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_box,a2_box,a3_box,b1_box,b2_box,b3_box,c_box,g_box,info)
case("GAUSS")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_gauss,a2_gauss,a3_gauss,b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
@@ -504,7 +508,7 @@ program amg_d_pde3d
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
call psb_print_timers(ctxt)
!
! cleanup storage and exit
!
@@ -35,67 +35,67 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_d_pde3d_base_mod
use psb_base_mod, only : psb_dpk_, done
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_base(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_base
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b1
function b1_base(x,y,z)
implicit none
real(psb_dpk_) :: b1_base
real(psb_dpk_), intent(in) :: x,y,z
b1=done/sqrt(3.0_psb_dpk_)
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b2
b1_base=dzero/sqrt(3.0_psb_dpk_)
end function b1_base
function b2_base(x,y,z)
implicit none
real(psb_dpk_) :: b2_base
real(psb_dpk_), intent(in) :: x,y,z
b2=done/sqrt(3.0_psb_dpk_)
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b3
b2_base=dzero/sqrt(3.0_psb_dpk_)
end function b2_base
function b3_base(x,y,z)
implicit none
real(psb_dpk_) :: b3_base
real(psb_dpk_), intent(in) :: x,y,z
b3=done/sqrt(3.0_psb_dpk_)
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero, done
real(psb_dpk_) :: c
b3_base=dzero/sqrt(3.0_psb_dpk_)
end function b3_base
function c_base(x,y,z)
implicit none
real(psb_dpk_) :: c_base
real(psb_dpk_), intent(in) :: x,y,z
c=dzero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_dpk_
real(psb_dpk_) :: a1
c_base=dzero
end function c_base
function a1_base(x,y,z)
implicit none
real(psb_dpk_) :: a1_base
real(psb_dpk_), intent(in) :: x,y,z
a1=epsilon
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_dpk_
real(psb_dpk_) :: a2
a1_base=epsilon
end function a1_base
function a2_base(x,y,z)
implicit none
real(psb_dpk_) :: a2_base
real(psb_dpk_), intent(in) :: x,y,z
a2=epsilon
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_dpk_
real(psb_dpk_) :: a3
a2_base=epsilon
end function a2_base
function a3_base(x,y,z)
implicit none
real(psb_dpk_) :: a3_base
real(psb_dpk_), intent(in) :: x,y,z
a3=epsilon
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_) :: g
a3_base=epsilon
end function a3_base
function g_base(x,y,z)
implicit none
real(psb_dpk_) :: g_base
real(psb_dpk_), intent(in) :: x,y,z
g = dzero
g_base = dzero
if (x == done) then
g = done
g_base = done
else if (x == dzero) then
g = done
g_base = done
end if
end function g
end function g_base
end module amg_d_pde3d_base_mod
@@ -0,0 +1,101 @@
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_d_pde3d_box_mod
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm3d_box(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm3d_box
!
! functions parametrizing the differential equation
!
function b1_box(x,y,z)
implicit none
real(psb_dpk_) :: b1_box
real(psb_dpk_), intent(in) :: x,y,z
b1_box=done/sqrt(3.0_psb_dpk_)
end function b1_box
function b2_box(x,y,z)
implicit none
real(psb_dpk_) :: b2_box
real(psb_dpk_), intent(in) :: x,y,z
b2_box=done/sqrt(3.0_psb_dpk_)
end function b2_box
function b3_box(x,y,z)
implicit none
real(psb_dpk_) :: b3_box
real(psb_dpk_), intent(in) :: x,y,z
b3_box=done/sqrt(3.0_psb_dpk_)
end function b3_box
function c_box(x,y,z)
implicit none
real(psb_dpk_) :: c_box
real(psb_dpk_), intent(in) :: x,y,z
c_box=dzero
end function c_box
function a1_box(x,y,z)
implicit none
real(psb_dpk_) :: a1_box
real(psb_dpk_), intent(in) :: x,y,z
a1_box=epsilon
end function a1_box
function a2_box(x,y,z)
implicit none
real(psb_dpk_) :: a2_box
real(psb_dpk_), intent(in) :: x,y,z
a2_box=epsilon
end function a2_box
function a3_box(x,y,z)
implicit none
real(psb_dpk_) :: a3_box
real(psb_dpk_), intent(in) :: x,y,z
a3_box=epsilon
end function a3_box
function g_box(x,y,z)
implicit none
real(psb_dpk_) :: g_box
real(psb_dpk_), intent(in) :: x,y,z
g_box= dzero
if (x == done) then
g_box = done
else if (x == dzero) then
g_box = done
end if
end function g_box
end module amg_d_pde3d_box_mod
+11 -11
View File
@@ -35,60 +35,60 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_d_pde3d_exp_mod
use psb_base_mod, only : psb_dpk_, done
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/160
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_exp(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_exp
!
! functions parametrizing the differential equation
!
function b1_exp(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero
implicit none
real(psb_dpk_) :: b1_exp
real(psb_dpk_), intent(in) :: x,y,z
b1_exp=dzero/sqrt(3.0_psb_dpk_)
end function b1_exp
function b2_exp(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero
implicit none
real(psb_dpk_) :: b2_exp
real(psb_dpk_), intent(in) :: x,y,z
b2_exp=dzero/sqrt(3.0_psb_dpk_)
end function b2_exp
function b3_exp(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero
implicit none
real(psb_dpk_) :: b3_exp
real(psb_dpk_), intent(in) :: x,y,z
b3_exp=dzero/sqrt(3.0_psb_dpk_)
end function b3_exp
function c_exp(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero
implicit none
real(psb_dpk_) :: c_exp
real(psb_dpk_), intent(in) :: x,y,z
c_exp=dzero
end function c_exp
function a1_exp(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a1_exp
real(psb_dpk_), intent(in) :: x,y,z
a1_exp=epsilon*exp(-(x+y+z))
end function a1_exp
function a2_exp(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a2_exp
real(psb_dpk_), intent(in) :: x,y,z
a2_exp=epsilon*exp(-(x+y+z))
end function a2_exp
function a3_exp(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a3_exp
real(psb_dpk_), intent(in) :: x,y,z
a3_exp=epsilon*exp(-(x+y+z))
end function a3_exp
function g_exp(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: g_exp
real(psb_dpk_), intent(in) :: x,y,z
g_exp = dzero
@@ -35,60 +35,60 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_d_pde3d_gauss_mod
use psb_base_mod, only : psb_dpk_, done
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_), save, private :: epsilon=done/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_gauss(dat)
real(psb_dpk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_gauss
!
! functions parametrizing the differential equation
!
function b1_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_, done
implicit none
real(psb_dpk_) :: b1_gauss
real(psb_dpk_), intent(in) :: x,y,z
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2+z**2))
end function b1_gauss
function b2_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_, done
implicit none
real(psb_dpk_) :: b2_gauss
real(psb_dpk_), intent(in) :: x,y,z
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2+z**2))
end function b2_gauss
function b3_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_, done
implicit none
real(psb_dpk_) :: b3_gauss
real(psb_dpk_), intent(in) :: x,y,z
b3_gauss=done/sqrt(3.0_psb_dpk_)-2*z*exp(-(x**2+y**2+z**2))
end function b3_gauss
function c_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_, dzero
implicit none
real(psb_dpk_) :: c_gauss
real(psb_dpk_), intent(in) :: x,y,z
c=dzero
c_gauss=dzero
end function c_gauss
function a1_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a1_gauss
real(psb_dpk_), intent(in) :: x,y,z
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a1_gauss
function a2_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a2_gauss
real(psb_dpk_), intent(in) :: x,y,z
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a2_gauss
function a3_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_
implicit none
real(psb_dpk_) :: a3_gauss
real(psb_dpk_), intent(in) :: x,y,z
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a3_gauss
function g_gauss(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
implicit none
real(psb_dpk_) :: g_gauss
real(psb_dpk_), intent(in) :: x,y,z
g_gauss = dzero
+24 -20
View File
@@ -72,6 +72,7 @@ program amg_s_pde2d
use amg_s_pde2d_base_mod
use amg_s_pde2d_exp_mod
use amg_s_pde2d_box_mod
use amg_s_pde2d_gauss_mod
use amg_s_genpde_mod
#if defined(OPENMP)
use omp_lib
@@ -124,16 +125,16 @@ program amg_s_pde2d
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
! AMG cycles for ML
! general AMG data
character(len=16) :: mlcycle ! AMG cycle type
character(len=32) :: mlcycle ! AMG cycle type
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
@@ -141,39 +142,39 @@ program amg_s_pde2d
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr ! restriction over application of AS
character(len=32) :: prol ! prolongation over application of AS
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
character(len=16) :: variant ! AINV variant: LLK, etc
character(len=32) :: variant ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
real(psb_spk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr2 ! restriction over application of AS
character(len=32) :: prol2 ! prolongation over application of AS
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
character(len=16) :: variant2 ! AINV variant: LLK, etc
character(len=32) :: variant2 ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_spk_) :: cthres ! threshold for ILUT factorization
@@ -241,13 +242,16 @@ program amg_s_pde2d
select case(psb_toupper(trim(pdecoeff)))
case("CONST")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1,a2,b1,b2,c,g,info)
& a1_base,a2_base,b1_base,b2_base,c_base,g_base,info)
case("EXP")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_exp,a2_exp,b1_exp,b2_exp,c_exp,g_exp,info)
case("BOX")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_box,a2_box,b1_box,b2_box,c_box,g_box,info)
case("GAUSS")
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_gauss,a2_gauss,b1_gauss,b2_gauss,c_gauss,g_gauss,info)
case default
info=psb_err_from_subroutine_
ch_err='amg_gen_pdecoeff'
@@ -38,52 +38,52 @@ module amg_s_pde2d_base_mod
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_base(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_base
!
! functions parametrizing the differential equation
!
function b1(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: b1
function b1_base(x,y)
implicit none
real(psb_spk_) :: b1_base
real(psb_spk_), intent(in) :: x,y
b1 = szero/1.414_psb_spk_
end function b1
function b2(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: b2
b1_base = szero/1.414_psb_spk_
end function b1_base
function b2_base(x,y)
implicit none
real(psb_spk_) :: b2_base
real(psb_spk_), intent(in) :: x,y
b2 = szero/1.414_psb_spk_
end function b2
function c(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: c
b2_base = szero/1.414_psb_spk_
end function b2_base
function c_base(x,y)
implicit none
real(psb_spk_) :: c_base
real(psb_spk_), intent(in) :: x,y
c = szero
end function c
function a1(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: a1
c_base = szero
end function c_base
function a1_base(x,y)
implicit none
real(psb_spk_) :: a1_base
real(psb_spk_), intent(in) :: x,y
a1=sone*epsilon
end function a1
function a2(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: a2
a1_base=sone*epsilon
end function a1_base
function a2_base(x,y)
implicit none
real(psb_spk_) :: a2_base
real(psb_spk_), intent(in) :: x,y
a2=sone*epsilon
end function a2
function g(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: g
a2_base=sone*epsilon
end function a2_base
function g_base(x,y)
implicit none
real(psb_spk_) :: g_base
real(psb_spk_), intent(in) :: x,y
g = szero
g_base = szero
if (x == sone) then
g = sone
g_base = sone
else if (x == szero) then
g = sone
g_base = sone
end if
end function g
end function g_base
end module amg_s_pde2d_base_mod
@@ -38,45 +38,45 @@ module amg_s_pde2d_box_mod
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_box(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_box
!
! functions parametrizing the differential equation
!
function b1_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: b1_box
real(psb_spk_), intent(in) :: x,y
b1_box = sone/1.414_psb_spk_
end function b1_box
function b2_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: b2_box
real(psb_spk_), intent(in) :: x,y
b2_box = sone/1.414_psb_spk_
end function b2_box
function c_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: c_box
real(psb_spk_), intent(in) :: x,y
c_box = szero
end function c_box
function a1_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: a1_box
real(psb_spk_), intent(in) :: x,y
a1_box=sone*epsilon
end function a1_box
function a2_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: a2_box
real(psb_spk_), intent(in) :: x,y
a2_box=sone*epsilon
end function a2_box
function g_box(x,y)
use psb_base_mod, only : psb_spk_, szero, sone
implicit none
real(psb_spk_) :: g_box
real(psb_spk_), intent(in) :: x,y
g_box = szero
+10 -10
View File
@@ -38,45 +38,45 @@ module amg_s_pde2d_exp_mod
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm2d_exp(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm2d_exp
!
! functions parametrizing the differential equation
!
function b1_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: b1_exp
real(psb_spk_), intent(in) :: x,y
b1_exp = szero
end function b1_exp
function b2_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: b2_exp
real(psb_spk_), intent(in) :: x,y
b2_exp = szero
end function b2_exp
function c_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: c_exp
real(psb_spk_), intent(in) :: x,y
c_exp = szero
end function c_exp
function a1_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: a1_exp
real(psb_spk_), intent(in) :: x,y
a1=sone*epsilon*exp(-(x+y))
a1_exp=sone*epsilon*exp(-(x+y))
end function a1_exp
function a2_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: a2_exp
real(psb_spk_), intent(in) :: x,y
a2=sone*epsilon*exp(-(x+y))
a2_exp=sone*epsilon*exp(-(x+y))
end function a2_exp
function g_exp(x,y)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: g_exp
real(psb_spk_), intent(in) :: x,y
g_exp = szero
@@ -0,0 +1,89 @@
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_s_pde2d_gauss_mod
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm2d_gauss(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm2d_gauss
!
! functions parametrizing the differential equation
!
function b1_gauss(x,y)
implicit none
real(psb_spk_) :: b1_gauss
real(psb_spk_), intent(in) :: x,y
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2))
end function b1_gauss
function b2_gauss(x,y)
implicit none
real(psb_spk_) :: b2_gauss
real(psb_spk_), intent(in) :: x,y
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2))
end function b2_gauss
function c_gauss(x,y)
implicit none
real(psb_spk_) :: c_gauss
real(psb_spk_), intent(in) :: x,y
c_gauss=szero
end function c_gauss
function a1_gauss(x,y)
implicit none
real(psb_spk_) :: a1_gauss
real(psb_spk_), intent(in) :: x,y
a1_gauss=epsilon*exp(-(x**2+y**2))
end function a1_gauss
function a2_gauss(x,y)
implicit none
real(psb_spk_) :: a2_gauss
real(psb_spk_), intent(in) :: x,y
a2_gauss=epsilon*exp(-(x**2+y**2))
end function a2_gauss
function g_gauss(x,y)
implicit none
real(psb_spk_) :: g_gauss
real(psb_spk_), intent(in) :: x,y
g_gauss = szero
if (x == sone) then
g_gauss = sone
else if (x == szero) then
g_gauss = sone
end if
end function g_gauss
end module amg_s_pde2d_gauss_mod
+25 -21
View File
@@ -72,6 +72,7 @@ program amg_s_pde3d
use data_input
use amg_s_pde3d_base_mod
use amg_s_pde3d_exp_mod
use amg_s_pde3d_box_mod
use amg_s_pde3d_gauss_mod
use amg_s_genpde_mod
#if defined(OPENMP)
@@ -125,16 +126,16 @@ program amg_s_pde3d
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
! AMG cycles for ML
! general AMG data
character(len=16) :: mlcycle ! AMG cycle type
character(len=32) :: mlcycle ! AMG cycle type
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
! AMG aggregation
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
integer(psb_ipk_) :: thrvsz ! size of threshold vector
@@ -142,39 +143,39 @@ program amg_s_pde3d
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
! AMG smoother or pre-smoother; also 1-lev preconditioner
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
integer(psb_ipk_) :: novr ! number of overlap layers
character(len=16) :: restr ! restriction over application of AS
character(len=16) :: prol ! prolongation over application of AS
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr ! restriction over application of AS
character(len=32) :: prol ! prolongation over application of AS
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
character(len=16) :: variant ! AINV variant: LLK, etc
character(len=32) :: variant ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
real(psb_spk_) :: thr ! threshold for ILUT factorization
! AMG post-smoother; ignored by 1-lev preconditioner
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
integer(psb_ipk_) :: novr2 ! number of overlap layers
character(len=16) :: restr2 ! restriction over application of AS
character(len=16) :: prol2 ! prolongation over application of AS
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
character(len=32) :: restr2 ! restriction over application of AS
character(len=32) :: prol2 ! prolongation over application of AS
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
character(len=16) :: variant2 ! AINV variant: LLK, etc
character(len=32) :: variant2 ! AINV variant: LLK, etc
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
! coarsest-level solver
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
! (repl. mat.)
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
! MILU, UMF, MUMPS, SLU
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
real(psb_spk_) :: cthres ! threshold for ILUT factorization
@@ -243,10 +244,13 @@ program amg_s_pde3d
select case(psb_toupper(trim(pdecoeff)))
case("CONST")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1,a2,a3,b1,b2,b3,c,g,info)
& a1_base,a2_base,a3_base,b1_base,b2_base,b3_base,c_base,g_base,info)
case("EXP")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_exp,a2_exp,a3_exp,b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
case("BOX")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_box,a2_box,a3_box,b1_box,b2_box,b3_box,c_box,g_box,info)
case("GAUSS")
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
& a1_gauss,a2_gauss,a3_gauss,b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
@@ -504,7 +508,7 @@ program amg_s_pde3d
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
end if
call psb_print_timers(ctxt)
!
! cleanup storage and exit
!
@@ -35,67 +35,67 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_s_pde3d_base_mod
use psb_base_mod, only : psb_spk_, sone
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_base(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_base
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b1
function b1_base(x,y,z)
implicit none
real(psb_spk_) :: b1_base
real(psb_spk_), intent(in) :: x,y,z
b1=sone/sqrt(3.0_psb_spk_)
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b2
b1_base=szero/sqrt(3.0_psb_spk_)
end function b1_base
function b2_base(x,y,z)
implicit none
real(psb_spk_) :: b2_base
real(psb_spk_), intent(in) :: x,y,z
b2=sone/sqrt(3.0_psb_spk_)
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b3
b2_base=szero/sqrt(3.0_psb_spk_)
end function b2_base
function b3_base(x,y,z)
implicit none
real(psb_spk_) :: b3_base
real(psb_spk_), intent(in) :: x,y,z
b3=sone/sqrt(3.0_psb_spk_)
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_spk_, szero, sone
real(psb_spk_) :: c
b3_base=szero/sqrt(3.0_psb_spk_)
end function b3_base
function c_base(x,y,z)
implicit none
real(psb_spk_) :: c_base
real(psb_spk_), intent(in) :: x,y,z
c=szero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_spk_
real(psb_spk_) :: a1
c_base=szero
end function c_base
function a1_base(x,y,z)
implicit none
real(psb_spk_) :: a1_base
real(psb_spk_), intent(in) :: x,y,z
a1=epsilon
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_spk_
real(psb_spk_) :: a2
a1_base=epsilon
end function a1_base
function a2_base(x,y,z)
implicit none
real(psb_spk_) :: a2_base
real(psb_spk_), intent(in) :: x,y,z
a2=epsilon
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_spk_
real(psb_spk_) :: a3
a2_base=epsilon
end function a2_base
function a3_base(x,y,z)
implicit none
real(psb_spk_) :: a3_base
real(psb_spk_), intent(in) :: x,y,z
a3=epsilon
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_) :: g
a3_base=epsilon
end function a3_base
function g_base(x,y,z)
implicit none
real(psb_spk_) :: g_base
real(psb_spk_), intent(in) :: x,y,z
g = szero
g_base = szero
if (x == sone) then
g = sone
g_base = sone
else if (x == szero) then
g = sone
g_base = sone
end if
end function g
end function g_base
end module amg_s_pde3d_base_mod
@@ -0,0 +1,101 @@
!
!
! AMG4PSBLAS version 1.0
! Algebraic Multigrid Package
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
!
! (C) Copyright 2021
!
! Salvatore Filippone
! Pasqua D'Ambra
! Fabio Durastante
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_s_pde3d_box_mod
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm3d_box(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm3d_box
!
! functions parametrizing the differential equation
!
function b1_box(x,y,z)
implicit none
real(psb_spk_) :: b1_box
real(psb_spk_), intent(in) :: x,y,z
b1_box=sone/sqrt(3.0_psb_spk_)
end function b1_box
function b2_box(x,y,z)
implicit none
real(psb_spk_) :: b2_box
real(psb_spk_), intent(in) :: x,y,z
b2_box=sone/sqrt(3.0_psb_spk_)
end function b2_box
function b3_box(x,y,z)
implicit none
real(psb_spk_) :: b3_box
real(psb_spk_), intent(in) :: x,y,z
b3_box=sone/sqrt(3.0_psb_spk_)
end function b3_box
function c_box(x,y,z)
implicit none
real(psb_spk_) :: c_box
real(psb_spk_), intent(in) :: x,y,z
c_box=szero
end function c_box
function a1_box(x,y,z)
implicit none
real(psb_spk_) :: a1_box
real(psb_spk_), intent(in) :: x,y,z
a1_box=epsilon
end function a1_box
function a2_box(x,y,z)
implicit none
real(psb_spk_) :: a2_box
real(psb_spk_), intent(in) :: x,y,z
a2_box=epsilon
end function a2_box
function a3_box(x,y,z)
implicit none
real(psb_spk_) :: a3_box
real(psb_spk_), intent(in) :: x,y,z
a3_box=epsilon
end function a3_box
function g_box(x,y,z)
implicit none
real(psb_spk_) :: g_box
real(psb_spk_), intent(in) :: x,y,z
g_box= szero
if (x == sone) then
g_box = sone
else if (x == szero) then
g_box = sone
end if
end function g_box
end module amg_s_pde3d_box_mod
+11 -11
View File
@@ -35,60 +35,60 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_s_pde3d_exp_mod
use psb_base_mod, only : psb_spk_, sone
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/160
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_exp(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_exp
!
! functions parametrizing the differential equation
!
function b1_exp(x,y,z)
use psb_base_mod, only : psb_spk_, szero
implicit none
real(psb_spk_) :: b1_exp
real(psb_spk_), intent(in) :: x,y,z
b1_exp=szero/sqrt(3.0_psb_spk_)
end function b1_exp
function b2_exp(x,y,z)
use psb_base_mod, only : psb_spk_, szero
implicit none
real(psb_spk_) :: b2_exp
real(psb_spk_), intent(in) :: x,y,z
b2_exp=szero/sqrt(3.0_psb_spk_)
end function b2_exp
function b3_exp(x,y,z)
use psb_base_mod, only : psb_spk_, szero
implicit none
real(psb_spk_) :: b3_exp
real(psb_spk_), intent(in) :: x,y,z
b3_exp=szero/sqrt(3.0_psb_spk_)
end function b3_exp
function c_exp(x,y,z)
use psb_base_mod, only : psb_spk_, szero
implicit none
real(psb_spk_) :: c_exp
real(psb_spk_), intent(in) :: x,y,z
c_exp=szero
end function c_exp
function a1_exp(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a1_exp
real(psb_spk_), intent(in) :: x,y,z
a1_exp=epsilon*exp(-(x+y+z))
end function a1_exp
function a2_exp(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a2_exp
real(psb_spk_), intent(in) :: x,y,z
a2_exp=epsilon*exp(-(x+y+z))
end function a2_exp
function a3_exp(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a3_exp
real(psb_spk_), intent(in) :: x,y,z
a3_exp=epsilon*exp(-(x+y+z))
end function a3_exp
function g_exp(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: g_exp
real(psb_spk_), intent(in) :: x,y,z
g_exp = szero
@@ -35,60 +35,60 @@
! POSSIBILITY OF SUCH DAMAGE.
!
module amg_s_pde3d_gauss_mod
use psb_base_mod, only : psb_spk_, sone
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_), save, private :: epsilon=sone/80
contains
subroutine pde_set_parm(dat)
subroutine pde_set_parm3d_gauss(dat)
real(psb_spk_), intent(in) :: dat
epsilon = dat
end subroutine pde_set_parm
end subroutine pde_set_parm3d_gauss
!
! functions parametrizing the differential equation
!
function b1_gauss(x,y,z)
use psb_base_mod, only : psb_spk_, sone
implicit none
real(psb_spk_) :: b1_gauss
real(psb_spk_), intent(in) :: x,y,z
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2+z**2))
end function b1_gauss
function b2_gauss(x,y,z)
use psb_base_mod, only : psb_spk_, sone
implicit none
real(psb_spk_) :: b2_gauss
real(psb_spk_), intent(in) :: x,y,z
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2+z**2))
end function b2_gauss
function b3_gauss(x,y,z)
use psb_base_mod, only : psb_spk_, sone
implicit none
real(psb_spk_) :: b3_gauss
real(psb_spk_), intent(in) :: x,y,z
b3_gauss=sone/sqrt(3.0_psb_spk_)-2*z*exp(-(x**2+y**2+z**2))
end function b3_gauss
function c_gauss(x,y,z)
use psb_base_mod, only : psb_spk_, szero
implicit none
real(psb_spk_) :: c_gauss
real(psb_spk_), intent(in) :: x,y,z
c=szero
c_gauss=szero
end function c_gauss
function a1_gauss(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a1_gauss
real(psb_spk_), intent(in) :: x,y,z
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a1_gauss
function a2_gauss(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a2_gauss
real(psb_spk_), intent(in) :: x,y,z
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a2_gauss
function a3_gauss(x,y,z)
use psb_base_mod, only : psb_spk_
implicit none
real(psb_spk_) :: a3_gauss
real(psb_spk_), intent(in) :: x,y,z
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
end function a3_gauss
function g_gauss(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
implicit none
real(psb_spk_) :: g_gauss
real(psb_spk_), intent(in) :: x,y,z
g_gauss = szero
+6 -6
View File
@@ -2,18 +2,18 @@
CSR ! Storage format CSR COO JAD
0040 ! IDIM; domain size. Linear system size is IDIM**3
CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE
BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
CG ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
2 ! ISTOPC
00500 ! ITMAX
00008 ! ITMAX
1 ! ITRACE
30 ! IRST (restart for RGMRES and BiCGSTABL)
1.d-6 ! EPS
%%%%%%%%%%% Main preconditioner choices %%%%%%%%%%%%%%%%
ML-VBM-VCYCLE-FBGS-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
BJAC ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML
ML-VBM-VCYCLE-FBGS-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
ML ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML
%%%%%%%%%%% First smoother (for all levels but coarsest) %%%%%%%%%%%%%%%%
BJAC ! Smoother type JACOBI FBGS GS BWGS BJAC AS. For 1-level, repeats previous.
1 ! Number of sweeps for smoother
L1-JACOBI ! Smoother type JACOBI FBGS GS BWGS BJAC AS. For 1-level, repeats previous.
4 ! Number of sweeps for smoother
0 ! Number of overlap layers for AS preconditioner
HALO ! AS restriction operator: NONE HALO
NONE ! AS prolongation operator: NONE SUM AVG