23 logical,
save :: async_matvec_flg = .false.
37 real(kind=
kreal),
intent(in) :: x(:)
38 real(kind=
kreal),
intent(out) :: y(:)
39 real(kind=
kreal),
intent(inout) :: time_ax
40 real(kind=
kreal),
intent(inout),
optional :: commtime
42 real(kind=
kreal) :: tcomm
43 real(kind=
kreal),
allocatable :: wk(:)
48 allocate(wk(hecmat%NP * hecmat%NDOF))
52 call hecmw_matvec_22_inner(hecmesh, hecmat, x, y, time_ax, tcomm)
55 if (
present(commtime)) commtime = commtime + tcomm
72 subroutine hecmw_matvec_22_inner (hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
83 real(kind=
kreal),
intent(in) :: x(:)
84 real(kind=
kreal),
intent(out) :: y(:)
85 real(kind=
kreal),
intent(inout) :: time_ax
86 real(kind=
kreal),
intent(inout),
optional :: commtime
88 real(kind=
kreal) :: start_time, end_time, tcomm
89 integer(kind=kint) :: i, j, js, je, in
90 real(kind=
kreal) :: yv1, yv2, x1, x2
92 integer(kind=kint) :: n, np
93 integer(kind=kint),
pointer :: indexl(:), iteml(:), indexu(:), itemu(:), indexa(:), itema(:)
94 real(kind=
kreal),
pointer :: al(:), au(:), d(:), a(:)
97 integer,
parameter :: numofblockperthread = 100
98 logical,
save :: isfirst = .true.
99 integer,
save :: numofthread = 1
100 integer,
save,
allocatable :: startpos(:), endpos(:)
101 integer(kind=kint),
save :: sectorcachesize0, sectorcachesize1
102 integer(kind=kint) :: threadnum, blocknum, numofblock
103 integer(kind=kint) :: numofelement, elementcount, blockindex
104 real(kind=
kreal) :: numofelementperblock
112 time_ax = time_ax + end_time - start_time - tcomm
113 if (
present(commtime)) commtime = commtime + tcomm
118 indexl => hecmat%indexL
119 indexu => hecmat%indexU
120 indexa => hecmat%indexA
121 iteml => hecmat%itemL
122 itemu => hecmat%itemU
123 itema => hecmat%itemA
131 if (.not. isfirst)
then
132 numofblock = numofthread * numofblockperthread
133 if (endpos(numofblock-1) .ne. n-1)
then
134 deallocate(startpos, endpos)
140 numofblock = numofthread * numofblockperthread
141 allocate (startpos(0 : numofblock - 1), endpos(0 : numofblock - 1))
142 numofelement = n + indexl(n) + indexu(n)
143 numofelementperblock = dble(numofelement) / numofblock
146 startpos(blocknum) = 1
148 elementcount = elementcount + 1
149 elementcount = elementcount + (indexl(i) - indexl(i-1))
150 elementcount = elementcount + (indexu(i) - indexu(i-1))
151 if (elementcount > (blocknum + 1) * numofelementperblock)
then
153 blocknum = blocknum + 1
154 startpos(blocknum) = i + 1
155 if (blocknum == (numofblock - 1))
exit
160 do i= blocknum+1, numofblock-1
166 sectorcachesize0, sectorcachesize1)
176 if (
present(commtime)) commtime = commtime + end_time - start_time
200 yv1= yv1 + a(4*j-3)*x1 + a(4*j-2)*x2
201 yv2= yv2 + a(4*j-1)*x1 + a(4*j )*x2
213 do blocknum = 0 , numofblockperthread - 1
214 blockindex = blocknum * numofthread + threadnum
215 do i = startpos(blockindex), endpos(blockindex)
218 yv1= d(4*i-3)*x1 + d(4*i-2)*x2
219 yv2= d(4*i-1)*x1 + d(4*i )*x2
227 yv1= yv1 + al(4*j-3)*x1 + al(4*j-2)*x2
228 yv2= yv2 + al(4*j-1)*x1 + al(4*j )*x2
236 yv1= yv1 + au(4*j-3)*x1 + au(4*j-2)*x2
237 yv2= yv2 + au(4*j-1)*x1 + au(4*j )*x2
252 time_ax = time_ax + end_time - start_time
255 end subroutine hecmw_matvec_22_inner
271 real(kind=
kreal) :: x(:), b(:), r(:)
274 real(kind=
kreal) :: time_ax
275 real(kind=
kreal),
optional :: commtime
277 integer(kind=kint) :: i
278 real(kind=
kreal) :: tcomm
282 if (
present(commtime)) commtime = commtime + tcomm
290 do i = 1, hecmat%N * 2
314 real(kind=
kreal) :: time_ax
315 real(kind=
kreal),
optional :: commtime
317 real(kind=
kreal) :: r(hecmat%NDOF*hecmat%NP)
318 real(kind=
kreal) :: bnorm2, rnorm2
319 real(kind=
kreal) :: tcomm
323 if (bnorm2 == 0.d0)
then
328 if (
present(commtime)) commtime = commtime + tcomm
343 real(kind=
kreal),
intent(in) :: x(:)
344 real(kind=
kreal),
intent(out) :: y(:)
345 real(kind=
kreal),
intent(inout) :: commtime
347 real(kind=
kreal) :: start_time, end_time
348 integer(kind=kint) :: i, j, jj, k, kk
353 commtime = commtime + end_time - start_time
362 do i= 1, hecmesh%nn_internal * hecmesh%n_dof
374 outer:
do i= 1, hecmesh%mpc%n_mpc
375 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
376 if (hecmesh%mpc%mpc_dof(j) > 2) cycle outer
378 k = hecmesh%mpc%mpc_index(i-1) + 1
379 kk = 2 * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
381 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
382 jj = 2 * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
383 y(kk) = y(kk) - hecmesh%mpc%mpc_val(j) * x(jj)
405 real(kind=
kreal),
intent(in) :: x(:)
406 real(kind=
kreal),
intent(out) :: y(:)
407 real(kind=
kreal),
intent(inout) :: commtime
409 real(kind=
kreal) :: start_time, end_time
410 integer(kind=kint) :: i, j, jj, k, kk
415 commtime = commtime + end_time - start_time
424 do i= 1, hecmesh%nn_internal * hecmesh%n_dof
436 outer:
do i= 1, hecmesh%mpc%n_mpc
437 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
438 if (hecmesh%mpc%mpc_dof(j) > 2) cycle outer
440 k = hecmesh%mpc%mpc_index(i-1) + 1
441 kk = 2 * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
443 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
444 jj = 2 * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
450 y(jj) = y(jj) - hecmesh%mpc%mpc_val(j) * x(kk)
472 real(kind=
kreal),
intent(in) :: x(:)
473 real(kind=
kreal),
intent(out) :: y(:), w(:)
474 real(kind=
kreal),
intent(inout) :: time_ax
475 real(kind=
kreal),
intent(inout) :: commtime
478 call hecmw_matvec_22_inner(hecmesh, hecmat, y, w, time_ax, commtime)
495 real(kind=
kreal),
intent(inout),
optional :: commtime
496 real(kind=
kreal),
allocatable :: w(:,:)
497 real(kind=
kreal),
pointer :: d(:)
498 integer(kind=kint) :: ip
499 real(kind=
kreal) :: start_time, end_time
500 allocate(w(2*hecmat%NP,2))
503 w(2*ip-1,1)= d(4*ip-3); w(2*ip-1,2)= d(4*ip-2);
504 w(2*ip-0,1)= d(4*ip-1); w(2*ip-0,2)= d(4*ip-0);
510 if (
present(commtime)) commtime = commtime + end_time - start_time
511 do ip= hecmat%N+1, hecmat%NP
512 d(4*ip-3)= w(2*ip-1,1); d(4*ip-2)= w(2*ip-1,2);
513 d(4*ip-1)= w(2*ip-0,1); d(4*ip-0)= w(2*ip-0,2);
Jagged Diagonal Matrix storage for vector processors. Original code was provided by JAMSTEC.
subroutine, public hecmw_jad_matvec(hecMESH, hecMAT, X, Y, COMMtime)
integer(kind=kint) function, public hecmw_jad_is_initialized()
integer(kind=kint) function, public hecmw_mat_get_flag_mpcmatvec(hecMAT)
subroutine, public hecmw_matresid_22(hecMESH, hecMAT, X, B, R, time_Ax, COMMtime)
subroutine, public hecmw_tvec_22(hecMESH, X, Y, COMMtime)
subroutine, public hecmw_mat_diag_sr_22(hecMESH, hecMAT, COMMtime)
subroutine, public hecmw_ttmattvec_22(hecMESH, hecMAT, X, Y, W, time_Ax, COMMtime)
real(kind=kreal) function, public hecmw_rel_resid_l2_22(hecMESH, hecMAT, time_Ax, COMMtime)
subroutine, public hecmw_matvec_22(hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
subroutine, public hecmw_ttvec_22(hecMESH, X, Y, COMMtime)
subroutine, public hecmw_matvec_22_set_async(hecMAT)
subroutine, public hecmw_matvec_22_unset_async
subroutine hecmw_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine, public hecmw_tuning_fx_calc_sector_cache(N, NDOF, sectorCacheSize0, sectorCacheSize1)
integer(kind=4), parameter kreal
real(kind=kreal) function hecmw_wtime()
subroutine hecmw_update_r(hecMESH, val, n, m)