|
|
|
@ -1,8 +1,7 @@
|
|
|
|
|
!!$
|
|
|
|
|
!!$
|
|
|
|
|
!!$ MLD2P4 version 2.0
|
|
|
|
|
!!$ MLD2P4 version 2.1
|
|
|
|
|
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
|
|
|
|
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.3)
|
|
|
|
|
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.4)
|
|
|
|
|
!!$
|
|
|
|
|
!!$ (C) Copyright 2008, 2010, 2012, 2015
|
|
|
|
|
!!$
|
|
|
|
@ -37,9 +36,9 @@
|
|
|
|
|
!!$
|
|
|
|
|
!!$
|
|
|
|
|
!
|
|
|
|
|
! File: spde3d.f90
|
|
|
|
|
! File: mld_s_pde3d.f90
|
|
|
|
|
!
|
|
|
|
|
! Program: spde3d
|
|
|
|
|
! Program: mld_s_pde3d
|
|
|
|
|
! This sample program solves a linear system obtained by discretizing a
|
|
|
|
|
! PDE with Dirichlet BCs.
|
|
|
|
|
!
|
|
|
|
@ -63,7 +62,7 @@
|
|
|
|
|
! then the corresponding vector is distributed according to a BLOCK
|
|
|
|
|
! data distribution.
|
|
|
|
|
!
|
|
|
|
|
module spde3d_mod
|
|
|
|
|
module mld_s_pde3d_mod
|
|
|
|
|
contains
|
|
|
|
|
!
|
|
|
|
|
! functions parametrizing the differential equation
|
|
|
|
@ -72,64 +71,64 @@ contains
|
|
|
|
|
use psb_base_mod, only : psb_spk_
|
|
|
|
|
real(psb_spk_) :: b1
|
|
|
|
|
real(psb_spk_), intent(in) :: x,y,z
|
|
|
|
|
b1=0.e0/sqrt(3.e0)
|
|
|
|
|
b1=0.d0/sqrt(3.d0)
|
|
|
|
|
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=0.e0/sqrt(3.e0)
|
|
|
|
|
b2=0.d0/sqrt(3.d0)
|
|
|
|
|
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=0.e0/sqrt(3.e0)
|
|
|
|
|
b3=0.d0/sqrt(3.d0)
|
|
|
|
|
end function b3
|
|
|
|
|
function c(x,y,z)
|
|
|
|
|
use psb_base_mod, only : psb_spk_
|
|
|
|
|
real(psb_spk_) :: c
|
|
|
|
|
real(psb_spk_), intent(in) :: x,y,z
|
|
|
|
|
c=0.e0
|
|
|
|
|
c=0.d0
|
|
|
|
|
end function c
|
|
|
|
|
function a1(x,y,z)
|
|
|
|
|
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.d0!/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.d0!/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.d0!/80
|
|
|
|
|
end function a3
|
|
|
|
|
function g(x,y,z)
|
|
|
|
|
use psb_base_mod, only : psb_spk_, sone, szero
|
|
|
|
|
use psb_base_mod, only : psb_spk_, done, dzero
|
|
|
|
|
real(psb_spk_) :: g
|
|
|
|
|
real(psb_spk_), intent(in) :: x,y,z
|
|
|
|
|
g = szero
|
|
|
|
|
if (x == sone) then
|
|
|
|
|
g = sone
|
|
|
|
|
else if (x == szero) then
|
|
|
|
|
g = dzero
|
|
|
|
|
if (x == done) then
|
|
|
|
|
g = done
|
|
|
|
|
else if (x == dzero) then
|
|
|
|
|
g = exp(y**2-z**2)
|
|
|
|
|
end if
|
|
|
|
|
end function g
|
|
|
|
|
end module spde3d_mod
|
|
|
|
|
end module mld_s_pde3d_mod
|
|
|
|
|
|
|
|
|
|
program spde3d
|
|
|
|
|
program mld_s_pde3d
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
use mld_prec_mod
|
|
|
|
|
use psb_krylov_mod
|
|
|
|
|
use psb_util_mod
|
|
|
|
|
use data_input
|
|
|
|
|
use spde3d_mod
|
|
|
|
|
use mld_s_pde3d_mod
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
! input parameters
|
|
|
|
@ -138,8 +137,7 @@ program spde3d
|
|
|
|
|
integer(psb_ipk_) :: idim
|
|
|
|
|
|
|
|
|
|
! miscellaneous
|
|
|
|
|
real(psb_spk_), parameter :: one = 1.0
|
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec
|
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
|
|
|
|
|
|
|
|
|
|
! sparse matrix and preconditioner
|
|
|
|
|
type(psb_sspmat_type) :: a
|
|
|
|
@ -203,7 +201,7 @@ program spde3d
|
|
|
|
|
stop
|
|
|
|
|
endif
|
|
|
|
|
if(psb_get_errstatus() /= 0) goto 9999
|
|
|
|
|
name='pde90'
|
|
|
|
|
name='mld_s_pde3d'
|
|
|
|
|
call psb_set_errverbosity(itwo)
|
|
|
|
|
!
|
|
|
|
|
! Hello world
|
|
|
|
@ -242,7 +240,6 @@ program spde3d
|
|
|
|
|
!
|
|
|
|
|
! prepare the preconditioner.
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
if (psb_toupper(prectype%prec) == 'ML') then
|
|
|
|
|
call mld_precinit(prec,prectype%prec, info)
|
|
|
|
|
if (prectype%nlevs > 0) then
|
|
|
|
@ -258,6 +255,22 @@ program spde3d
|
|
|
|
|
end if
|
|
|
|
|
if (prectype%athres >= dzero) &
|
|
|
|
|
& call mld_precset(prec,'aggr_thresh', prectype%athres, info)
|
|
|
|
|
call mld_precset(prec,'aggr_kind', prectype%aggrkind,info)
|
|
|
|
|
call mld_precset(prec,'aggr_alg', prectype%aggr_alg,info)
|
|
|
|
|
call mld_precset(prec,'aggr_ord', prectype%aggr_ord,info)
|
|
|
|
|
|
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
|
t1 = psb_wtime()
|
|
|
|
|
call mld_s_hierarchy_bld(a,desc_a,prec,info)
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_precbld'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
thier = psb_wtime()-t1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -267,9 +280,6 @@ program spde3d
|
|
|
|
|
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,'aggr_ord', prectype%aggr_ord,info)
|
|
|
|
|
call mld_precset(prec,'ml_type', prectype%mltype, info)
|
|
|
|
|
call mld_precset(prec,'smoother_pos', prectype%smthpos, info)
|
|
|
|
|
call mld_precset(prec,'coarse_solve', prectype%csolve, info)
|
|
|
|
@ -278,6 +288,18 @@ program spde3d
|
|
|
|
|
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 psb_barrier(ictxt)
|
|
|
|
|
t1 = psb_wtime()
|
|
|
|
|
call mld_s_ml_prec_bld(a,desc_a,prec,info)
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_precbld'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
tprec = psb_wtime()-t1
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
nlv = 1
|
|
|
|
|
call mld_precinit(prec,prectype%prec, info)
|
|
|
|
@ -289,9 +311,8 @@ program spde3d
|
|
|
|
|
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)
|
|
|
|
|
thier = dzero
|
|
|
|
|
t1 = psb_wtime()
|
|
|
|
|
call mld_precbld(a,desc_a,prec,info)
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
@ -300,14 +321,16 @@ program spde3d
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
tprec = psb_wtime()-t1
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!!$ call prec%dump(info,prefix='test-ml',ac=.true.,solver=.true.,smoother=.true.)
|
|
|
|
|
|
|
|
|
|
call psb_amx(ictxt,thier)
|
|
|
|
|
call psb_amx(ictxt,tprec)
|
|
|
|
|
|
|
|
|
|
if (iam == psb_root_) &
|
|
|
|
|
& write(psb_out_unit,'("Preconditioner time : ",es12.5)')tprec
|
|
|
|
|
& write(psb_out_unit,'("Preconditioner time : ",es12.5)') tprec+thier
|
|
|
|
|
if (iam == psb_root_) call mld_precdescr(prec,info)
|
|
|
|
|
if (iam == psb_root_) &
|
|
|
|
|
& write(psb_out_unit,'(" ")')
|
|
|
|
@ -330,8 +353,8 @@ program spde3d
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
|
t2 = psb_wtime() - t1
|
|
|
|
|
call psb_amx(ictxt,t2)
|
|
|
|
|
tslv = psb_wtime() - t1
|
|
|
|
|
call psb_amx(ictxt,tslv)
|
|
|
|
|
|
|
|
|
|
amatsize = a%sizeof()
|
|
|
|
|
descsize = desc_a%sizeof()
|
|
|
|
@ -341,13 +364,19 @@ program spde3d
|
|
|
|
|
call psb_sum(ictxt,precsize)
|
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
|
write(psb_out_unit,'("Time to solve matrix : ",es12.5)') t2
|
|
|
|
|
write(psb_out_unit,'("Time per iteration : ",es12.5)') t2/iter
|
|
|
|
|
write(psb_out_unit,'("Numer of levels of aggr. hierarchy: ",i12)') prec%get_nlevs()
|
|
|
|
|
write(psb_out_unit,'("Time to build aggr. hierarchy : ",es12.5)') thier
|
|
|
|
|
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
|
|
|
|
|
write(psb_out_unit,'("Total preconditioner time : ",es12.5)') tprec+thier
|
|
|
|
|
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
|
|
|
|
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
|
|
|
|
write(psb_out_unit,'("Number of iterations : ",i0)') iter
|
|
|
|
|
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)') err
|
|
|
|
|
write(psb_out_unit,'("Info on exit : ",i0)') info
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for A: ",i12)') amatsize
|
|
|
|
|
write(psb_out_unit,'("Storage format for A: ",a)') trim(a%get_fmt())
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)') descsize
|
|
|
|
|
write(psb_out_unit,'("Storage format for DESC_A: ",a)') trim(desc_a%get_fmt())
|
|
|
|
|
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)') precsize
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -481,7 +510,7 @@ contains
|
|
|
|
|
subroutine pr_usage(iout)
|
|
|
|
|
integer(psb_ipk_) :: iout
|
|
|
|
|
write(iout,*)'incorrect parameter(s) found'
|
|
|
|
|
write(iout,*)' usage: pde90 methd prec dim &
|
|
|
|
|
write(iout,*)' usage: mld_s_pde3d methd prec dim &
|
|
|
|
|
&[istop itmax itrace]'
|
|
|
|
|
write(iout,*)' where:'
|
|
|
|
|
write(iout,*)' methd: cgstab cgs rgmres bicgstabl'
|
|
|
|
@ -496,4 +525,4 @@ contains
|
|
|
|
|
write(iout,*)' iterations '
|
|
|
|
|
end subroutine pr_usage
|
|
|
|
|
|
|
|
|
|
end program spde3d
|
|
|
|
|
end program mld_s_pde3d
|