27 integer(kind=kint) :: N
28 real(kind=
kreal),
pointer :: d(:) => null()
29 real(kind=
kreal),
pointer :: al(:) => null()
30 real(kind=
kreal),
pointer :: au(:) => null()
31 integer(kind=kint),
pointer :: indexL(:) => null()
32 integer(kind=kint),
pointer :: indexU(:) => null()
33 integer(kind=kint),
pointer :: itemL(:) => null()
34 integer(kind=kint),
pointer :: itemU(:) => null()
35 real(kind=
kreal),
pointer :: alu(:) => null()
37 integer(kind=kint) :: NColor
38 integer(kind=kint),
pointer :: COLORindex(:) => null()
39 integer(kind=kint),
pointer :: perm(:) => null()
40 integer(kind=kint),
pointer :: iperm(:) => null()
42 logical,
save :: isFirst = .true.
44 logical,
save :: INITIALIZED = .false.
51 integer(kind=kint ) :: npl, npu
52 integer(kind=kint ) :: ncolor_in
53 real (kind=
kreal) :: sigma_diag
54 real (kind=
kreal) :: alutmp(hecmat%NDOF,hecmat%NDOF), pw(hecmat%NDOF)
55 integer(kind=kint ) :: ii, i, j, k, ndof, ndof2
56 integer(kind=kint ) :: nthreads = 1
57 integer(kind=kint ),
allocatable :: perm_tmp(:)
64 if (hecmat%Iarray(98) == 1)
then
66 else if (hecmat%Iarray(97) == 1)
then
85 allocate(colorindex(0:n), perm_tmp(n), perm(n), iperm(n))
87 hecmat%indexU, hecmat%itemU, perm_tmp, iperm)
90 hecmat%indexU, hecmat%itemU, perm_tmp, &
91 ncolor_in, ncolor, colorindex, perm, iperm)
96 if (nthreads == 1)
then
98 allocate(colorindex(0:1), perm(n), iperm(n))
106 allocate(colorindex(0:n), perm_tmp(n), perm(n), iperm(n))
108 hecmat%indexU, hecmat%itemU, perm_tmp, iperm)
111 hecmat%indexU, hecmat%itemU, perm_tmp, &
112 ncolor_in, ncolor, colorindex, perm, iperm)
119 npl = hecmat%indexL(n)
120 npu = hecmat%indexU(n)
121 allocate(indexl(0:n), indexu(0:n), iteml(npl), itemu(npu))
123 hecmat%indexL, hecmat%indexU, hecmat%itemL, hecmat%itemU, &
124 indexl, indexu, iteml, itemu)
128 allocate(d(ndof2*n), al(ndof2*npl), au(ndof2*npu))
130 hecmat%indexL, hecmat%indexU, hecmat%itemL, hecmat%itemU, &
131 hecmat%AL, hecmat%AU, hecmat%D, &
132 indexl, indexu, iteml, itemu, al, au, d)
138 allocate(alu(ndof2*n))
155 alutmp(i,j) = alu(ndof2*(ii-1)+(i-1)*ndof+j)
156 if (i==j) alutmp(i,j)=alutmp(i,j)*sigma_diag
160 alutmp(k,k)= 1.d0/alutmp(k,k)
162 alutmp(i,k)= alutmp(i,k) * alutmp(k,k)
164 pw(j)= alutmp(i,j) - alutmp(i,k)*alutmp(k,j)
173 alu(ndof2*(ii-1)+(i-1)*ndof+j)= alutmp(i,j)
187 hecmat%Iarray(98) = 0
188 hecmat%Iarray(97) = 0
197 real(kind=
kreal),
intent(inout) :: zp(:)
198 integer(kind=kint) :: ic, i, iold, j, isl, iel, isu, ieu, k, ndof, ndof2, idof,jdof
199 real(kind=
kreal) :: sw(ndof), x(ndof)
202 integer(kind=kint),
parameter :: numofblockperthread = 100
203 integer(kind=kint),
save :: numofthread = 1, numofblock
204 integer(kind=kint),
save,
allocatable :: ictoblockindex(:)
205 integer(kind=kint),
save,
allocatable :: blockindextocolorindex(:)
206 integer(kind=kint),
save :: sectorcachesize0, sectorcachesize1
207 integer(kind=kint) :: blockindex, elementcount, numofelement, ii
208 real(kind=
kreal) :: numofelementperblock
209 integer(kind=kint) :: my_rank
215 numofblock = numofthread * numofblockperthread
216 if (
allocated(ictoblockindex))
deallocate(ictoblockindex)
217 if (
allocated(blockindextocolorindex))
deallocate(blockindextocolorindex)
218 allocate (ictoblockindex(0:ncolor), &
219 blockindextocolorindex(0:numofblock + ncolor))
220 numofelement = n + indexl(n) + indexu(n)
221 numofelementperblock = dble(numofelement) / numofblock
224 ictoblockindex(0) = 0
225 blockindextocolorindex = -1
226 blockindextocolorindex(0) = 0
235 do i = colorindex(ic-1)+1, colorindex(ic)
236 elementcount = elementcount + 1
237 elementcount = elementcount + (indexl(i) - indexl(i-1))
238 elementcount = elementcount + (indexu(i) - indexu(i-1))
239 if (elementcount > ii * numofelementperblock &
240 .or. i == colorindex(ic))
then
242 blockindex = blockindex + 1
243 blockindextocolorindex(blockindex) = i
248 ictoblockindex(ic) = blockindex
250 numofblock = blockindex
253 sectorcachesize0, sectorcachesize1 )
277 do i = colorindex(ic-1)+1, colorindex(ic)
280 do blockindex = ictoblockindex(ic-1)+1, ictoblockindex(ic)
281 do i = blockindextocolorindex(blockindex-1)+1, &
282 blockindextocolorindex(blockindex)
286 sw(idof) = zp(ndof*(iold-1)+idof)
293 x(idof) = zp(ndof*(k-1)+idof)
297 sw(idof) = sw(idof) - al(ndof2*(j-1)+ndof*(idof-1)+jdof)*x(jdof)
305 x(idof) = x(idof) - alu(ndof2*(i-1)+ndof*(idof-1)+jdof )*x(jdof)
308 do idof = ndof, 1, -1
309 do jdof = ndof, idof+1, -1
310 x(idof) = x(idof) - alu(ndof2*(i-1)+ndof*(idof-1)+jdof)*x(jdof)
312 x(idof) = alu(ndof2*(i-1)+(ndof+1)*(idof-1)+1)*x(idof)
314 zp(ndof*(iold-1)+1:ndof*(iold-1)+ndof) = x(1:ndof)
331 do i = colorindex(ic-1)+1, colorindex(ic)
334 do blockindex = ictoblockindex(ic), ictoblockindex(ic-1)+1, -1
335 do i = blockindextocolorindex(blockindex), &
336 blockindextocolorindex(blockindex-1)+1, -1
348 x(idof) = zp(ndof*(k-1)+idof)
352 sw(idof) = sw(idof) + au(ndof2*(j-1)+ndof*(idof-1)+jdof)*x(jdof)
360 x(idof) = x(idof) - alu(ndof2*(i-1)+ndof*(idof-1)+k)*x(k)
363 do idof = ndof, 1, -1
364 do k = ndof, idof+1, -1
365 x(idof) = x(idof) - alu(ndof2*(i-1)+ndof*(idof-1)+k)*x(k)
367 x(idof) = alu(ndof2*(i-1)+(ndof+1)*(idof-1)+1)*x(idof)
371 zp(ndof*(iold-1)+idof) = zp(ndof*(iold-1)+idof) - x(idof)
396 integer(kind=kint ) :: nthreads = 1
400 if (
associated(colorindex))
deallocate(colorindex)
401 if (
associated(perm))
deallocate(perm)
402 if (
associated(iperm))
deallocate(iperm)
403 if (
associated(alu))
deallocate(alu)
404 if (nthreads >= 1)
then
405 if (
associated(d))
deallocate(d)
406 if (
associated(al))
deallocate(al)
407 if (
associated(au))
deallocate(au)
408 if (
associated(indexl))
deallocate(indexl)
409 if (
associated(indexu))
deallocate(indexu)
410 if (
associated(iteml))
deallocate(iteml)
411 if (
associated(itemu))
deallocate(itemu)
424 initialized = .false.
real(kind=kreal) function, public hecmw_mat_get_sigma_diag(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_ncolor_in(hecMAT)
subroutine, public hecmw_matrix_reorder_values(N, NDOF, perm, iperm, indexL, indexU, itemL, itemU, AL, AU, D, indexLp, indexUp, itemLp, itemUp, ALp, AUp, Dp)
subroutine, public hecmw_matrix_reorder_renum_item(N, perm, indexXp, itemXp)
subroutine, public hecmw_matrix_reorder_profile(N, perm, iperm, indexL, indexU, itemL, itemU, indexLp, indexUp, itemLp, itemUp)
subroutine, public hecmw_precond_ssor_nn_setup(hecMAT)
subroutine, public hecmw_precond_ssor_nn_clear(hecMAT)
subroutine, public hecmw_precond_ssor_nn_apply(ZP, NDOF)
subroutine, public hecmw_tuning_fx_calc_sector_cache(N, NDOF, sectorCacheSize0, sectorCacheSize1)
integer(kind=4), parameter kreal
integer(kind=kint) function hecmw_comm_get_rank()
subroutine, public hecmw_matrix_ordering_rcm(N, indexL, itemL, indexU, itemU, perm, iperm)
subroutine, public hecmw_matrix_ordering_mc(N, indexL, itemL, indexU, itemU, perm_cur, ncolor_in, ncolor_out, COLORindex, perm, iperm)