35 real(kind=
kreal),
intent(inout) :: 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) :: b(:)
249 real(kind=
kreal),
intent(inout) :: x(:)
250 real(kind=
kreal),
intent(out) :: r(:)
251 real(kind=
kreal),
intent(inout) :: time_ax
252 real(kind=
kreal),
intent(inout),
optional :: commtime
254 integer(kind=kint) :: i
255 real(kind=
kreal) :: tcomm
259 if (
present(commtime)) commtime = commtime + tcomm
267 do i = 1, hecmat%N * hecmat%NDOF
290 real(kind=
kreal),
intent(inout) :: time_ax
291 real(kind=
kreal),
intent(inout),
optional :: commtime
293 real(kind=
kreal),
allocatable :: r(:)
294 real(kind=
kreal) :: bnorm2, rnorm2
295 real(kind=
kreal) :: tcomm
297 allocate(r(hecmat%NDOF*hecmat%NP))
301 hecmat%B, hecmat%B, bnorm2, tcomm)
302 if (bnorm2 == 0.d0)
then
309 if (
present(commtime)) commtime = commtime + tcomm
324 integer(kind=kint),
intent(in) :: ndof
325 real(kind=
kreal),
intent(inout) :: x(:)
326 real(kind=
kreal),
intent(out) :: y(:)
327 real(kind=
kreal),
intent(inout) :: commtime
329 real(kind=
kreal) :: start_time, end_time
330 integer(kind=kint) :: i, j, jj, k, kk
335 commtime = commtime + end_time - start_time
344 do i= 1, hecmesh%nn_internal * ndof
356 outer:
do i= 1, hecmesh%mpc%n_mpc
357 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
358 if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
360 k = hecmesh%mpc%mpc_index(i-1) + 1
361 kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
363 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
364 jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
365 y(kk) = y(kk) - hecmesh%mpc%mpc_val(j) * x(jj)
387 integer(kind=kint),
intent(in) :: ndof
388 real(kind=
kreal),
intent(inout) :: x(:)
389 real(kind=
kreal),
intent(inout) :: y(:)
390 real(kind=
kreal),
intent(inout) :: commtime
392 real(kind=
kreal) :: start_time, end_time
393 integer(kind=kint) :: i, j, jj, k, kk
398 commtime = commtime + end_time - start_time
407 do i= 1, hecmesh%nn_internal * ndof
419 outer:
do i= 1, hecmesh%mpc%n_mpc
420 do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
421 if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
423 k = hecmesh%mpc%mpc_index(i-1) + 1
424 kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
426 do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
427 jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
433 y(jj) = y(jj) - hecmesh%mpc%mpc_val(j) * x(kk)
455 type (hecmwST_local_mesh),
intent(in) :: hecMESH
456 type (hecmwST_matrix),
intent(inout),
target :: hecMAT
457 real(kind=
kreal),
intent(inout),
optional :: commtime
458 real(kind=
kreal),
allocatable :: w(:,:)
459 real(kind=
kreal),
pointer :: d(:)
460 integer(kind=kint) :: ip, NDOF, i, j
461 real(kind=
kreal) :: start_time, end_time
463 allocate(w(ndof*hecmat%NP,ndof))
468 w(ndof*(ip-1)+i,j) = d(ndof*ndof*(ip-1)+(i-1)*ndof+j)
477 if (
present(commtime)) commtime = commtime + end_time - start_time
478 do ip= hecmat%N+1, hecmat%NP
481 d(ndof*ndof*(ip-1)+(i-1)*ndof+j) = w(ndof*(ip-1)+i,j)
491 type (hecmwST_matrix) :: hecMAT1, hecMAT2, hecMAT3
492 integer(kind=kint) :: i
494 do i = 1, hecmat1%NP*hecmat1%NDOF*hecmat1%NDOF
495 hecmat3%D(i) = hecmat1%D(i) + hecmat2%D(i)
498 do i = 1, hecmat1%NPU*hecmat1%NDOF*hecmat1%NDOF
499 hecmat3%AU(i) = hecmat1%AU(i) + hecmat2%AU(i)
502 do i = 1, hecmat1%NPL*hecmat1%NDOF*hecmat1%NDOF
503 hecmat3%AL(i) = hecmat1%AL(i) + hecmat2%AL(i)
510 type (hecmwST_matrix) :: hecMAT
511 real(kind=
kreal),
intent(in) :: alpha
512 integer(kind=kint) :: i
514 do i = 1, hecmat%NP*hecmat%NDOF*hecmat%NDOF
515 hecmat%D(i) = alpha*hecmat%D(i)
518 do i = 1, hecmat%NPU*hecmat%NDOF*hecmat%NDOF
519 hecmat%AU(i) = alpha*hecmat%AU(i)
522 do i = 1, hecmat%NPL*hecmat%NDOF*hecmat%NDOF
523 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)