OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gath_collective.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!||====================================================================
25!|| spmd_gath_collective ../engine/source/mpi/generic/spmd_gath_collective.F
26!||--- calls -----------------------------------------------------
27!||--- uses -----------------------------------------------------
28!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
29!||====================================================================
30 SUBROUTINE spmd_gath_collective(SRBUF,LEN,LRECV)
31C Description:
32C Collective communication version of SPMD_IGATH
33C expected to be less efficient than SPMD_IGATH
34C But useful to debug MPI problems: less pending communication
35C-----------------------------------------------
36C I m p l i c i t T y p e s
37C-----------------------------------------------
38 USE spmd_comm_world_mod, ONLY : spmd_comm_world
39#include "implicit_f.inc"
40C-----------------------------------------------------------------
41C M e s s a g e P a s s i n g
42C-----------------------------------------------
43#include "spmd.inc"
44C-----------------------------------------------
45C C o m m o n B l o c k s
46C-----------------------------------------------
47#include "com01_c.inc"
48#include "task_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C-----------------------------------------------
52 INTEGER SRBUF(*), LEN, LRECV
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
56#ifdef MPI
57 INTEGER MSGOFF,MSGOFF2,MSGTYP,INFO,I,K,ATID,ATAG,ALEN,RLEN,S1
58 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
59 INTEGER SIZES(NSPMD),POINTERS(NSPMD)
60 INTEGER,ALLOCATABLE,DIMENSION(:) :: SRBUF2
61 DATA msgoff/7013/
62 DATA msgoff2/7068/
63C-----------------------------------------------
64C S o u r c e L i n e s
65C-----------------------------------------------
66
67 s1 = 1
68
69 ! Send Local sizes to Zero
70 CALL mpi_gather(len,s1,mpi_integer,sizes,s1,mpi_integer,0,spmd_comm_world,ierror)
71
72
73 IF(ispmd == 0) THEN
74 lrecv = 0
75 DO i=1,nspmd
76 lrecv = lrecv + sizes(i)
77 ENDDO
78 ! Pointers starts at 0
79 pointers(1) = 0
80 DO i=2,nspmd
81 pointers(i) = pointers(i-1)+sizes(i-1)
82 ENDDO
83 ALLOCATE(srbuf2(lrecv))
84 ELSE
85 ALLOCATE(srbuf2(1))
86 ENDIF
87
88 CALL mpi_gatherv(srbuf,len,mpi_integer,srbuf2,sizes,pointers,mpi_integer,0,spmd_comm_world,ierror)
89
90
91 CALL mpi_barrier(spmd_comm_world,ierror)
92
93 IF(ispmd == 0) THEN
94 DO i=1,lrecv
95 srbuf(i) = srbuf2(i)
96 ENDDO
97 ENDIF
98 DEALLOCATE(srbuf2)
99
100C
101#endif
102 RETURN
103 END
subroutine mpi_barrier(comm, ierr)
Definition mpi.f:188
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_gath_collective(srbuf, len, lrecv)