35 integer(kind=kint ),
intent(inout):: iter, error
36 real (kind=
kreal),
intent(inout):: resid, tset, tsol, tcomm
38 integer(kind=kint ) :: n, np, ndof, nndof
39 integer(kind=kint ) :: my_rank
40 integer(kind=kint ) :: iterlog, timelog
41 real(kind=
kreal),
pointer :: b(:), x(:)
43 integer(kind=kint),
dimension(:),
allocatable :: idxbfgs
44 real(kind=
kreal),
dimension(:) ,
allocatable :: vecr,workpc,tmpvecbfgs,rho,alpha
45 real(kind=
kreal),
dimension(:,:),
allocatable :: u,c,uin,cin,sbfgs,ybfgs
47 integer(kind=kint ) :: maxit, nrest,nbfgs
49 real (kind=
kreal) :: tol
51 real (kind=
kreal) zero, one
52 parameter( zero = 0.0d+0, one = 1.0d+0 )
54 integer(kind=kint ) :: nrk,i,k,kk,jj,info,ik,iorth,idx,tmpidx,ibfgs
55 integer(kind=kint ) :: irow
56 real (kind=
kreal) :: s_time,e_time,s1_time,e1_time
57 real (kind=
kreal) :: ldh,ldw,bnrm2,dnrm2,rnorm
58 real (kind=
kreal) :: commtime,comptime, coef,coef2,val,vcs,vsn,dtemp,aa,bb,r0,scale,rr
59 integer(kind=kint ) :: estcond
60 real (kind=
kreal) :: t_max,t_min,t_avg,t_sd
71 my_rank = hecmesh%my_rank
85 allocate (vecr(ndof*np))
86 allocate (workpc(ndof*np))
87 allocate (u(ndof*np,nrest))
88 allocate (c(ndof*np,nrest))
89 allocate (uin(ndof*np,nrest))
90 allocate (cin(ndof*np,nrest))
93 allocate (tmpvecbfgs(ndof*np))
94 allocate (sbfgs(ndof*np,nbfgs))
95 allocate (ybfgs(ndof*np,nbfgs))
96 allocate (idxbfgs(nbfgs))
98 allocate (alpha(nbfgs))
134 if (bnrm2.eq.0.d0)
then
142 if (timelog.eq.2)
then
144 t_max, t_min, t_avg, t_sd)
145 if (hecmesh%my_rank.eq.0)
then
146 write(*,*)
'Time solver setup'
147 write(*,*)
' Max :',t_max
148 write(*,*)
' Min :',t_min
149 write(*,*)
' Avg :',t_avg
150 write(*,*)
' Std Dev :',t_sd
154 tset = e_time - s_time
177 rho(k) = 1.0d0 / coef
179 alpha(k) = rho(k)*coef2
180 call hecmw_axpy_r(nndof, -alpha(k), ybfgs(:,idx), tmpvecbfgs)
186 coef2 = rho(k) * coef
187 call hecmw_axpy_r(nndof, alpha(k)-coef2, sbfgs(:,idx), uin(:,1))
191 call hecmw_matvec(hecmesh, hecmat, uin(:,1), cin(:,1), tcomm)
197 call hecmw_axpyz_r(nndof, -coef, c(:,iorth), cin(:,iorth), cin(:,iorth+1))
198 call hecmw_axpyz_r(nndof, -coef, u(:,iorth), uin(:,iorth), uin(:,iorth+1))
201 coef = 1.0d0 / dsqrt(coef)
211 if (ibfgs == nbfgs+1)
then
214 idxbfgs(kk) = idxbfgs(kk+1)
216 idxbfgs(nbfgs) = tmpidx
219 call hecmw_axpby_r(nndof, coef, 0.0d0, c(:,i), ybfgs(:,idxbfgs(ibfgs)))
220 call hecmw_axpby_r(nndof, coef, 0.0d0, u(:,i), sbfgs(:,idxbfgs(ibfgs)))
225 resid= dsqrt(dnrm2/bnrm2)
228 if (my_rank.eq.0.and.iterlog.eq.1)
write (*,
'(i7, 1pe16.6)') iter, resid
231 if ( resid.le.tol )
exit outer
232 if ( iter.gt.maxit )
then
249 tcomm = tcomm + e_time - s_time
266 if (timelog.eq.2)
then
268 t_max, t_min, t_avg, t_sd)
269 if (hecmesh%my_rank.eq.0)
then
270 write(*,*)
'Time solver iterations'
271 write(*,*)
' Max :',t_max
272 write(*,*)
' Min :',t_min
273 write(*,*)
' Avg :',t_avg
274 write(*,*)
' Std Dev :',t_sd
278 tsol = e1_time - s1_time
Jagged Diagonal Matrix storage for vector processors. Original code was provided by JAMSTEC.
subroutine, public hecmw_jad_init(hecMAT)
subroutine, public hecmw_jad_finalize(hecMAT)
subroutine, public hecmw_mat_integrate(hecMAT)
Integrate matrix components into a single array for efficient access.
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_usejad(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_matvec_teardown(hecMAT)
subroutine, public hecmw_matvec_setup(hecMESH, hecMAT)
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