31 real(kind=
kreal),
intent(in) :: x(:)
32 real(kind=
kreal),
intent(out) :: y(:)
33 real(kind=
kreal),
intent(inout) :: time_ax
34 real(kind=
kreal),
intent(inout),
optional :: commtime
36 real(kind=
kreal) :: start_time, end_time, tcomm
37 integer(kind=kint) :: i, j, js, je, in
38 real(kind=
kreal) :: yv1, yv2, x1, x2
40 integer(kind=kint) :: n, np
41 integer(kind=kint),
pointer :: indexl(:), iteml(:), indexu(:), itemu(:), indexa(:), itema(:)
42 real(kind=
kreal),
pointer :: al(:), au(:), d(:), a(:)
45 integer,
parameter :: numofblockperthread = 100
46 logical,
save :: isfirst = .true.
47 integer,
save :: numofthread = 1
48 integer,
save,
allocatable :: startpos(:), endpos(:)
49 integer(kind=kint),
save :: sectorcachesize0, sectorcachesize1
50 integer(kind=kint) :: threadnum, blocknum, numofblock
51 integer(kind=kint) :: numofelement, elementcount, blockindex
52 real(kind=
kreal) :: numofelementperblock
60 time_ax = time_ax + end_time - start_time - tcomm
61 if (
present(commtime)) commtime = commtime + tcomm
66 indexl => hecmat%indexL
67 indexu => hecmat%indexU
68 indexa => hecmat%indexA
79 if (.not. isfirst)
then
80 numofblock = numofthread * numofblockperthread
81 if (endpos(numofblock-1) .ne. n-1)
then
82 deallocate(startpos, endpos)
88 numofblock = numofthread * numofblockperthread
89 allocate (startpos(0 : numofblock - 1), endpos(0 : numofblock - 1))
90 numofelement = n + indexl(n) + indexu(n)
91 numofelementperblock = dble(numofelement) / numofblock
94 startpos(blocknum) = 1
96 elementcount = elementcount + 1
97 elementcount = elementcount + (indexl(i) - indexl(i-1))
98 elementcount = elementcount + (indexu(i) - indexu(i-1))
99 if (elementcount > (blocknum + 1) * numofelementperblock)
then
101 blocknum = blocknum + 1
102 startpos(blocknum) = i + 1
103 if (blocknum == (numofblock - 1))
exit
108 do i= blocknum+1, numofblock-1
114 sectorcachesize0, sectorcachesize1)
124 if (
present(commtime)) commtime = commtime + end_time - start_time
142 yv1= yv1 + a(4*j-3)*x1 + a(4*j-2)*x2
143 yv2= yv2 + a(4*j-1)*x1 + a(4*j )*x2
161 do blocknum = 0 , numofblockperthread - 1
162 blockindex = blocknum * numofthread + threadnum
163 do i = startpos(blockindex), endpos(blockindex)
166 yv1= d(4*i-3)*x1 + d(4*i-2)*x2
167 yv2= d(4*i-1)*x1 + d(4*i )*x2
175 yv1= yv1 + al(4*j-3)*x1 + al(4*j-2)*x2
176 yv2= yv2 + al(4*j-1)*x1 + al(4*j )*x2
184 yv1= yv1 + au(4*j-3)*x1 + au(4*j-2)*x2
185 yv2= yv2 + au(4*j-1)*x1 + au(4*j )*x2
200 time_ax = time_ax + end_time - start_time
219 real(kind=
kreal) :: x(:), b(:), r(:)
222 real(kind=
kreal) :: time_ax
223 real(kind=
kreal),
optional :: commtime
225 integer(kind=kint) :: i
226 real(kind=
kreal) :: tcomm
230 if (
present(commtime)) commtime = commtime + tcomm
238 do i = 1, hecmat%N * 2
262 real(kind=
kreal) :: time_ax
263 real(kind=
kreal),
optional :: commtime
265 real(kind=
kreal) :: r(hecmat%NDOF*hecmat%NP)
266 real(kind=
kreal) :: bnorm2, rnorm2
267 real(kind=
kreal) :: tcomm
271 if (bnorm2 == 0.d0)
then
276 if (
present(commtime)) commtime = commtime + tcomm
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, public hecmw_matresid_22(hecMESH, hecMAT, X, B, R, 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 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)