OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gather_wa.F File Reference
#include "implicit_f.inc"
#include "spmd.inc"
#include "com01_c.inc"
#include "com04_c.inc"
#include "task_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine spmd_gather_wa (mode, size_buffer_s, size_buffer_r, sindex, rindex_proc, buffer_s, buffer_r, shift_r, nb_elem_r)

Function/Subroutine Documentation

◆ spmd_gather_wa()

subroutine spmd_gather_wa ( integer, intent(in) mode,
integer, intent(in) size_buffer_s,
integer, intent(inout) size_buffer_r,
integer, dimension(nsect+1,3), intent(in) sindex,
integer, dimension(nsect+1,3,nspmd), intent(inout) rindex_proc,
integer, dimension(size_buffer_s), intent(in) buffer_s,
integer, dimension(*), intent(inout) buffer_r,
integer, dimension(nspmd), intent(inout) shift_r,
integer, dimension(nspmd), intent(inout) nb_elem_r )

Definition at line 31 of file spmd_gather_wa.F.

33C-----------------------------------------------
34C-----------------------------------------------
35C I m p l i c i t T y p e s
36C-----------------------------------------------
37 USE spmd_comm_world_mod, ONLY : spmd_comm_world
38#include "implicit_f.inc"
39#include "spmd.inc"
40C-----------------------------------------------
41C C o m m o n B l o c k s
42C-----------------------------------------------
43#include "com01_c.inc"
44#include "com04_c.inc"
45#include "task_c.inc"
46C-----------------------------------------------
47C D u m m y A r g u m e n t s
48C-----------------------------------------------
49! MODE = 0 --> collect the index array for each proc
50! MODE = 1 --> collect all the buffer arrays
51! SIZE_BUFFER_S is the size of the local sended array
52 INTEGER, INTENT(IN) :: MODE,SIZE_BUFFER_S
53! SIZE_BUFFER_R is the size of the global received array, proc 0
54 INTEGER, INTENT(INOUT) :: SIZE_BUFFER_R
55! SINDEX : index buffer array, local on each proc
56 INTEGER, DIMENSION(NSECT+1,3), INTENT(IN) :: SINDEX
57! RINDEX_PROC : global index buffer array, only on proc 0
58 INTEGER, DIMENSION(NSECT+1,3,NSPMD), INTENT(INOUT) :: RINDEX_PROC
59! BUFFER_S : sended buffer
60 INTEGER, DIMENSION(SIZE_BUFFER_S), INTENT(IN) :: BUFFER_S
61! BUFFER_R : received buffer, size = SIZE_BUFFER_R on proc 0
62 INTEGER, DIMENSION(*), INTENT(INOUT) :: BUFFER_R
63 INTEGER, DIMENSION(NSPMD), INTENT(INOUT) :: SHIFT_R,NB_ELEM_R
64C-----------------------------------------------
65C L O C A L V A R I A B L E S
66C-----------------------------------------------
67#ifdef MPI
68 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
69 INTEGER SIZ,MSGTYP,I,K,NG,NREC,STEP
70
71C-----------------------------------------------
72 DATA msgoff/7069/
73C-----------------------------------------------
74
75 IF(mode==0) THEN
76 ! collect the local index arrays on the main processor
77 CALL mpi_gather(sindex,3*(nsect+1),mpi_integer,
78 . rindex_proc,3*(nsect+1),mpi_integer,0,spmd_comm_world,ierror)
79 ! sum all the size of local sended arrays in order to get the size
80 ! of the global array on proc 0
81 IF(ispmd==0) THEN
82 nb_elem_r(1:nspmd) = rindex_proc(nsect+1,1,1:nspmd)
83 size_buffer_r = 0
84 DO i=1,nspmd
85 size_buffer_r = size_buffer_r + nb_elem_r(i)
86 ENDDO
87 ! shift for the _gatherv comm
88 shift_r(1) = 0
89 DO i=2,nspmd
90 shift_r(i) = shift_r(i-1)+nb_elem_r(i-1)
91 ENDDO
92 ELSE
93 size_buffer_r = 0
94 ENDIF
95 ELSEIF(mode==1) THEN
96
97 CALL mpi_gatherv(buffer_s,size_buffer_s,mpi_integer,
98 . buffer_r,nb_elem_r,shift_r,mpi_integer,
99 . 0,spmd_comm_world,ierror)
100 ENDIF
101#endif
102 RETURN
subroutine mpi_gather(sendbuf, cnt, datatype, recvbuf, reccnt, rectype, root, comm, ierr)
Definition mpi.f:56
subroutine mpi_gatherv(sendbuf, cnt, datatype, recvbuf, reccnt, displs, rectype, root, comm, ierr)
Definition mpi.f:76