33 real(kind=
kreal),
intent(in) :: x(:)
34 real(kind=
kreal),
intent(out) :: y(:)
35 real(kind=
kreal),
intent(inout) :: time_ax
36 real(kind=
kreal),
intent(inout),
optional :: commtime
38 real(kind=
kreal) :: start_time, end_time, tcomm
39 integer(kind=kint) :: i, j, js, je, in
40 real(kind=
kreal) :: yv1, yv2, yv3, yv4, x1, x2, x3, x4
42 integer(kind=kint) :: n, np
43 integer(kind=kint),
pointer :: indexl(:), iteml(:), indexu(:), itemu(:), indexa(:), itema(:)
44 real(kind=
kreal),
pointer :: al(:), au(:), d(:), a(:)
47 integer,
parameter :: numofblockperthread = 100
48 logical,
save :: isfirst = .true.
49 integer,
save :: numofthread = 1
50 integer,
save,
allocatable :: startpos(:), endpos(:)
51 integer(kind=kint),
save :: sectorcachesize0, sectorcachesize1
52 integer(kind=kint) :: threadnum, blocknum, numofblock
53 integer(kind=kint) :: numofelement, elementcount, blockindex
54 real(kind=
kreal) :: numofelementperblock
62 time_ax = time_ax + end_time - start_time - tcomm
63 if (
present(commtime)) commtime = commtime + tcomm
68 indexl => hecmat%indexL
69 indexu => hecmat%indexU
70 indexa => hecmat%indexA
81 if (.not. isfirst)
then
82 numofblock = numofthread * numofblockperthread
83 if (endpos(numofblock-1) .ne. n-1)
then
84 deallocate(startpos, endpos)
90 numofblock = numofthread * numofblockperthread
91 allocate (startpos(0 : numofblock - 1), endpos(0 : numofblock - 1))
92 numofelement = n + indexl(n) + indexu(n)
93 numofelementperblock = dble(numofelement) / numofblock
96 startpos(blocknum) = 1
98 elementcount = elementcount + 1
99 elementcount = elementcount + (indexl(i) - indexl(i-1))
100 elementcount = elementcount + (indexu(i) - indexu(i-1))
101 if (elementcount > (blocknum + 1) * numofelementperblock)
then
105 blocknum = blocknum + 1
106 startpos(blocknum) = i + 1
107 if (blocknum == (numofblock - 1))
exit
114 do i= blocknum+1, numofblock-1
122 sectorcachesize0, sectorcachesize1)
135 if (
present(commtime)) commtime = commtime + end_time - start_time
159 yv1= yv1 + a(16*j-15)*x1 + a(16*j-14)*x2 + a(16*j-13)*x3 + a(16*j-12)*x4
160 yv2= yv2 + a(16*j-11)*x1 + a(16*j-10)*x2 + a(16*j- 9)*x3 + a(16*j- 8)*x4
161 yv3= yv3 + a(16*j- 7)*x1 + a(16*j- 6)*x2 + a(16*j- 5)*x3 + a(16*j- 4)*x4
162 yv4= yv4 + a(16*j- 3)*x1 + a(16*j- 2)*x2 + a(16*j- 1)*x3 + a(16*j )*x4
182 do blocknum = 0 , numofblockperthread - 1
183 blockindex = blocknum * numofthread + threadnum
184 do i = startpos(blockindex), endpos(blockindex)
189 yv1= d(16*i-15)*x1 + d(16*i-14)*x2 + d(16*i-13)*x3 + d(16*i-12)*x4
190 yv2= d(16*i-11)*x1 + d(16*i-10)*x2 + d(16*i- 9)*x3 + d(16*i- 8)*x4
191 yv3= d(16*i- 7)*x1 + d(16*i- 6)*x2 + d(16*i- 5)*x3 + d(16*i- 4)*x4
192 yv4= d(16*i- 3)*x1 + d(16*i- 2)*x2 + d(16*i- 1)*x3 + d(16*i )*x4
202 yv1= yv1 + al(16*j-15)*x1 + al(16*j-14)*x2 + al(16*j-13)*x3 + al(16*j-12)*x4
203 yv2= yv2 + al(16*j-11)*x1 + al(16*j-10)*x2 + al(16*j- 9)*x3 + al(16*j- 8)*x4
204 yv3= yv3 + al(16*j- 7)*x1 + al(16*j- 6)*x2 + al(16*j- 5)*x3 + al(16*j- 4)*x4
205 yv4= yv4 + al(16*j- 3)*x1 + al(16*j- 2)*x2 + al(16*j- 1)*x3 + al(16*j )*x4
215 yv1= yv1 + au(16*j-15)*x1 + au(16*j-14)*x2 + au(16*j-13)*x3 + au(16*j-12)*x4
216 yv2= yv2 + au(16*j-11)*x1 + au(16*j-10)*x2 + au(16*j- 9)*x3 + au(16*j- 8)*x4
217 yv3= yv3 + au(16*j- 7)*x1 + au(16*j- 6)*x2 + au(16*j- 5)*x3 + au(16*j- 4)*x4
218 yv4= yv4 + au(16*j- 3)*x1 + au(16*j- 2)*x2 + au(16*j- 1)*x3 + au(16*j )*x4
236 time_ax = time_ax + end_time - start_time
251 real(kind=
kreal),
intent(in) :: x(:), b(:)
252 real(kind=
kreal),
intent(out) :: r(:)
253 real(kind=
kreal),
intent(inout) :: time_ax
254 real(kind=
kreal),
intent(inout),
optional :: commtime
256 integer(kind=kint) :: i
257 real(kind=
kreal) :: tcomm
261 if (
present(commtime)) commtime = commtime + tcomm
269 do i = 1, hecmat%N * 4
292 real(kind=
kreal),
intent(inout) :: time_ax
293 real(kind=
kreal),
intent(inout),
optional :: commtime
295 real(kind=
kreal),
allocatable :: r(:)
296 real(kind=
kreal) :: bnorm2, rnorm2
297 real(kind=
kreal) :: tcomm
299 allocate(r(hecmat%NDOF*hecmat%NP))
303 hecmat%B, hecmat%B, bnorm2, tcomm)
304 if (bnorm2 == 0.d0)
then
311 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_44(hecMESH, hecMAT, X, B, R, time_Ax, COMMtime)
subroutine, public hecmw_matvec_44(hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
real(kind=kreal) function, public hecmw_rel_resid_l2_44(hecMESH, hecMAT, 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)