FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
hecmw_solver_las_nn.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
5 
7  use hecmw_util
8  implicit none
9 
10  private
11 
12  public :: hecmw_matvec_nn
15  public :: hecmw_matresid_nn
16  public :: hecmw_rel_resid_l2_nn
17  public :: hecmw_tvec_nn
18  public :: hecmw_ttvec_nn
19  public :: hecmw_ttmattvec_nn
20  public :: hecmw_mat_diag_sr_nn
21  public :: hecmw_mat_add_nn
22  public :: hecmw_mat_multiple_nn
23 
24  ! ! for communication hiding in matvec
25  ! integer(kind=kint), save, allocatable :: index_o(:), item_o(:)
26  ! real(kind=kreal), save, allocatable :: A_o(:)
27  logical, save :: async_matvec_flg = .false.
28 
29 contains
30 
31  !C
32  !C***
33  !C*** hecmw_matvec_nn
34  !C***
35  !C
36  subroutine hecmw_matvec_nn (hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
37  use hecmw_util
39  implicit none
40  type (hecmwst_local_mesh), intent(in) :: hecmesh
41  type (hecmwst_matrix), intent(in), target :: hecmat
42  real(kind=kreal), intent(in) :: x(:)
43  real(kind=kreal), intent(out) :: y(:)
44  real(kind=kreal), intent(inout) :: time_ax
45  real(kind=kreal), intent(inout), optional :: commtime
46 
47  real(kind=kreal) :: tcomm
48  real(kind=kreal), allocatable :: wk(:)
49 
50  tcomm = 0.d0
51 
52  if (hecmw_mat_get_flag_mpcmatvec(hecmat) /= 0) then
53  allocate(wk(hecmat%NP * hecmat%NDOF))
54  call hecmw_ttmattvec_nn(hecmesh, hecmat, x, y, wk, time_ax, tcomm)
55  deallocate(wk)
56  else
57  call hecmw_matvec_nn_inner(hecmesh, hecmat, x, y, time_ax, tcomm)
58  endif
59 
60  if (present(commtime)) commtime = commtime + tcomm
61  end subroutine hecmw_matvec_nn
62 
63  !C
64  !C***
65  !C*** hecmw_matvec_nn_set_async
66  !C***
67  !C
68  subroutine hecmw_matvec_nn_set_async (hecMAT)
69  use hecmw_util
70  implicit none
71  type (hecmwst_matrix), intent(in) :: hecmat
72  ! integer(kind=kint) :: i, j, jS, jE, idx, in
73 
74  ! allocate(index_o(0:hecMAT%N))
75  ! index_o(0) = 0
76  ! do i = 1, hecMAT%N
77  ! jS= hecMAT%indexU(i-1) + 1
78  ! jE= hecMAT%indexU(i )
79  ! idx = index_o(i-1)
80  ! do j= jS, jE
81  ! in = hecMAT%itemU(j)
82  ! if (in <= hecMAT%N) cycle
83  ! idx = idx + 1
84  ! enddo
85  ! index_o(i) = idx
86  ! enddo
87  ! allocate(item_o(idx))
88  ! allocate(A_o(idx*9))
89  ! do i = 1, hecMAT%N
90  ! jS= hecMAT%indexU(i-1) + 1
91  ! jE= hecMAT%indexU(i )
92  ! idx = index_o(i-1)
93  ! do j= jS, jE
94  ! in = hecMAT%itemU(j)
95  ! if (in <= hecMAT%N) cycle
96  ! idx = idx + 1
97  ! item_o(idx) = hecMAT%itemU(j) - hecMAT%N
98  ! A_o(9*idx-8:9*idx) = hecMAT%AU(9*j-8:9*j)
99  ! enddo
100  ! enddo
101  ! async_matvec_flg = .true.
102  end subroutine hecmw_matvec_nn_set_async
103 
104  !C
105  !C***
106  !C*** hecmw_matvec_nn_unset_async
107  !C***
108  !C
110  implicit none
111  ! if (allocated(index_o)) deallocate(index_o)
112  ! if (allocated(item_o)) deallocate(item_o)
113  ! if (allocated(A_o)) deallocate(A_o)
114  ! async_matvec_flg = .false.
115  end subroutine hecmw_matvec_nn_unset_async
116 
117  !C
118  !C***
119  !C*** hecmw_matvec_nn_inner ( private subroutine )
120  !C***
121  !C
122  subroutine hecmw_matvec_nn_inner (hecMESH, hecMAT, X, Y, time_Ax, COMMtime)
123  use hecmw_util
124  use m_hecmw_comm_f
126  use hecmw_jad_type
127  use hecmw_tuning_fx
128  !$ use omp_lib
129 
130  implicit none
131  type (hecmwst_local_mesh), intent(in) :: hecmesh
132  type (hecmwst_matrix), intent(in), target :: hecmat
133  real(kind=kreal), intent(in) :: x(:)
134  real(kind=kreal), intent(out) :: y(:)
135  real(kind=kreal), intent(inout) :: time_ax
136  real(kind=kreal), intent(inout), optional :: commtime
137 
138  real(kind=kreal) :: start_time, end_time, tcomm
139  integer(kind=kint) :: i, j, k, l, js, je, in
140  real(kind=kreal) :: yv(hecmat%NDOF), xv(hecmat%NDOF)
141 
142  integer(kind=kint) :: n, np, ndof, ndof2
143  integer(kind=kint), pointer :: indexl(:), iteml(:), indexu(:), itemu(:), indexa(:), itema(:)
144  real(kind=kreal), pointer :: al(:), au(:), d(:), a(:)
145 
146  ! added for turning >>>
147  integer, parameter :: numofblockperthread = 100
148  logical, save :: isfirst = .true.
149  integer, save :: numofthread = 1
150  integer, save, allocatable :: startpos(:), endpos(:)
151  integer(kind=kint), save :: sectorcachesize0, sectorcachesize1
152  integer(kind=kint) :: threadnum, blocknum, numofblock
153  integer(kind=kint) :: numofelement, elementcount, blockindex
154  real(kind=kreal) :: numofelementperblock
155  ! <<< added for turning
156 
157  if (hecmw_jad_is_initialized().ne.0) then
158  tcomm = 0.d0
159  start_time = hecmw_wtime()
160  call hecmw_jad_matvec(hecmesh, hecmat, x, y, tcomm)
161  end_time = hecmw_wtime()
162  time_ax = time_ax + end_time - start_time - tcomm
163  if (present(commtime)) commtime = commtime + tcomm
164  else
165 
166  n = hecmat%N
167  np = hecmat%NP
168  indexl => hecmat%indexL
169  indexu => hecmat%indexU
170  indexa => hecmat%indexA
171  iteml => hecmat%itemL
172  itemu => hecmat%itemU
173  itema => hecmat%itemA
174  al => hecmat%AL
175  au => hecmat%AU
176  d => hecmat%D
177  a => hecmat%A
178  ndof = hecmat%NDOF
179  ndof2 = ndof*ndof
180 
181  ! added for turning >>>
182 #ifndef _OPENACC
183  if (.not. isfirst) then
184  numofblock = numofthread * numofblockperthread
185  if (endpos(numofblock-1) .ne. n-1) then
186  deallocate(startpos, endpos)
187  isfirst = .true.
188  endif
189  endif
190  if (isfirst) then
191  !$ numOfThread = omp_get_max_threads()
192  numofblock = numofthread * numofblockperthread
193  allocate (startpos(0 : numofblock - 1), endpos(0 : numofblock - 1))
194  numofelement = n + indexl(n) + indexu(n)
195  numofelementperblock = dble(numofelement) / numofblock
196  blocknum = 0
197  elementcount = 0
198  startpos(blocknum) = 1
199  do i= 1, n
200  elementcount = elementcount + 1
201  elementcount = elementcount + (indexl(i) - indexl(i-1))
202  elementcount = elementcount + (indexu(i) - indexu(i-1))
203  if (elementcount > (blocknum + 1) * numofelementperblock) then
204  endpos(blocknum) = i
205  ! write(9000+hecMESH%my_rank,*) mod(blockNum, numOfThread), &
206  ! startPos(blockNum), endPos(blockNum)
207  blocknum = blocknum + 1
208  startpos(blocknum) = i + 1
209  if (blocknum == (numofblock - 1)) exit
210  endif
211  enddo
212  endpos(blocknum) = n
213  ! write(9000+hecMESH%my_rank,*) mod(blockNum, numOfThread), &
214  ! startPos(blockNum), endPos(blockNum)
215  ! for irregular data
216  do i= blocknum+1, numofblock-1
217  startpos(i) = n
218  endpos(i) = n-1
219  ! write(9000+hecMESH%my_rank,*) mod(i, numOfThread), &
220  ! startPos(i), endPos(i)
221  end do
222 
223  call hecmw_tuning_fx_calc_sector_cache(np, ndof, &
224  sectorcachesize0, sectorcachesize1)
225 
226  isfirst = .false.
227  endif
228 #endif
229  ! <<< added for turning
230 
231  start_time= hecmw_wtime()
232  ! if (async_matvec_flg) then
233  ! call hecmw_update_3_R_async (hecMESH, X, NP, ireq)
234  ! else
235  call hecmw_update_r (hecmesh, x, np, ndof)
236  ! endif
237  end_time= hecmw_wtime()
238  if (present(commtime)) commtime = commtime + end_time - start_time
239 
240  start_time = hecmw_wtime()
241 
242  !call fapp_start("loopInMatvec33", 1, 0)
243  !call start_collection("loopInMatvec33")
244 
245  !OCL CACHE_SECTOR_SIZE(sectorCacheSize0,sectorCacheSize1)
246  !OCL CACHE_SUBSECTOR_ASSIGN(X)
247 
248 #ifdef _OPENACC
249  !$acc kernels
250  !$acc loop independent
251  do i = 1, n
252  do k=1,ndof
253  xv(k) = x(ndof*(i-1)+k)
254  end do
255  yv(:)=0.0d0
256  js= indexa(i) + 1
257  je= indexa(i+1)
258  do j= js, je
259  in = itema(j)
260  do k=1,ndof
261  xv(k) = x(ndof*(in-1)+k)
262  end do
263  do k=1,ndof
264  do l=1,ndof
265  yv(k)=yv(k)+a(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
266  end do
267  end do
268  enddo
269  do k=1,ndof
270  y(ndof*(i-1)+k) = yv(k)
271  end do
272  enddo
273  !$acc end kernels
274 #else
275  !$OMP PARALLEL DEFAULT(NONE) &
276  !$OMP&PRIVATE(i,XV,YV,jS,jE,j,k,l,in,threadNum,blockNum,blockIndex) &
277  !$OMP&SHARED(D,AL,AU,indexL,itemL,indexU,itemU,X,Y,startPos,endPos,numOfThread,N,NDOF,NDOF2,async_matvec_flg)
278  threadnum = 0
279  !$ threadNum = omp_get_thread_num()
280  do blocknum = 0 , numofblockperthread - 1
281  blockindex = blocknum * numofthread + threadnum
282  do i = startpos(blockindex), endpos(blockindex)
283  do k=1,ndof
284  xv(k) = x(ndof*(i-1)+k)
285  end do
286  yv(:)=0.0d0
287  do k=1,ndof
288  do l=1,ndof
289  yv(k)=yv(k)+d(ndof2*(i-1)+(k-1)*ndof+l)*xv(l)
290  end do
291  end do
292  js= indexl(i-1) + 1
293  je= indexl(i )
294  do j= js, je
295  in = iteml(j)
296  do k=1,ndof
297  xv(k) = x(ndof*(in-1)+k)
298  end do
299  do k=1,ndof
300  do l=1,ndof
301  yv(k)=yv(k)+al(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
302  end do
303  end do
304  enddo
305  js= indexu(i-1) + 1
306  je= indexu(i )
307  do j= js, je
308  in = itemu(j)
309  ! if (async_matvec_flg .and. in > N) cycle
310  do k=1,ndof
311  xv(k) = x(ndof*(in-1)+k)
312  end do
313  do k=1,ndof
314  do l=1,ndof
315  yv(k)=yv(k)+au(ndof2*(j-1)+(k-1)*ndof+l)*xv(l)
316  end do
317  end do
318  enddo
319  do k=1,ndof
320  y(ndof*(i-1)+k) = yv(k)
321  end do
322  enddo
323  enddo
324  !$OMP END PARALLEL
325 #endif
326 
327  !OCL END_CACHE_SUBSECTOR
328  !OCL END_CACHE_SECTOR_SIZE
329 
330  !call stop_collection("loopInMatvec33")
331  !call fapp_stop("loopInMatvec33", 1, 0)
332 
333  end_time = hecmw_wtime()
334  time_ax = time_ax + end_time - start_time
335  endif
336 
337  end subroutine hecmw_matvec_nn_inner
338 
339 
340 
341  !C
342  !C***
343  !C*** hecmw_matresid_nn
344  !C***
345  !C
346  subroutine hecmw_matresid_nn (hecMESH, hecMAT, X, B, R, time_Ax, COMMtime)
347  use hecmw_util
348  implicit none
349  type (hecmwst_local_mesh), intent(in) :: hecmesh
350  type (hecmwst_matrix), intent(in) :: hecmat
351  real(kind=kreal), intent(in) :: x(:), b(:)
352  real(kind=kreal), intent(out) :: r(:)
353  real(kind=kreal), intent(inout) :: time_ax
354  real(kind=kreal), intent(inout), optional :: commtime
355 
356  integer(kind=kint) :: i
357  real(kind=kreal) :: tcomm
358 
359  tcomm = 0.d0
360  call hecmw_matvec_nn (hecmesh, hecmat, x, r, time_ax, tcomm)
361  if (present(commtime)) commtime = commtime + tcomm
362 #ifdef _OPENACC
363  !$acc kernels
364  !$acc loop independent
365 #else
366  !$omp parallel default(none),private(i),shared(hecMAT,R,B)
367  !$omp do
368 #endif
369  do i = 1, hecmat%N * hecmat%NDOF
370  r(i) = b(i) - r(i)
371  enddo
372 #ifdef _OPENACC
373  !$acc end kernels
374 #else
375  !$omp end do
376  !$omp end parallel
377 #endif
378  end subroutine hecmw_matresid_nn
379 
380  !C
381  !C***
382  !C*** hecmw_rel_resid_L2_nn
383  !C***
384  !C
385  function hecmw_rel_resid_l2_nn (hecMESH, hecMAT, time_Ax, COMMtime)
386  use hecmw_util
388  implicit none
389  real(kind=kreal) :: hecmw_rel_resid_l2_nn
390  type ( hecmwst_local_mesh ), intent(in) :: hecmesh
391  type ( hecmwst_matrix ), intent(in) :: hecmat
392  real(kind=kreal), intent(inout) :: time_ax
393  real(kind=kreal), intent(inout), optional :: commtime
394 
395  real(kind=kreal), allocatable :: r(:)
396  real(kind=kreal) :: bnorm2, rnorm2
397  real(kind=kreal) :: tcomm
398 
399  allocate(r(hecmat%NDOF*hecmat%NP))
400 
401  tcomm = 0.d0
402  call hecmw_innerproduct_r(hecmesh, hecmat%NDOF, &
403  hecmat%B, hecmat%B, bnorm2, tcomm)
404  if (bnorm2 == 0.d0) then
405  bnorm2 = 1.d0
406  endif
407  call hecmw_matresid_nn(hecmesh, hecmat, hecmat%X, hecmat%B, r, time_ax, tcomm)
408  call hecmw_innerproduct_r(hecmesh, hecmat%NDOF, r, r, rnorm2, tcomm)
409  hecmw_rel_resid_l2_nn = sqrt(rnorm2 / bnorm2)
410 
411  if (present(commtime)) commtime = commtime + tcomm
412 
413  deallocate(r)
414  end function hecmw_rel_resid_l2_nn
415 
416  !C
417  !C***
418  !C*** hecmw_Tvec_nn
419  !C***
420  !C
421  subroutine hecmw_tvec_nn (hecMESH, ndof, X, Y, COMMtime)
422  use hecmw_util
423  use m_hecmw_comm_f
424  implicit none
425  type (hecmwst_local_mesh), intent(in) :: hecmesh
426  integer(kind=kint), intent(in) :: ndof
427  real(kind=kreal), intent(in) :: x(:)
428  real(kind=kreal), intent(out) :: y(:)
429  real(kind=kreal), intent(inout) :: commtime
430 
431  real(kind=kreal) :: start_time, end_time
432  integer(kind=kint) :: i, j, jj, k, kk
433 
434  start_time= hecmw_wtime()
435  call hecmw_update_r (hecmesh, x, hecmesh%n_node, ndof)
436  end_time= hecmw_wtime()
437  commtime = commtime + end_time - start_time
438 
439 #ifdef _OPENACC
440  !$acc kernels
441  !$acc loop independent
442 #else
443  !$omp parallel default(none),private(i,k,kk,j,jj),shared(hecMESH,X,Y),firstprivate(ndof)
444  !$omp do
445 #endif
446  do i= 1, hecmesh%nn_internal * ndof
447  y(i)= x(i)
448  enddo
449 #ifndef _OPENACC
450  !$omp end do
451 #endif
452 
453 #ifdef _OPENACC
454  !$acc loop independent
455 #else
456  !$omp do
457 #endif
458  outer: do i= 1, hecmesh%mpc%n_mpc
459  do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
460  if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
461  enddo
462  k = hecmesh%mpc%mpc_index(i-1) + 1
463  kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
464  y(kk) = 0.d0
465  do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
466  jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
467  y(kk) = y(kk) - hecmesh%mpc%mpc_val(j) * x(jj)
468  enddo
469  enddo outer
470 #ifdef _OPENACC
471  !$acc end kernels
472 #else
473  !$omp end do
474  !$omp end parallel
475 #endif
476 
477  end subroutine hecmw_tvec_nn
478 
479  !C
480  !C***
481  !C*** hecmw_Ttvec_nn
482  !C***
483  !C
484  subroutine hecmw_ttvec_nn (hecMESH, ndof, X, Y, COMMtime)
485  use hecmw_util
486  use m_hecmw_comm_f
487  implicit none
488  type (hecmwst_local_mesh), intent(in) :: hecmesh
489  integer(kind=kint), intent(in) :: ndof
490  real(kind=kreal), intent(in) :: x(:)
491  real(kind=kreal), intent(out) :: y(:)
492  real(kind=kreal), intent(inout) :: commtime
493 
494  real(kind=kreal) :: start_time, end_time
495  integer(kind=kint) :: i, j, jj, k, kk
496 
497  start_time= hecmw_wtime()
498  call hecmw_update_r (hecmesh, x, hecmesh%n_node,ndof)
499  end_time= hecmw_wtime()
500  commtime = commtime + end_time - start_time
501 
502 #ifdef _OPENACC
503  !$acc kernels
504  !$acc loop independent
505 #else
506  !$omp parallel default(none),private(i,k,kk,j,jj),shared(hecMESH,X,Y),firstprivate(ndof)
507  !$omp do
508 #endif
509  do i= 1, hecmesh%nn_internal * ndof
510  y(i)= x(i)
511  enddo
512 #ifndef _OPENACC
513  !$omp end do
514 #endif
515 
516 #ifdef _OPENACC
517  !$acc loop independent
518 #else
519  !$omp do
520 #endif
521  outer: do i= 1, hecmesh%mpc%n_mpc
522  do j= hecmesh%mpc%mpc_index(i-1) + 1, hecmesh%mpc%mpc_index(i)
523  if (hecmesh%mpc%mpc_dof(j) > ndof) cycle outer
524  enddo
525  k = hecmesh%mpc%mpc_index(i-1) + 1
526  kk = ndof * (hecmesh%mpc%mpc_item(k) - 1) + hecmesh%mpc%mpc_dof(k)
527  y(kk) = 0.d0
528  do j= hecmesh%mpc%mpc_index(i-1) + 2, hecmesh%mpc%mpc_index(i)
529  jj = ndof * (hecmesh%mpc%mpc_item(j) - 1) + hecmesh%mpc%mpc_dof(j)
530 #ifdef _OPENACC
531  !$acc atomic update
532 #else
533  !$omp atomic
534 #endif
535  y(jj) = y(jj) - hecmesh%mpc%mpc_val(j) * x(kk)
536  enddo
537  enddo outer
538 #ifdef _OPENACC
539  !$acc end kernels
540 #else
541  !$omp end do
542  !$omp end parallel
543 #endif
544 
545 
546  end subroutine hecmw_ttvec_nn
547 
548  !C
549  !C***
550  !C*** hecmw_TtmatTvec_nn
551  !C***
552  !C
553  subroutine hecmw_ttmattvec_nn (hecMESH, hecMAT, X, Y, W, time_Ax, COMMtime)
554  use hecmw_util
555  implicit none
556  type (hecmwst_local_mesh), intent(in) :: hecmesh
557  type (hecmwst_matrix), intent(in) :: hecmat
558  real(kind=kreal), intent(in) :: x(:)
559  real(kind=kreal), intent(out) :: y(:), w(:)
560  real(kind=kreal), intent(inout) :: time_ax
561  real(kind=kreal), intent(inout) :: commtime
562 
563  call hecmw_tvec_nn(hecmesh, hecmat%NDOF, x, y, commtime)
564  call hecmw_matvec_nn_inner(hecmesh, hecmat, y, w, time_ax, commtime)
565  call hecmw_ttvec_nn(hecmesh, hecmat%NDOF, w, y, commtime)
566 
567  end subroutine hecmw_ttmattvec_nn
568 
569  !C
570  !C***
571  !C*** hecmw_mat_diag_sr_nn
572  !C***
573  !C
574  subroutine hecmw_mat_diag_sr_nn(hecMESH, hecMAT, COMMtime)
575  use hecmw_util
576  use m_hecmw_comm_f
577  implicit none
578  type (hecmwst_local_mesh), intent(in) :: hecmesh
579  type (hecmwst_matrix), intent(inout), target :: hecmat
580  real(kind=kreal), intent(inout), optional :: commtime
581  real(kind=kreal), allocatable :: w(:,:)
582  real(kind=kreal), pointer :: d(:)
583  integer(kind=kint) :: ip, ndof, i, j
584  real(kind=kreal) :: start_time, end_time
585  ndof = hecmat%NDOF
586  allocate(w(ndof*hecmat%NP,ndof))
587  d => hecmat%D
588  do ip= 1, hecmat%N
589  do i=1,ndof
590  do j=1,ndof
591  w(ndof*(ip-1)+i,j) = d(ndof*ndof*(ip-1)+(i-1)*ndof+j)
592  end do
593  end do
594  enddo
595  start_time= hecmw_wtime()
596  do i=1,ndof
597  call hecmw_update_r (hecmesh, w(:,i), hecmat%NP, ndof)
598  end do
599  end_time= hecmw_wtime()
600  if (present(commtime)) commtime = commtime + end_time - start_time
601  do ip= hecmat%N+1, hecmat%NP
602  do i=1,ndof
603  do j=1,ndof
604  d(ndof*ndof*(ip-1)+(i-1)*ndof+j) = w(ndof*(ip-1)+i,j)
605  end do
606  end do
607  enddo
608  deallocate(w)
609  end subroutine hecmw_mat_diag_sr_nn
610 
611  subroutine hecmw_mat_add_nn(hecMAT1, hecMAT2, hecMAT3)
612  use hecmw_util
613  implicit none
614  type (hecmwst_matrix) :: hecmat1, hecmat2, hecmat3
615  integer(kind=kint) :: i
616 
617  do i = 1, hecmat1%NP*hecmat1%NDOF*hecmat1%NDOF
618  hecmat3%D(i) = hecmat1%D(i) + hecmat2%D(i)
619  enddo
620 
621  do i = 1, hecmat1%NPU*hecmat1%NDOF*hecmat1%NDOF
622  hecmat3%AU(i) = hecmat1%AU(i) + hecmat2%AU(i)
623  enddo
624 
625  do i = 1, hecmat1%NPL*hecmat1%NDOF*hecmat1%NDOF
626  hecmat3%AL(i) = hecmat1%AL(i) + hecmat2%AL(i)
627  enddo
628  end subroutine hecmw_mat_add_nn
629 
630  subroutine hecmw_mat_multiple_nn(hecMAT, alpha)
631  use hecmw_util
632  implicit none
633  type (hecmwst_matrix) :: hecmat
634  real(kind=kreal), intent(in) :: alpha
635  integer(kind=kint) :: i
636 
637  do i = 1, hecmat%NP*hecmat%NDOF*hecmat%NDOF
638  hecmat%D(i) = alpha*hecmat%D(i)
639  enddo
640 
641  do i = 1, hecmat%NPU*hecmat%NDOF*hecmat%NDOF
642  hecmat%AU(i) = alpha*hecmat%AU(i)
643  enddo
644 
645  do i = 1, hecmat%NPL*hecmat%NDOF*hecmat%NDOF
646  hecmat%AL(i) = alpha*hecmat%AL(i)
647  enddo
648  end subroutine hecmw_mat_multiple_nn
649 end module hecmw_solver_las_nn
Jagged Diagonal Matrix storage for vector processors. Original code was provided by JAMSTEC.
Definition: hecmw_jadm.f90:8
subroutine, public hecmw_jad_matvec(hecMESH, hecMAT, X, Y, COMMtime)
Definition: hecmw_jadm.f90:61
integer(kind=kint) function, public hecmw_jad_is_initialized()
Definition: hecmw_jadm.f90:56
integer(kind=kint) function, public hecmw_mat_get_flag_mpcmatvec(hecMAT)
subroutine, public hecmw_mat_diag_sr_nn(hecMESH, hecMAT, COMMtime)
subroutine, public hecmw_ttmattvec_nn(hecMESH, hecMAT, X, Y, W, time_Ax, COMMtime)
subroutine, public hecmw_mat_multiple_nn(hecMAT, alpha)
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_matvec_nn_unset_async
subroutine, public hecmw_tvec_nn(hecMESH, ndof, X, Y, COMMtime)
subroutine, public hecmw_matvec_nn_set_async(hecMAT)
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, public hecmw_mat_add_nn(hecMAT1, hecMAT2, hecMAT3)
subroutine hecmw_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine, public hecmw_tuning_fx_calc_sector_cache(N, NDOF, sectorCacheSize0, sectorCacheSize1)
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
real(kind=kreal) function hecmw_wtime()
subroutine hecmw_update_r(hecMESH, val, n, m)