34 type (hecmwST_matrix),
target :: hecMAT
35 type (hecmwST_local_mesh) :: hecMESH
37 integer(kind=kint) :: error
38 integer(kind=kint) :: ITER, METHOD, PRECOND, NSET, METHOD2
39 integer(kind=kint) :: iterPREmax
40 integer(kind=kint) :: ITERlog, TIMElog
41 real(kind=
kreal) :: resid, sigma_diag, thresh, filter, resid2
42 real(kind=
kreal) :: time_setup, time_comm, time_sol, tr
43 real(kind=
kreal) :: time_ax, time_precond
45 integer(kind=kint) :: NREST
46 real(kind=
kreal) :: omega
48 integer(kind=kint) :: auto_sigma_diag
67 if (sigma_diag.lt.0.d0)
then
102 hecmat%symmetric = .true.
103 call hecmw_solve_cg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
105 hecmat%symmetric = .false.
108 hecmat%symmetric = .false.
109 call hecmw_solve_gmres( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
111 hecmat%symmetric = .false.
112 call hecmw_solve_gpbicg( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
114 hecmat%symmetric = .false.
115 call hecmw_solve_gmresr( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
117 hecmat%symmetric = .false.
118 call hecmw_solve_gmresren( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
120 hecmat%symmetric = .true.
121 call hecmw_solve_cr( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
123 hecmat%symmetric = .true.
124 call hecmw_solve_pipecg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
126 hecmat%symmetric = .true.
127 call hecmw_solve_groppcg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
136 if ((precond>=10 .and. precond<20) .and. auto_sigma_diag==1 .and. sigma_diag<2.d0)
then
137 sigma_diag = sigma_diag + 0.1
138 if (hecmesh%my_rank.eq.0)
write(*,*)
'Increasing SIGMA_DIAG to', sigma_diag
140 elseif ((method==1 .or. method==8 .or. method==9) .and. method2>1)
then
141 if (auto_sigma_diag.eq.1) sigma_diag = 1.0
156 if (hecmesh%my_rank.eq.0 .and. (iterlog.eq.1 .or. timelog.ge.1))
then
157 write(*,
"(a,1pe12.5)")
'### Relative residual =', resid2
166 if (hecmesh%my_rank.eq.0 .and. timelog.ge.1)
then
167 tr= (time_sol-time_comm)/(time_sol+1.d-24)*100.d0
168 write (*,
'(/a)')
'### summary of linear solver'
169 write (*,
'(i10,a, 1pe16.6)') iter,
' iterations ', resid
170 write (*,
'(a, 1pe16.6 )')
' set-up time : ', time_setup
171 write (*,
'(a, 1pe16.6 )')
' solver time : ', time_sol
172 write (*,
'(a, 1pe16.6 )')
' solver/comm time : ', time_comm
173 write (*,
'(a, 1pe16.6 )')
' solver/matvec : ', time_ax
174 write (*,
'(a, 1pe16.6 )')
' solver/precond : ', time_precond
176 write (*,
'(a, 1pe16.6 )')
' solver/1 iter : ', time_sol / iter
177 write (*,
'(a, 1pe16.6/)')
' work ratio (%) : ', tr
190 type (hecmwST_local_mesh) :: hecMESH
192 integer(kint) :: N, NP, NDOF, NPU, NPL, NZ
193 integer(kint) :: base, i, count_Ax
194 real(kreal) :: time_Ax, size_matrix, flop_matrix, size_vector, memory_size, tmp, num
195 real(kreal) :: t_max, t_min, t_avg, t_sd
196 character(2) :: SI(0:6) = [
' ',
' K',
' M',
' G',
' T',
' P',
' E']
203 npu = hecmat%indexU(n)
204 npl = hecmat%indexL(n)
207 size_matrix = kreal*nz*ndof**2 &
210 size_vector = kreal*n*ndof &
212 memory_size = size_matrix + size_vector
213 flop_matrix = 2.0d0*nz*ndof**2
220 i = int(log(num) / log(dble(base)))
221 tmp = 1.0d0/base**i * num
222 if(hecmesh%my_rank == 0)
then
223 write (*,
"(a,f11.3,a,a)")
"memory amount of coef. matrix: ", tmp, si(i),
"B"
226 num = count_ax*memory_size/time_ax
227 i = int(log(num) / log(dble(base)))
228 tmp = 1.0d0/base**i * num
230 if(hecmesh%my_rank == 0)
then
231 write(*,
"(a,f11.3,a,a)")
"matvec memory band width : ", tmp, si(i),
"B/s"
232 write(*,
"(a,f11.3)")
' Max :',t_max
233 write(*,
"(a,f11.3)")
' Min :',t_min
234 write(*,
"(a,f11.3)")
' Avg :',t_avg
235 write(*,
"(a,f11.3)")
' Std Dev :',t_sd
238 num = count_ax*flop_matrix/time_ax
239 i = int(log(num) / log(dble(base)))
240 tmp = 1.0d0/base**i * num
242 if(hecmesh%my_rank == 0)
then
243 write(*,
"(a,f11.3,a,a)")
"matvec FLOPs : ", tmp, si(i),
"FLOPs"
244 write(*,
"(a,f11.3)")
' Max :',t_max
245 write(*,
"(a,f11.3)")
' Min :',t_min
246 write(*,
"(a,f11.3)")
' Avg :',t_avg
247 write(*,
"(a,f11.3)")
' Std Dev :',t_sd
257 type (hecmwST_local_mesh) :: hecMESH
258 type (hecmwST_matrix),
target :: hecMAT
259 integer (kind=kint)::PRECOND,iterPREmax,i,j,error
266 do j = 1, hecmat%NDOF
267 if (dabs(hecmat%D(hecmat%NDOF*hecmat%NDOF*(i-1)+(j-1)*(hecmat%NDOF+1)+1)).eq.0.d0)
then
274 if (error.ne.0 .and. (precond.lt.10 .and. iterpremax.gt.0))
then
288 real(kind=
kreal),
dimension(1) :: rhs
289 integer (kind=kint)::precond,iterpremax,i,j,error
301 do j = 1, hecmat%NDOF
302 rhs(1)=rhs(1) + hecmat%B(hecmat%NDOF*(i-1)+j)**2
305 if (hecmesh%mpc%n_mpc > 0)
then
306 do i= 1, hecmesh%mpc%n_mpc
307 rhs(1)= rhs(1) + hecmesh%mpc%mpc_const(i)**2
312 if (rhs(1).eq.0.d0)
then
327 type (hecmwST_local_mesh) :: hecMESH
328 type (hecmwST_matrix),
target :: hecMAT
329 integer(kind=kint) :: METHOD
330 integer(kind=kint) :: ITER, PRECOND, NSET, iterPREmax, NREST,NBFGS
331 integer(kind=kint) :: ITERlog, TIMElog
333 character(len=30) :: msg_precond
334 character(len=30) :: msg_method
350 msg_method=
"BiCGSTAB"
359 msg_method=
"SUP-GMRESR"
362 msg_method=
"GMRESR-EN"
370 msg_method=
"Unlabeled"
380 msg_precond=
"DirectMUMPS"
382 write(msg_precond,
"(a,i0,a)")
"ILU(",precond-10,
")"
390 msg_precond=
"Unlabeled"
392 if (hecmesh%my_rank.eq.0 .and. (iterlog.eq.1 .or. timelog.ge.1))
then
393 write (*,
'(a,i0,a,i0,a,a,a,a,a,i0)')
'### ',hecmat%NDOF,
'x',hecmat%NDOF,
' BLOCK ', &
394 & trim(msg_method),
", ",trim(msg_precond),
", ", iterpremax
subroutine, public hecmw_mat_dump(hecMAT, hecMESH)
subroutine, public hecmw_mat_dump_solution(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_omega(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_sigma_diag(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iterpremax(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nrest(hecMAT)
subroutine, public hecmw_mat_set_omega(hecMAT, omega)
subroutine, public hecmw_mat_set_flag_diverged(hecMAT, flag_diverged)
real(kind=kreal) function, public hecmw_mat_get_resid(hecMAT)
subroutine, public hecmw_mat_set_flag_converged(hecMAT, flag_converged)
integer(kind=kint) function, public hecmw_mat_get_nbfgs(hecMAT)
subroutine, public hecmw_mat_recycle_precond_setting(hecMAT)
subroutine, public hecmw_mat_set_sigma_diag(hecMAT, sigma_diag)
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_method2(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_thresh(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_method(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_precond(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nset(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_filter(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iter(hecMAT)
subroutine, public hecmw_precond_clear_timer
real(kind=kreal) function, public hecmw_precond_get_timer()
subroutine hecmw_solve_bicgstab(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_cg(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_cr(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_gmres(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_gmresr(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_gmresren(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_gpbicg(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_solve_groppcg(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine hecmw_solve_iterative_printmsg(hecMESH, hecMAT, METHOD)
subroutine hecmw_output_flops(hecMESH, hecMAT, count_Ax, time_Ax)
logical function hecmw_solve_check_zerorhs(hecMESH, hecMAT)
subroutine hecmw_solve_check_zerodiag(hecMESH, hecMAT)
subroutine hecmw_solve_iterative(hecMESH, hecMAT)
subroutine, public hecmw_matvec_clear_timer
real(kind=kreal) function, public hecmw_rel_resid_l2(hecMESH, hecMAT, COMMtime)
real(kind=kreal) function, public hecmw_matvec_get_timer()
subroutine hecmw_time_statistics(hecMESH, time, t_max, t_min, t_avg, t_sd)
subroutine, public hecmw_solve_pipecg(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
integer(kind=kint), parameter hecmw_sum
integer(kind=4), parameter kint
integer(kind=kint), parameter hecmw_max
integer(kind=4), parameter kreal
subroutine hecmw_allreduce_i1(hecMESH, s, ntag)
subroutine hecmw_allreduce_r(hecMESH, val, n, ntag)
subroutine hecmw_allreduce_r1(hecMESH, s, ntag)
integer(kind=kint), parameter hecmw_solver_error_diverge_pc
integer(kind=kint), parameter hecmw_solver_error_diverge_nan
integer(kind=kint), parameter hecmw_solver_error_incons_pc
integer(kind=kint), parameter hecmw_solver_error_zero_diag
integer(kind=kint), parameter hecmw_solver_error_zero_rhs
subroutine hecmw_solve_error(hecMESH, IFLAG)
integer(kind=kint), parameter hecmw_solver_error_diverge_mat