33 real(kind=
kreal),
intent(inout) :: 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, x1, x2
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
103 blocknum = blocknum + 1
104 startpos(blocknum) = i + 1
105 if (blocknum == (numofblock - 1))
exit
110 do i= blocknum+1, numofblock-1
116 sectorcachesize0, sectorcachesize1)
126 if (
present(commtime)) commtime = commtime + end_time - start_time
144 yv1= yv1 + a(4*j-3)*x1 + a(4*j-2)*x2
145 yv2= yv2 + a(4*j-1)*x1 + a(4*j )*x2
163 do blocknum = 0 , numofblockperthread - 1
164 blockindex = blocknum * numofthread + threadnum
165 do i = startpos(blockindex), endpos(blockindex)
168 yv1= d(4*i-3)*x1 + d(4*i-2)*x2
169 yv2= d(4*i-1)*x1 + d(4*i )*x2
177 yv1= yv1 + al(4*j-3)*x1 + al(4*j-2)*x2
178 yv2= yv2 + al(4*j-1)*x1 + al(4*j )*x2
186 yv1= yv1 + au(4*j-3)*x1 + au(4*j-2)*x2
187 yv2= yv2 + au(4*j-1)*x1 + au(4*j )*x2
205 time_ax = time_ax + end_time - start_time
225 real(kind=
kreal),
intent(in) :: b(:)
226 real(kind=
kreal),
intent(inout) :: x(:)
227 real(kind=
kreal),
intent(out) :: r(:)
228 real(kind=
kreal),
intent(inout) :: time_ax
229 real(kind=
kreal),
intent(inout),
optional :: commtime
231 integer(kind=kint) :: i
232 real(kind=
kreal) :: tcomm
236 if (
present(commtime)) commtime = commtime + tcomm
244 do i = 1, hecmat%N * 2
267 real(kind=
kreal),
intent(inout) :: time_ax
268 real(kind=
kreal),
intent(inout),
optional :: commtime
270 real(kind=
kreal),
allocatable :: r(:)
271 real(kind=
kreal) :: bnorm2, rnorm2
272 real(kind=
kreal) :: tcomm
274 allocate(r(hecmat%NDOF*hecmat%NP))
278 hecmat%B, hecmat%B, bnorm2, tcomm)
279 if (bnorm2 == 0.d0)
then
286 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)