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) :: sigma
48 integer(kind=kint) :: auto_sigma_diag
68 if (sigma_diag.lt.0.d0)
then
98 hecmat%symmetric = .true.
99 call hecmw_solve_cg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
101 hecmat%symmetric = .false.
104 hecmat%symmetric = .false.
105 call hecmw_solve_gmres( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
107 hecmat%symmetric = .false.
108 call hecmw_solve_gpbicg( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
110 hecmat%symmetric = .false.
111 call hecmw_solve_gmresr( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
113 hecmat%symmetric = .false.
114 call hecmw_solve_gmresren( hecmesh,hecmat, iter, resid, error, time_setup, time_sol, time_comm )
116 hecmat%symmetric = .true.
117 call hecmw_solve_cr( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
119 hecmat%symmetric = .true.
120 call hecmw_solve_pipecg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
122 hecmat%symmetric = .true.
123 call hecmw_solve_groppcg( hecmesh, hecmat, iter, resid, error, time_setup, time_sol, time_comm )
132 if ((precond>=10 .and. precond<20) .and. auto_sigma_diag==1 .and. sigma_diag<2.d0)
then
133 sigma_diag = sigma_diag + 0.1
134 if (hecmesh%my_rank.eq.0)
write(*,*)
'Increasing SIGMA_DIAG to', sigma_diag
136 elseif ((method==1 .or. method==8 .or. method==9) .and. method2>1)
then
137 if (auto_sigma_diag.eq.1) sigma_diag = 1.0
152 if (hecmesh%my_rank.eq.0 .and. (iterlog.eq.1 .or. timelog.ge.1))
then
153 write(*,
"(a,1pe12.5)")
'### Relative residual =', resid2
162 if (hecmesh%my_rank.eq.0 .and. timelog.ge.1)
then
163 tr= (time_sol-time_comm)/(time_sol+1.d-24)*100.d0
164 write (*,
'(/a)')
'### summary of linear solver'
165 write (*,
'(i10,a, 1pe16.6)') iter,
' iterations ', resid
166 write (*,
'(a, 1pe16.6 )')
' set-up time : ', time_setup
167 write (*,
'(a, 1pe16.6 )')
' solver time : ', time_sol
168 write (*,
'(a, 1pe16.6 )')
' solver/comm time : ', time_comm
169 write (*,
'(a, 1pe16.6 )')
' solver/matvec : ', time_ax
170 write (*,
'(a, 1pe16.6 )')
' solver/precond : ', time_precond
172 write (*,
'(a, 1pe16.6 )')
' solver/1 iter : ', time_sol / iter
173 write (*,
'(a, 1pe16.6/)')
' work ratio (%) : ', tr
186 type (hecmwST_local_mesh) :: hecMESH
188 integer(kint) :: N, NP, NDOF, NPU, NPL, NZ
189 integer(kint) :: base, i, count_Ax
190 real(kreal) :: time_Ax, size_matrix, flop_matrix, size_vector, memory_size, tmp, num
191 real(kreal) :: t_max, t_min, t_avg, t_sd
192 character(2) :: SI(0:6) = [
' ',
' K',
' M',
' G',
' T',
' P',
' E']
199 npu = hecmat%indexU(n)
200 npl = hecmat%indexL(n)
203 size_matrix = kreal*nz*ndof**2 &
206 size_vector = kreal*n*ndof &
208 memory_size = size_matrix + size_vector
209 flop_matrix = 2.0d0*nz*ndof**2
216 i = int(log(num) / log(dble(base)))
217 tmp = 1.0d0/base**i * num
218 if(hecmesh%my_rank == 0)
then
219 write (*,
"(a,f11.3,a,a)")
"memory amount of coef. matrix: ", tmp, si(i),
"B"
222 num = count_ax*memory_size/time_ax
223 i = int(log(num) / log(dble(base)))
224 tmp = 1.0d0/base**i * num
226 if(hecmesh%my_rank == 0)
then
227 write(*,
"(a,f11.3,a,a)")
"matvec memory band width : ", tmp, si(i),
"B/s"
228 write(*,
"(a,f11.3)")
' Max :',t_max
229 write(*,
"(a,f11.3)")
' Min :',t_min
230 write(*,
"(a,f11.3)")
' Avg :',t_avg
231 write(*,
"(a,f11.3)")
' Std Dev :',t_sd
234 num = count_ax*flop_matrix/time_ax
235 i = int(log(num) / log(dble(base)))
236 tmp = 1.0d0/base**i * num
238 if(hecmesh%my_rank == 0)
then
239 write(*,
"(a,f11.3,a,a)")
"matvec FLOPs : ", tmp, si(i),
"FLOPs"
240 write(*,
"(a,f11.3)")
' Max :',t_max
241 write(*,
"(a,f11.3)")
' Min :',t_min
242 write(*,
"(a,f11.3)")
' Avg :',t_avg
243 write(*,
"(a,f11.3)")
' Std Dev :',t_sd
253 type (hecmwST_local_mesh) :: hecMESH
254 type (hecmwST_matrix),
target :: hecMAT
255 integer (kind=kint)::PRECOND,iterPREmax,i,j,error
262 do j = 1, hecmat%NDOF
263 if (dabs(hecmat%D(hecmat%NDOF*hecmat%NDOF*(i-1)+(j-1)*(hecmat%NDOF+1)+1)).eq.0.d0)
then
270 if (error.ne.0 .and. (precond.lt.10 .and. iterpremax.gt.0))
then
284 real(kind=
kreal),
dimension(1) :: rhs
285 integer (kind=kint)::precond,iterpremax,i,j,error
297 do j = 1, hecmat%NDOF
298 rhs(1)=rhs(1) + hecmat%B(hecmat%NDOF*(i-1)+j)**2
301 if (hecmesh%mpc%n_mpc > 0)
then
302 do i= 1, hecmesh%mpc%n_mpc
303 rhs(1)= rhs(1) + hecmesh%mpc%mpc_const(i)**2
308 if (rhs(1).eq.0.d0)
then
323 type (hecmwST_local_mesh) :: hecMESH
324 type (hecmwST_matrix),
target :: hecMAT
325 integer(kind=kint) :: METHOD
326 integer(kind=kint) :: ITER, PRECOND, NSET, iterPREmax, NREST,NBFGS
327 integer(kind=kint) :: ITERlog, TIMElog
329 character(len=30) :: msg_precond
330 character(len=30) :: msg_method
346 msg_method=
"BiCGSTAB"
355 msg_method=
"SUP-GMRESR"
358 msg_method=
"GMRESR-EN"
366 msg_method=
"Unlabeled"
376 msg_precond=
"DirectMUMPS"
378 write(msg_precond,
"(a,i0,a)")
"ILU(",precond-10,
")"
386 msg_precond=
"Unlabeled"
388 if (hecmesh%my_rank.eq.0 .and. (iterlog.eq.1 .or. timelog.ge.1))
then
389 write (*,
'(a,i0,a,i0,a,a,a,a,a,i0)')
'### ',hecmat%NDOF,
'x',hecmat%NDOF,
' BLOCK ', &
390 & 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_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_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)
real(kind=kreal) function, public hecmw_mat_get_sigma(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