34 integer(kind=kint ),
intent(inout):: iter, error
35 real (kind=
kreal),
intent(inout):: resid, tset, tsol, tcomm
37 integer(kind=kint ) :: n, np, ndof, nndof
38 integer(kind=kint ) :: my_rank
39 integer(kind=kint ) :: iterlog, timelog
40 real(kind=
kreal),
pointer :: b(:), x(:)
42 integer(kind=kint),
dimension(:),
allocatable :: idxbfgs
43 real(kind=
kreal),
dimension(:) ,
allocatable :: vecr,workpc,tmpvecbfgs,rho,alpha
44 real(kind=
kreal),
dimension(:,:),
allocatable :: u,c,uin,cin,sbfgs,ybfgs
46 integer(kind=kint ) :: maxit, nrest,nbfgs
48 real (kind=
kreal) :: tol
50 real (kind=
kreal) zero, one
51 parameter( zero = 0.0d+0, one = 1.0d+0 )
53 integer(kind=kint ) :: nrk,i,k,kk,jj,info,ik,iorth,idx,tmpidx,ibfgs
54 integer(kind=kint ) :: irow
55 real (kind=
kreal) :: s_time,e_time,s1_time,e1_time
56 real (kind=
kreal) :: ldh,ldw,bnrm2,dnrm2,rnorm
57 real (kind=
kreal) :: commtime,comptime, coef,coef2,val,vcs,vsn,dtemp,aa,bb,r0,scale,rr
58 integer(kind=kint ) :: estcond
59 real (kind=
kreal) :: t_max,t_min,t_avg,t_sd
70 my_rank = hecmesh%my_rank
84 allocate (vecr(ndof*np))
85 allocate (workpc(ndof*np))
86 allocate (u(ndof*np,nrest))
87 allocate (c(ndof*np,nrest))
88 allocate (uin(ndof*np,nrest))
89 allocate (cin(ndof*np,nrest))
92 allocate (tmpvecbfgs(ndof*np))
93 allocate (sbfgs(ndof*np,nbfgs))
94 allocate (ybfgs(ndof*np,nbfgs))
95 allocate (idxbfgs(nbfgs))
97 allocate (alpha(nbfgs))
120 if (bnrm2.eq.0.d0)
then
128 if (timelog.eq.2)
then
130 t_max, t_min, t_avg, t_sd)
131 if (hecmesh%my_rank.eq.0)
then
132 write(*,*)
'Time solver setup'
133 write(*,*)
' Max :',t_max
134 write(*,*)
' Min :',t_min
135 write(*,*)
' Avg :',t_avg
136 write(*,*)
' Std Dev :',t_sd
140 tset = e_time - s_time
163 rho(k) = 1.0d0 / coef
165 alpha(k) = rho(k)*coef2
166 call hecmw_axpy_r(nndof, -alpha(k), ybfgs(:,idx), tmpvecbfgs)
172 coef2 = rho(k) * coef
173 call hecmw_axpy_r(nndof, alpha(k)-coef2, sbfgs(:,idx), uin(:,1))
177 call hecmw_matvec(hecmesh, hecmat, uin(:,1), cin(:,1), tcomm)
183 call hecmw_axpyz_r(nndof, -coef, c(:,iorth), cin(:,iorth), cin(:,iorth+1))
184 call hecmw_axpyz_r(nndof, -coef, u(:,iorth), uin(:,iorth), uin(:,iorth+1))
187 coef = 1.0d0 / dsqrt(coef)
197 if (ibfgs == nbfgs+1)
then
200 idxbfgs(kk) = idxbfgs(kk+1)
202 idxbfgs(nbfgs) = tmpidx
205 call hecmw_axpby_r(nndof, coef, 0.0d0, c(:,i), ybfgs(:,idxbfgs(ibfgs)))
206 call hecmw_axpby_r(nndof, coef, 0.0d0, u(:,i), sbfgs(:,idxbfgs(ibfgs)))
211 resid= dsqrt(dnrm2/bnrm2)
214 if (my_rank.eq.0.and.iterlog.eq.1)
write (*,
'(i7, 1pe16.6)') iter, resid
217 if ( resid.le.tol )
exit outer
218 if ( iter.gt.maxit )
then
235 tcomm = tcomm + e_time - s_time
247 if (timelog.eq.2)
then
249 t_max, t_min, t_avg, t_sd)
250 if (hecmesh%my_rank.eq.0)
then
251 write(*,*)
'Time solver iterations'
252 write(*,*)
' Max :',t_max
253 write(*,*)
' Min :',t_min
254 write(*,*)
' Avg :',t_avg
255 write(*,*)
' Std Dev :',t_sd
259 tsol = e1_time - s1_time
integer(kind=kint) function, public hecmw_mat_get_nrest(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_resid(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nbfgs(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iterlog(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_timelog(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_estcond(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iter(hecMAT)
subroutine, public hecmw_precond_clear(hecMAT)
subroutine, public hecmw_precond_setup(hecMAT, hecMESH, sym)
subroutine, public hecmw_precond_apply(hecMESH, hecMAT, R, Z, ZP, COMMtime)
subroutine, public hecmw_solve_gmresr(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_matresid(hecMESH, hecMAT, X, B, R, COMMtime)
subroutine, public hecmw_matvec(hecMESH, hecMAT, X, Y, COMMtime)
subroutine hecmw_axpyz_r(n, alpha, X, Y, Z)
subroutine hecmw_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine hecmw_axpby_r(n, alpha, beta, X, Y)
subroutine hecmw_axpy_r(n, alpha, X, Y)
subroutine hecmw_copy_r(n, X, Y)
subroutine hecmw_time_statistics(hecMESH, time, t_max, t_min, t_avg, t_sd)
subroutine, public hecmw_solver_scaling_fw(hecMESH, hecMAT, COMMtime)
subroutine, public hecmw_solver_scaling_bk(hecMAT)
integer(kind=4), parameter kreal
real(kind=kreal) function hecmw_wtime()
subroutine hecmw_update_r(hecMESH, val, n, m)
subroutine hecmw_barrier(hecMESH)
integer(kind=kint), parameter hecmw_solver_error_noconv_maxit