OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gather_wa.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| spmd_gather_wa ../engine/source/mpi/anim/spmd_gather_wa.F
25!||--- called by ------------------------------------------------------
26!|| dparrws ../engine/source/output/anim/generate/dparrws.F
27!||--- calls -----------------------------------------------------
28!||--- uses -----------------------------------------------------
29!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
30!||====================================================================
31 SUBROUTINE spmd_gather_wa(MODE,SIZE_BUFFER_S,SIZE_BUFFER_R,SINDEX,RINDEX_PROC,
32 1 BUFFER_S,BUFFER_R,SHIFT_R,NB_ELEM_R)
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
103 END
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
subroutine spmd_gather_wa(mode, size_buffer_s, size_buffer_r, sindex, rindex_proc, buffer_s, buffer_r, shift_r, nb_elem_r)