35 real(kind=
kreal),
intent(in) :: x(:)
36 real(kind=
kreal),
intent(out) :: y(:)
37 real(kind=
kreal),
intent(inout) :: time_ax
38 real(kind=
kreal),
intent(inout),
optional :: commtime
40 real(kind=
kreal) :: start_time, end_time, tcomm
41 integer(kind=kint) :: i, j, k, l, js, je, in
42 real(kind=
kreal) :: yv(hecmat%NDOF), xv(hecmat%NDOF)
44 integer(kind=kint) :: n, np, ndof, ndof2
45 integer(kind=kint),
pointer :: indexl(:), iteml(:), indexu(:), itemu(:), indexa(:), itema(:)
46 real(kind=
kreal),
pointer :: al(:), au(:), d(:), a(:)
49 integer,
parameter :: numofblockperthread = 100
50 logical,
save :: isfirst = .true.
51 integer,
save :: numofthread = 1
52 integer,
save,
allocatable :: startpos(:), endpos(:)
53 integer(kind=kint),
save :: sectorcachesize0, sectorcachesize1
54 integer(kind=kint) :: threadnum, blocknum, numofblock
55 integer(kind=kint) :: numofelement, elementcount, blockindex
56 real(kind=
kreal) :: numofelementperblock
64 time_ax = time_ax + end_time - start_time - tcomm
65 if (
present(commtime)) commtime = commtime + tcomm
70 indexl => hecmat%indexL
71 indexu => hecmat%indexU
72 indexa => hecmat%indexA
85 if (.not. isfirst)
then
86 numofblock = numofthread * numofblockperthread
87 if (endpos(numofblock-1) .ne. n-1)
then
88 deallocate(startpos, endpos)
94 numofblock = numofthread * numofblockperthread
95 allocate (startpos(0 : numofblock - 1), endpos(0 : numofblock - 1))
96 numofelement = n + indexl(n) + indexu(n)
97 numofelementperblock = dble(numofelement) / numofblock
100 startpos(blocknum) = 1
102 elementcount = elementcount + 1
103 elementcount = elementcount + (indexl(i) - indexl(i-1))
104 elementcount = elementcount + (indexu(i) - indexu(i-1))
105 if (elementcount > (blocknum + 1) * numofelementperblock)
then
109 blocknum = blocknum + 1
110 startpos(blocknum) = i + 1
111 if (blocknum == (numofblock - 1))
exit
118 do i= blocknum+1, numofblock-1
126 sectorcachesize0, sectorcachesize1)
136 if (
present(commtime)) commtime = commtime + end_time - start_time
145 xv(k) = x(ndof*(i-1)+k)
153 xv(k) = x(ndof*(in-1)+k)
157 yv(k)=yv(k)+a(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
162 y(ndof*(i-1)+k) = yv(k)
178 do blocknum = 0 , numofblockperthread - 1
179 blockindex = blocknum * numofthread + threadnum
180 do i = startpos(blockindex), endpos(blockindex)
182 xv(k) = x(ndof*(i-1)+k)
187 yv(k)=yv(k)+d(ndof2*(i-1)+(k-1)*ndof+l)*xv(l)
195 xv(k) = x(ndof*(in-1)+k)
199 yv(k)=yv(k)+al(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
208 xv(k) = x(ndof*(in-1)+k)
212 yv(k)=yv(k)+au(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
217 y(ndof*(i-1)+k) = yv(k)
231 time_ax = time_ax + end_time - start_time
248 real(kind=
kreal),
intent(in) :: x(:), b(:)
249 real(kind=
kreal),
intent(out) :: r(:)
250 real(kind=
kreal),
intent(inout) :: time_ax
251 real(kind=
kreal),
intent(inout),
optional :: commtime
253 integer(kind=kint) :: i
254 real(kind=
kreal) :: tcomm
258 if (
present(commtime)) commtime = commtime + tcomm
266 do i = 1, hecmat%N * hecmat%NDOF
289 real(kind=
kreal),
intent(inout) :: time_ax
290 real(kind=
kreal),
intent(inout),
optional :: commtime
292 real(kind=
kreal),
allocatable :: r(:)
293 real(kind=
kreal) :: bnorm2, rnorm2
294 real(kind=
kreal) :: tcomm
296 allocate(r(hecmat%NDOF*hecmat%NP))
300 hecmat%B, hecmat%B, bnorm2, tcomm)
301 if (bnorm2 == 0.d0)
then
308 if (
present(commtime)) commtime = commtime + tcomm
323 integer(kind=kint),
intent(in) :: ndof
324 real(kind=
kreal),
intent(in) :: x(:)
325 real(kind=
kreal),
intent(out) :: y(:)
326 real(kind=
kreal),
intent(inout) :: commtime
328 real(kind=
kreal) :: start_time, end_time
329 integer(kind=kint) :: i, j, jj, k, kk
334 commtime = commtime + end_time - start_time
343 do i= 1, hecmesh%nn_internal * ndof
355 outer:
do i= 1, hecmesh%mpc%n_mpc
356 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
357 if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
359 k = hecmesh%mpc%mpc_index(i-1) + 1
360 kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
362 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
363 jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
364 y(kk) = y(kk) - hecmesh%mpc%mpc_val(j) * x(jj)
386 integer(kind=kint),
intent(in) :: ndof
387 real(kind=
kreal),
intent(in) :: x(:)
388 real(kind=
kreal),
intent(out) :: y(:)
389 real(kind=
kreal),
intent(inout) :: commtime
391 real(kind=
kreal) :: start_time, end_time
392 integer(kind=kint) :: i, j, jj, k, kk
397 commtime = commtime + end_time - start_time
406 do i= 1, hecmesh%nn_internal * ndof
418 outer:
do i= 1, hecmesh%mpc%n_mpc
419 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
420 if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
422 k = hecmesh%mpc%mpc_index(i-1) + 1
423 kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
425 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
426 jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
432 y(jj) = y(jj) - hecmesh%mpc%mpc_val(j) * x(kk)
454 type (hecmwST_local_mesh),
intent(in) :: hecMESH
455 type (hecmwST_matrix),
intent(inout),
target :: hecMAT
456 real(kind=
kreal),
intent(inout),
optional :: commtime
457 real(kind=
kreal),
allocatable :: w(:,:)
458 real(kind=
kreal),
pointer :: d(:)
459 integer(kind=kint) :: ip, NDOF, i, j
460 real(kind=
kreal) :: start_time, end_time
462 allocate(w(ndof*hecmat%NP,ndof))
467 w(ndof*(ip-1)+i,j) = d(ndof*ndof*(ip-1)+(i-1)*ndof+j)
476 if (
present(commtime)) commtime = commtime + end_time - start_time
477 do ip= hecmat%N+1, hecmat%NP
480 d(ndof*ndof*(ip-1)+(i-1)*ndof+j) = w(ndof*(ip-1)+i,j)
490 type (hecmwST_matrix) :: hecMAT1, hecMAT2, hecMAT3
491 integer(kind=kint) :: i
493 do i = 1, hecmat1%NP*hecmat1%NDOF*hecmat1%NDOF
494 hecmat3%D(i) = hecmat1%D(i) + hecmat2%D(i)
497 do i = 1, hecmat1%NPU*hecmat1%NDOF*hecmat1%NDOF
498 hecmat3%AU(i) = hecmat1%AU(i) + hecmat2%AU(i)
501 do i = 1, hecmat1%NPL*hecmat1%NDOF*hecmat1%NDOF
502 hecmat3%AL(i) = hecmat1%AL(i) + hecmat2%AL(i)
509 type (hecmwST_matrix) :: hecMAT
510 real(kind=
kreal),
intent(in) :: alpha
511 integer(kind=kint) :: i
513 do i = 1, hecmat%NP*hecmat%NDOF*hecmat%NDOF
514 hecmat%D(i) = alpha*hecmat%D(i)
517 do i = 1, hecmat%NPU*hecmat%NDOF*hecmat%NDOF
518 hecmat%AU(i) = alpha*hecmat%AU(i)
521 do i = 1, hecmat%NPL*hecmat%NDOF*hecmat%NDOF
522 hecmat%AL(i) = alpha*hecmat%AL(i)
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()
subroutine hecmw_mat_multiple_nn(hecMAT, alpha)
subroutine hecmw_mat_add_nn(hecMAT1, hecMAT2, hecMAT3)
subroutine, public hecmw_ttvec_nn(hecMESH, ndof, X, Y, COMMtime)
real(kind=kreal) function, public hecmw_rel_resid_l2_nn(hecMESH, hecMAT, time_Ax, COMMtime)
subroutine, public hecmw_tvec_nn(hecMESH, ndof, X, Y, COMMtime)
subroutine, public hecmw_matvec_nn(hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
subroutine, public hecmw_matresid_nn(hecMESH, hecMAT, X, B, R, time_Ax, COMMtime)
subroutine hecmw_mat_diag_sr_nn(hecMESH, hecMAT, COMMtime)
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)