FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
hecmw_comm_f.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 contains
8 
9  !C
10  !C***
11  !C*** hecmw_barrier
12  !C***
13  !C
14  subroutine hecmw_barrier (hecMESH)
15  use hecmw_util
16  implicit none
17  type (hecmwST_local_mesh) :: hecMESH
18 #ifndef HECMW_SERIAL
19  integer(kind=kint):: ierr
20  call mpi_barrier (hecmesh%MPI_COMM, ierr)
21 #endif
22  end subroutine hecmw_barrier
23 
24  subroutine hecmw_scatterv_dp(sbuf, sc, disp, rbuf, rc, root, comm)
25  use hecmw_util
26  implicit none
27  double precision :: sbuf(*) !send buffer
28  integer(kind=kint) :: sc(*) !send counts
29  integer(kind=kint) :: disp(*) !displacement
30  double precision :: rbuf(*) !receive buffer
31  integer(kind=kint) :: rc !receive counts
32  integer(kind=kint) :: root
33  integer(kind=kint) :: comm
34 #ifndef HECMW_SERIAL
35  integer(kind=kint) :: ierr
36  call mpi_scatterv( sbuf, sc, disp, mpi_double_precision, &
37  rbuf, rc, mpi_double_precision, &
38  root, comm, ierr )
39 #else
40  rbuf(1) = sbuf(1)
41 #endif
42  end subroutine hecmw_scatterv_dp
43 
44 #ifndef HECMW_SERIAL
45  function hecmw_operation_hec2mpi(operation)
46  use hecmw_util
47  implicit none
48  integer(kind=kint) :: hecmw_operation_hec2mpi
49  integer(kind=kint) :: operation
51  if (operation == hecmw_sum) then
52  hecmw_operation_hec2mpi = mpi_sum
53  elseif (operation == hecmw_prod) then
54  hecmw_operation_hec2mpi = mpi_prod
55  elseif (operation == hecmw_max) then
56  hecmw_operation_hec2mpi = mpi_max
57  elseif (operation == hecmw_min) then
58  hecmw_operation_hec2mpi = mpi_min
59  endif
60  end function hecmw_operation_hec2mpi
61 #endif
62 
63  subroutine hecmw_scatter_int_1(sbuf, rval, root, comm)
64  use hecmw_util
65  implicit none
66  integer(kind=kint) :: sbuf(*) !send buffer
67  integer(kind=kint) :: rval !receive value
68  integer(kind=kint) :: root
69  integer(kind=kint) :: comm
70 #ifndef HECMW_SERIAL
71  integer(kind=kint) :: ierr
72  call mpi_scatter( sbuf, 1, mpi_integer, &
73  & rval, 1, mpi_integer, root, comm, ierr )
74 #else
75  rval=sbuf(1)
76 #endif
77  end subroutine hecmw_scatter_int_1
78 
79  subroutine hecmw_gather_int_1(sval, rbuf, root, comm)
80  use hecmw_util
81  implicit none
82  integer(kind=kint) :: sval !send buffer
83  integer(kind=kint) :: rbuf(*) !receive buffer
84  integer(kind=kint) :: root
85  integer(kind=kint) :: comm
86 #ifndef HECMW_SERIAL
87  integer(kind=kint) :: ierr
88  call mpi_gather( sval, 1, mpi_integer, &
89  & rbuf, 1, mpi_integer, root, comm, ierr )
90 #else
91  rbuf(1)=sval
92 #endif
93  end subroutine hecmw_gather_int_1
94 
95  subroutine hecmw_allgather_int_1(sval, rbuf, comm)
96  use hecmw_util
97  implicit none
98  integer(kind=kint) :: sval !send buffer
99  integer(kind=kint) :: rbuf(*) !receive buffer
100  integer(kind=kint) :: comm
101 #ifndef HECMW_SERIAL
102  integer(kind=kint) :: ierr
103  call mpi_allgather( sval, 1, mpi_integer, &
104  & rbuf, 1, mpi_integer, comm, ierr )
105 #else
106  rbuf(1)=sval
107 #endif
108  end subroutine hecmw_allgather_int_1
109 
110  subroutine hecmw_scatterv_real(sbuf, scs, disp, &
111  & rbuf, rc, root, comm)
112  use hecmw_util
113  implicit none
114  real(kind=kreal) :: sbuf(*) !send buffer
115  integer(kind=kint) :: scs(*) !send counts
116  integer(kind=kint) :: disp(*) !displacement
117  real(kind=kreal) :: rbuf(*) !receive buffer
118  integer(kind=kint) :: rc !receive counts
119  integer(kind=kint) :: root
120  integer(kind=kint) :: comm
121 #ifndef HECMW_SERIAL
122  integer(kind=kint) :: ierr
123  call mpi_scatterv( sbuf, scs, disp, mpi_real8, &
124  & rbuf, rc, mpi_real8, root, comm, ierr )
125 #else
126  rbuf(1:rc)=sbuf(1:rc)
127 #endif
128  end subroutine hecmw_scatterv_real
129 
130  subroutine hecmw_gatherv_real(sbuf, sc, &
131  & rbuf, rcs, disp, root, comm)
132  use hecmw_util
133  implicit none
134  real(kind=kreal) :: sbuf(*) !send buffer
135  integer(kind=kint) :: sc !send counts
136  real(kind=kreal) :: rbuf(*) !receive buffer
137  integer(kind=kint) :: rcs(*) !receive counts
138  integer(kind=kint) :: disp(*) !displacement
139  integer(kind=kint) :: root
140  integer(kind=kint) :: comm
141 #ifndef HECMW_SERIAL
142  integer(kind=kint) :: ierr
143  call mpi_gatherv( sbuf, sc, mpi_real8, &
144  & rbuf, rcs, disp, mpi_real8, root, comm, ierr )
145 #else
146  rbuf(1:sc)=sbuf(1:sc)
147 #endif
148  end subroutine hecmw_gatherv_real
149 
150  subroutine hecmw_gatherv_int(sbuf, sc, &
151  & rbuf, rcs, disp, root, comm)
152  use hecmw_util
153  implicit none
154  integer(kind=kint) :: sbuf(*) !send buffer
155  integer(kind=kint) :: sc !send counts
156  integer(kind=kint) :: rbuf(*) !receive buffer
157  integer(kind=kint) :: rcs(*) !receive counts
158  integer(kind=kint) :: disp(*) !displacement
159  integer(kind=kint) :: root
160  integer(kind=kint) :: comm
161 #ifndef HECMW_SERIAL
162  integer(kind=kint) :: ierr
163  call mpi_gatherv( sbuf, sc, mpi_integer, &
164  & rbuf, rcs, disp, mpi_integer, root, comm, ierr )
165 #else
166  rbuf(1:sc)=sbuf(1:sc)
167 #endif
168  end subroutine hecmw_gatherv_int
169 
170  subroutine hecmw_allreduce_int_1(sval, rval, op, comm)
171  use hecmw_util
172  implicit none
173  integer(kind=kint) :: sval !send val
174  integer(kind=kint) :: rval !receive val
175  integer(kind=kint):: op, comm, ierr
176 #ifndef HECMW_SERIAL
177  call mpi_allreduce(sval, rval, 1, mpi_integer, &
178  & hecmw_operation_hec2mpi(op), comm, ierr)
179 #else
180  rval=sval
181 #endif
182  end subroutine hecmw_allreduce_int_1
183 
184  subroutine hecmw_alltoall_int(sbuf, sc, rbuf, rc, comm)
185  use hecmw_util
186  implicit none
187  integer(kind=kint) :: sbuf(*)
188  integer(kind=kint) :: sc
189  integer(kind=kint) :: rbuf(*)
190  integer(kind=kint) :: rc
191  integer(kind=kint) :: comm
192 #ifndef HECMW_SERIAL
193  integer(kind=kint) :: ierr
194  call mpi_alltoall( sbuf, sc, mpi_integer, &
195  & rbuf, rc, mpi_integer, comm, ierr )
196 #else
197  rbuf(1:sc)=sbuf(1:sc)
198 #endif
199  end subroutine hecmw_alltoall_int
200 
201  subroutine hecmw_isend_int(sbuf, sc, dest, &
202  & tag, comm, req)
203  use hecmw_util
204  implicit none
205  integer(kind=kint) :: sbuf(*)
206  integer(kind=kint) :: sc
207  integer(kind=kint) :: dest
208  integer(kind=kint) :: tag
209  integer(kind=kint) :: comm
210  integer(kind=kint) :: req
211 #ifndef HECMW_SERIAL
212  integer(kind=kint) :: ierr
213  call mpi_isend(sbuf, sc, mpi_integer, &
214  & dest, tag, comm, req, ierr)
215 #endif
216  end subroutine hecmw_isend_int
217 
218  subroutine hecmw_isend_r(sbuf, sc, dest, &
219  & tag, comm, req)
220  use hecmw_util
221  implicit none
222  integer(kind=kint) :: sc
223  double precision, dimension(sc) :: sbuf
224  integer(kind=kint) :: dest
225  integer(kind=kint) :: tag
226  integer(kind=kint) :: comm
227  integer(kind=kint) :: req
228 #ifndef HECMW_SERIAL
229  integer(kind=kint) :: ierr
230  call mpi_isend(sbuf, sc, mpi_double_precision, &
231  & dest, tag, comm, req, ierr)
232 #endif
233  end subroutine hecmw_isend_r
234 
235  subroutine hecmw_irecv_int(rbuf, rc, source, &
236  & tag, comm, req)
237  use hecmw_util
238  implicit none
239  integer(kind=kint) :: rbuf(*)
240  integer(kind=kint) :: rc
241  integer(kind=kint) :: source
242  integer(kind=kint) :: tag
243  integer(kind=kint) :: comm
244  integer(kind=kint) :: req
245 #ifndef HECMW_SERIAL
246  integer(kind=kint) :: ierr
247  call mpi_irecv(rbuf, rc, mpi_integer, &
248  & source, tag, comm, req, ierr)
249 #endif
250  end subroutine hecmw_irecv_int
251 
252  subroutine hecmw_irecv_r(rbuf, rc, source, &
253  & tag, comm, req)
254  use hecmw_util
255  implicit none
256  integer(kind=kint) :: rc
257  double precision, dimension(rc) :: rbuf
258  integer(kind=kint) :: source
259  integer(kind=kint) :: tag
260  integer(kind=kint) :: comm
261  integer(kind=kint) :: req
262 #ifndef HECMW_SERIAL
263  integer(kind=kint) :: ierr
264  call mpi_irecv(rbuf, rc, mpi_double_precision, &
265  & source, tag, comm, req, ierr)
266 #endif
267  end subroutine hecmw_irecv_r
268 
269  subroutine hecmw_waitall(cnt, reqs, stats)
270  use hecmw_util
271  implicit none
272  integer(kind=kint) :: cnt
273  integer(kind=kint) :: reqs(*)
274  integer(kind=kint) :: stats(HECMW_STATUS_SIZE,*)
275 #ifndef HECMW_SERIAL
276  integer(kind=kint) :: ierr
277  call mpi_waitall(cnt, reqs, stats, ierr)
278 #endif
279  end subroutine hecmw_waitall
280 
281  subroutine hecmw_recv_int(rbuf, rc, source, &
282  & tag, comm, stat)
283  use hecmw_util
284  implicit none
285  integer(kind=kint) :: rbuf(*)
286  integer(kind=kint) :: rc
287  integer(kind=kint) :: source
288  integer(kind=kint) :: tag
289  integer(kind=kint) :: comm
290  integer(kind=kint) :: stat(HECMW_STATUS_SIZE)
291 #ifndef HECMW_SERIAL
292  integer(kind=kint) :: ierr
293  call mpi_recv(rbuf, rc, mpi_integer, &
294  & source, tag, comm, stat, ierr)
295 #endif
296  end subroutine hecmw_recv_int
297 
298  subroutine hecmw_recv_r(rbuf, rc, source, &
299  & tag, comm, stat)
300  use hecmw_util
301  implicit none
302  integer(kind=kint) :: rc
303  double precision, dimension(rc) :: rbuf
304  integer(kind=kint) :: source
305  integer(kind=kint) :: tag
306  integer(kind=kint) :: comm
307  integer(kind=kint) :: stat(HECMW_STATUS_SIZE)
308 #ifndef HECMW_SERIAL
309  integer(kind=kint) :: ierr
310  call mpi_recv(rbuf, rc, mpi_double_precision, &
311  & source, tag, comm, stat, ierr)
312 #endif
313  end subroutine hecmw_recv_r
314  !C
315  !C***
316  !C*** hecmw_allREDUCE
317  !C***
318  !C
319  subroutine hecmw_allreduce_dp(val,VALM,n,hec_op,comm )
320  use hecmw_util
321  implicit none
322  integer(kind=kint) :: n, hec_op,op, comm, ierr
323  double precision, dimension(n) :: val
324  double precision, dimension(n) :: VALM
325 #ifndef HECMW_SERIAL
326  select case( hec_op )
327  case ( hecmw_sum )
328  op = mpi_sum
329  case ( hecmw_prod )
330  op = mpi_prod
331  case ( hecmw_max )
332  op = mpi_max
333  case ( hecmw_min )
334  op = mpi_min
335  end select
336  call mpi_allreduce(val,valm,n,mpi_double_precision,op,comm,ierr)
337 #else
338  integer(kind=kint) :: i
339  do i=1,n
340  valm(i) = val(i)
341  end do
342 #endif
343  end subroutine hecmw_allreduce_dp
344 
345  subroutine hecmw_allreduce_dp1(s1,s2,hec_op,comm )
346  use hecmw_util
347  implicit none
348  integer(kind=kint) :: hec_op, comm
349  double precision :: s1, s2
350  double precision, dimension(1) :: val
351  double precision, dimension(1) :: VALM
352 #ifndef HECMW_SERIAL
353  val(1) = s1
354  valm(1) = s2
355  call hecmw_allreduce_dp(val,valm,1,hec_op,comm )
356  s1 = val(1)
357  s2 = valm(1)
358 #else
359  s2 = s1
360 #endif
361  end subroutine hecmw_allreduce_dp1
362  !C
363  !C***
364  !C*** hecmw_allREDUCE_R
365  !C***
366  !C
367  subroutine hecmw_allreduce_r (hecMESH, val, n, ntag)
368  use hecmw_util
369  implicit none
370  integer(kind=kint):: n, ntag
371  real(kind=kreal), dimension(n) :: val
372  type (hecmwST_local_mesh) :: hecMESH
373 #ifndef HECMW_SERIAL
374  integer(kind=kint):: ierr
375  real(kind=kreal), dimension(:), allocatable :: valm, sbuf
376 
377  allocate (valm(n), sbuf(n))
378  sbuf= val
379  valm= 0.d0
380  if (ntag .eq. hecmw_sum) then
381  call mpi_allreduce &
382  & (sbuf, valm, n, mpi_double_precision, mpi_sum, &
383  & hecmesh%MPI_COMM, ierr)
384  endif
385 
386  if (ntag .eq. hecmw_max) then
387  call mpi_allreduce &
388  & (sbuf, valm, n, mpi_double_precision, mpi_max, &
389  & hecmesh%MPI_COMM, ierr)
390  endif
391 
392  if (ntag .eq. hecmw_min) then
393  call mpi_allreduce &
394  & (sbuf, valm, n, mpi_double_precision, mpi_min, &
395  & hecmesh%MPI_COMM, ierr)
396  endif
397 
398  val= valm
399  deallocate (valm, sbuf)
400 #endif
401  end subroutine hecmw_allreduce_r
402 
403  subroutine hecmw_allreduce_r1 (hecMESH, s, ntag)
404  use hecmw_util
405  implicit none
406  integer(kind=kint):: ntag
407  real(kind=kreal) :: s
408  type (hecmwST_local_mesh) :: hecMESH
409 #ifndef HECMW_SERIAL
410  real(kind=kreal), dimension(1) :: val
411  val(1) = s
412  call hecmw_allreduce_r(hecmesh, val, 1, ntag )
413  s = val(1)
414 #endif
415  end subroutine hecmw_allreduce_r1
416 
417  !C
418  !C***
419  !C*** hecmw_allREDUCE_I
420  !C***
421  !C
422  subroutine hecmw_allreduce_i(hecMESH, val, n, ntag)
423  use hecmw_util
424  implicit none
425  integer(kind=kint):: n, ntag
426  integer(kind=kint), dimension(n) :: val
427  type (hecmwST_local_mesh) :: hecMESH
428 #ifndef HECMW_SERIAL
429  integer(kind=kint):: ierr
430  integer(kind=kint), dimension(:), allocatable :: VALM, sbuf
431 
432  allocate (valm(n), sbuf(n))
433  sbuf= val
434  valm= 0
435  if (ntag .eq. hecmw_sum) then
436  call mpi_allreduce &
437  & (sbuf, valm, n, mpi_integer, mpi_sum, &
438  & hecmesh%MPI_COMM, ierr)
439  endif
440 
441  if (ntag .eq. hecmw_max) then
442  call mpi_allreduce &
443  & (sbuf, valm, n, mpi_integer, mpi_max, &
444  & hecmesh%MPI_COMM, ierr)
445  endif
446 
447  if (ntag .eq. hecmw_min) then
448  call mpi_allreduce &
449  & (sbuf, valm, n, mpi_integer, mpi_min, &
450  & hecmesh%MPI_COMM, ierr)
451  endif
452 
453 
454  val= valm
455  deallocate (valm, sbuf)
456 #endif
457  end subroutine hecmw_allreduce_i
458 
459  subroutine hecmw_allreduce_i1 (hecMESH, s, ntag)
460  use hecmw_util
461  implicit none
462  integer(kind=kint):: ntag, s
463  type (hecmwST_local_mesh) :: hecMESH
464 #ifndef HECMW_SERIAL
465  integer(kind=kint), dimension(1) :: val
466 
467  val(1) = s
468  call hecmw_allreduce_i(hecmesh, val, 1, ntag )
469  s = val(1)
470 #endif
471  end subroutine hecmw_allreduce_i1
472 
473  subroutine hecmw_allreduce_l1 (hecMESH, flag, ntag)
474  use hecmw_util
475  implicit none
476  integer(kind=kint):: ntag
477  logical :: flag
478  type (hecmwST_local_mesh) :: hecMESH
479 #ifndef HECMW_SERIAL
480  integer(kind=kint):: ierr
481  logical :: flagM
482 
483  flagm = .false.
484  if (ntag .eq. hecmw_lor) then
485  call mpi_allreduce &
486  & (flag, flagm, 1, mpi_logical, mpi_lor, &
487  & hecmesh%MPI_COMM, ierr)
488  endif
489 
490  if (ntag .eq. hecmw_land) then
491  call mpi_allreduce &
492  & (flag, flagm, 1, mpi_logical, mpi_land, &
493  & hecmesh%MPI_COMM, ierr)
494  endif
495 
496  flag = flagm
497 #endif
498  end subroutine hecmw_allreduce_l1
499 
500  !C
501  !C***
502  !C*** hecmw_bcast_R
503  !C***
504  !C
505  subroutine hecmw_bcast_r (hecMESH, val, n, nbase)
506  use hecmw_util
507  implicit none
508  integer(kind=kint):: n, nbase
509  real(kind=kreal), dimension(n) :: val
510  type (hecmwST_local_mesh) :: hecMESH
511 #ifndef HECMW_SERIAL
512  integer(kind=kint):: ierr
513  call mpi_bcast (val, n, mpi_double_precision, nbase, hecmesh%MPI_COMM, ierr)
514 #endif
515  end subroutine hecmw_bcast_r
516 
517  subroutine hecmw_bcast_r_comm (val, n, nbase, comm)
518  use hecmw_util
519  implicit none
520  integer(kind=kint):: n, nbase
521  real(kind=kreal), dimension(n) :: val
522  integer(kind=kint):: comm
523 #ifndef HECMW_SERIAL
524  integer(kind=kint):: ierr
525  call mpi_bcast (val, n, mpi_double_precision, nbase, comm, ierr)
526 #endif
527  end subroutine hecmw_bcast_r_comm
528 
529  subroutine hecmw_bcast_r1 (hecMESH, s, nbase)
530  use hecmw_util
531  implicit none
532  integer(kind=kint):: nbase, ierr
533  real(kind=kreal) :: s
534  type (hecmwST_local_mesh) :: hecMESH
535 #ifndef HECMW_SERIAL
536  real(kind=kreal), dimension(1) :: val
537  val(1)=s
538  call mpi_bcast (val, 1, mpi_double_precision, nbase, hecmesh%MPI_COMM, ierr)
539  s = val(1)
540 #endif
541  end subroutine hecmw_bcast_r1
542 
543  subroutine hecmw_bcast_r1_comm (s, nbase, comm)
544  use hecmw_util
545  implicit none
546  integer(kind=kint):: nbase
547  real(kind=kreal) :: s
548  integer(kind=kint):: comm
549 #ifndef HECMW_SERIAL
550  integer(kind=kint):: ierr
551  real(kind=kreal), dimension(1) :: val
552  val(1)=s
553  call mpi_bcast (val, 1, mpi_double_precision, nbase, comm, ierr)
554  s = val(1)
555 #endif
556  end subroutine hecmw_bcast_r1_comm
557  !C
558  !C***
559  !C*** hecmw_bcast_I
560  !C***
561  !C
562  subroutine hecmw_bcast_i (hecMESH, val, n, nbase)
563  use hecmw_util
564  implicit none
565  integer(kind=kint):: n, nbase
566  integer(kind=kint), dimension(n) :: val
567  type (hecmwST_local_mesh) :: hecMESH
568 #ifndef HECMW_SERIAL
569  integer(kind=kint):: ierr
570  call mpi_bcast (val, n, mpi_integer, nbase, hecmesh%MPI_COMM, ierr)
571 #endif
572  end subroutine hecmw_bcast_i
573 
574  subroutine hecmw_bcast_i_comm (val, n, nbase, comm)
575  use hecmw_util
576  implicit none
577  integer(kind=kint):: n, nbase
578  integer(kind=kint), dimension(n) :: val
579  integer(kind=kint):: comm
580 #ifndef HECMW_SERIAL
581  integer(kind=kint):: ierr
582  call mpi_bcast (val, n, mpi_integer, nbase, comm, ierr)
583 #endif
584  end subroutine hecmw_bcast_i_comm
585 
586  subroutine hecmw_bcast_i1 (hecMESH, s, nbase)
587  use hecmw_util
588  implicit none
589  integer(kind=kint):: nbase, s
590  type (hecmwST_local_mesh) :: hecMESH
591 #ifndef HECMW_SERIAL
592  integer(kind=kint):: ierr
593  integer(kind=kint), dimension(1) :: val
594  val(1) = s
595  call mpi_bcast (val, 1, mpi_integer, nbase, hecmesh%MPI_COMM, ierr)
596  s = val(1)
597 #endif
598  end subroutine hecmw_bcast_i1
599 
600  subroutine hecmw_bcast_i1_comm (s, nbase, comm)
601  use hecmw_util
602  implicit none
603  integer(kind=kint):: nbase, s
604  integer(kind=kint):: comm
605 #ifndef HECMW_SERIAL
606  integer(kind=kint):: ierr
607  integer(kind=kint), dimension(1) :: val
608  val(1) = s
609  call mpi_bcast (val, 1, mpi_integer, nbase, comm, ierr)
610  s = val(1)
611 #endif
612  end subroutine hecmw_bcast_i1_comm
613  !C
614  !C***
615  !C*** hecmw_bcast_C
616  !C***
617  !C
618  subroutine hecmw_bcast_c (hecMESH, val, n, nn, nbase)
619  use hecmw_util
620  implicit none
621  integer(kind=kint):: n, nn, nbase
622  character(len=n) :: val(nn)
623  type (hecmwST_local_mesh) :: hecMESH
624 #ifndef HECMW_SERIAL
625  integer(kind=kint):: ierr
626  call mpi_bcast (val, n*nn, mpi_character, nbase, hecmesh%MPI_COMM,&
627  & ierr)
628 #endif
629  end subroutine hecmw_bcast_c
630 
631  subroutine hecmw_bcast_c_comm (val, n, nn, nbase, comm)
632  use hecmw_util
633  implicit none
634  integer(kind=kint):: n, nn, nbase
635  character(len=n) :: val(nn)
636  integer(kind=kint):: comm
637 #ifndef HECMW_SERIAL
638  integer(kind=kint):: ierr
639  call mpi_bcast (val, n*nn, mpi_character, nbase, comm,&
640  & ierr)
641 #endif
642  end subroutine hecmw_bcast_c_comm
643 
644  !C
645  !C***
646  !C*** hecmw_assemble_R
647  !C***
648  subroutine hecmw_assemble_r (hecMESH, val, n, m)
649  use hecmw_util
650  use hecmw_solver_sr
651 
652  implicit none
653  integer(kind=kint):: n, m
654  real(kind=kreal), dimension(m*n) :: val
655  type (hecmwST_local_mesh) :: hecMESH
656 #ifndef HECMW_SERIAL
657  integer(kind=kint):: ns, nr
658  real(kind=kreal), dimension(:), allocatable :: ws, wr
659 
660  if( hecmesh%n_neighbor_pe == 0 ) return
661 
662  ns = hecmesh%import_index(hecmesh%n_neighbor_pe)
663  nr = hecmesh%export_index(hecmesh%n_neighbor_pe)
664 
665  allocate (ws(m*ns), wr(m*nr))
667  & ( n, m, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
668  & hecmesh%import_index, hecmesh%import_item, &
669  & hecmesh%export_index, hecmesh%export_item, &
670  & ws, wr, val , hecmesh%MPI_COMM, hecmesh%my_rank)
671  deallocate (ws, wr)
672 #endif
673  end subroutine hecmw_assemble_r
674 
675  !C
676  !C***
677  !C*** hecmw_assemble_I
678  !C***
679  subroutine hecmw_assemble_i (hecMESH, val, n, m)
680  use hecmw_util
682 
683  implicit none
684  integer(kind=kint):: n, m
685  integer(kind=kint), dimension(m*n) :: val
686  type (hecmwST_local_mesh) :: hecMESH
687 #ifndef HECMW_SERIAL
688  integer(kind=kint):: ns, nr
689  integer(kind=kint), dimension(:), allocatable :: WS, WR
690 
691  if( hecmesh%n_neighbor_pe == 0 ) return
692 
693  ns = hecmesh%import_index(hecmesh%n_neighbor_pe)
694  nr = hecmesh%export_index(hecmesh%n_neighbor_pe)
695 
696  allocate (ws(m*ns), wr(m*nr))
698  & ( n, m, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
699  & hecmesh%import_index, hecmesh%import_item, &
700  & hecmesh%export_index, hecmesh%export_item, &
701  & ws, wr, val , hecmesh%MPI_COMM, hecmesh%my_rank)
702  deallocate (ws, wr)
703 #endif
704  end subroutine hecmw_assemble_i
705 
706  !C
707  !C***
708  !C*** hecmw_update_R
709  !C***
710  !C
711  subroutine hecmw_update_r (hecMESH, val, n, m)
712  use hecmw_util
713  use hecmw_solver_sr
714 
715  implicit none
716  integer(kind=kint):: n, m
717  real(kind=kreal), dimension(m*n) :: val
718  type (hecmwST_local_mesh) :: hecMESH
719 #ifndef HECMW_SERIAL
720  integer(kind=kint):: ns, nr
721  real(kind=kreal), dimension(:), allocatable :: ws, wr
722 
723  if( hecmesh%n_neighbor_pe == 0 ) return
724 
725  ns = hecmesh%export_index(hecmesh%n_neighbor_pe)
726  nr = hecmesh%import_index(hecmesh%n_neighbor_pe)
727 
728  allocate (ws(m*ns), wr(m*nr))
729  call hecmw_solve_send_recv &
730  & ( n, m, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
731  & hecmesh%import_index, hecmesh%import_item, &
732  & hecmesh%export_index, hecmesh%export_item, &
733  & ws, wr, val , hecmesh%MPI_COMM, hecmesh%my_rank)
734  deallocate (ws, wr)
735 #endif
736  end subroutine hecmw_update_r
737 
738  !C
739  !C***
740  !C*** hecmw_update_R_async
741  !C***
742  !C
743  !C REAL
744  !C
745  subroutine hecmw_update_r_async (hecMESH, val, n, m, ireq)
746  use hecmw_util
747  use hecmw_solver_sr
748  implicit none
749  integer(kind=kint):: n, m, ireq
750  real(kind=kreal), dimension(m*n) :: val
751  type (hecmwST_local_mesh) :: hecMESH
752 #ifndef HECMW_SERIAL
753  if( hecmesh%n_neighbor_pe == 0 ) return
754 
756  & ( n, m, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
757  & hecmesh%import_index, hecmesh%import_item, &
758  & hecmesh%export_index, hecmesh%export_item, &
759  & val , hecmesh%MPI_COMM, hecmesh%my_rank, ireq)
760 #endif
761  end subroutine hecmw_update_r_async
762 
763  !C
764  !C***
765  !C*** hecmw_update_R_wait
766  !C***
767  !C
768  !C REAL
769  !C
770  subroutine hecmw_update_r_wait (hecMESH, ireq)
771  use hecmw_util
772  use hecmw_solver_sr
773  implicit none
774  integer(kind=kint):: ireq
775  type (hecmwST_local_mesh) :: hecMESH
776 #ifndef HECMW_SERIAL
777  if( hecmesh%n_neighbor_pe == 0 ) return
778 
779  call hecmw_solve_isend_irecv_wait(hecmesh%n_dof, ireq )
780 #endif
781  end subroutine hecmw_update_r_wait
782 
783 
784  !C
785  !C***
786  !C*** hecmw_update_I
787  !C***
788  !C
789  subroutine hecmw_update_i (hecMESH, val, n, m)
790  use hecmw_util
792 
793  implicit none
794  integer(kind=kint):: n, m
795  integer(kind=kint), dimension(m*n) :: val
796  type (hecmwST_local_mesh) :: hecMESH
797 #ifndef HECMW_SERIAL
798  integer(kind=kint):: ns, nr
799  integer(kind=kint), dimension(:), allocatable :: WS, WR
800 
801  if( hecmesh%n_neighbor_pe == 0 ) return
802 
803  ns = hecmesh%export_index(hecmesh%n_neighbor_pe)
804  nr = hecmesh%import_index(hecmesh%n_neighbor_pe)
805 
806  allocate (ws(m*ns), wr(m*nr))
808  & ( n, m, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
809  & hecmesh%import_index, hecmesh%import_item, &
810  & hecmesh%export_index, hecmesh%export_item, &
811  & ws, wr, val , hecmesh%MPI_COMM, hecmesh%my_rank)
812  deallocate (ws, wr)
813 #endif
814  end subroutine hecmw_update_i
815 
816 end module m_hecmw_comm_f
subroutine hecmw_solve_send_recv_i(N, m, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank)
subroutine hecmw_solve_rev_send_recv_i(N, M, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank)
subroutine hecmw_solve_isend_irecv_wait(m, ireq)
subroutine hecmw_solve_isend_irecv(N, M, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, X, SOLVER_COMM, my_rank, ireq)
subroutine hecmw_solve_send_recv(N, m, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank)
subroutine hecmw_solve_rev_send_recv(N, M, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank)
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=kint), parameter hecmw_land
integer(kind=kint), parameter hecmw_sum
integer(kind=kint), parameter hecmw_prod
integer(kind=kint), parameter hecmw_max
integer(kind=4), parameter kreal
integer(kind=kint), parameter hecmw_lor
integer(kind=kint), parameter hecmw_min
subroutine hecmw_assemble_r(hecMESH, val, n, m)
subroutine hecmw_bcast_c_comm(val, n, nn, nbase, comm)
subroutine hecmw_gatherv_real(sbuf, sc, rbuf, rcs, disp, root, comm)
subroutine hecmw_update_r(hecMESH, val, n, m)
subroutine hecmw_isend_int(sbuf, sc, dest, tag, comm, req)
subroutine hecmw_scatterv_real(sbuf, scs, disp, rbuf, rc, root, comm)
subroutine hecmw_recv_int(rbuf, rc, source, tag, comm, stat)
subroutine hecmw_bcast_r_comm(val, n, nbase, comm)
subroutine hecmw_bcast_c(hecMESH, val, n, nn, nbase)
subroutine hecmw_isend_r(sbuf, sc, dest, tag, comm, req)
subroutine hecmw_allreduce_i1(hecMESH, s, ntag)
subroutine hecmw_gather_int_1(sval, rbuf, root, comm)
subroutine hecmw_bcast_i_comm(val, n, nbase, comm)
subroutine hecmw_allreduce_i(hecMESH, val, n, ntag)
subroutine hecmw_allreduce_r(hecMESH, val, n, ntag)
subroutine hecmw_bcast_i1(hecMESH, s, nbase)
subroutine hecmw_allgather_int_1(sval, rbuf, comm)
subroutine hecmw_allreduce_dp1(s1, s2, hec_op, comm)
subroutine hecmw_waitall(cnt, reqs, stats)
subroutine hecmw_assemble_i(hecMESH, val, n, m)
subroutine hecmw_allreduce_dp(val, VALM, n, hec_op, comm)
subroutine hecmw_bcast_r(hecMESH, val, n, nbase)
subroutine hecmw_irecv_int(rbuf, rc, source, tag, comm, req)
subroutine hecmw_bcast_r1_comm(s, nbase, comm)
subroutine hecmw_scatter_int_1(sbuf, rval, root, comm)
subroutine hecmw_irecv_r(rbuf, rc, source, tag, comm, req)
subroutine hecmw_allreduce_l1(hecMESH, flag, ntag)
subroutine hecmw_bcast_i(hecMESH, val, n, nbase)
subroutine hecmw_update_r_async(hecMESH, val, n, m, ireq)
subroutine hecmw_update_i(hecMESH, val, n, m)
subroutine hecmw_recv_r(rbuf, rc, source, tag, comm, stat)
subroutine hecmw_allreduce_r1(hecMESH, s, ntag)
subroutine hecmw_alltoall_int(sbuf, sc, rbuf, rc, comm)
subroutine hecmw_update_r_wait(hecMESH, ireq)
subroutine hecmw_bcast_r1(hecMESH, s, nbase)
subroutine hecmw_scatterv_dp(sbuf, sc, disp, rbuf, rc, root, comm)
subroutine hecmw_allreduce_int_1(sval, rval, op, comm)
subroutine hecmw_gatherv_int(sbuf, sc, rbuf, rcs, disp, root, comm)
subroutine hecmw_barrier(hecMESH)
integer(kind=kint) function hecmw_operation_hec2mpi(operation)
subroutine hecmw_bcast_i1_comm(s, nbase, comm)