OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_collect.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/.
23C
24!||====================================================================
25!|| spmd_collect ../engine/source/mpi/output/spmd_collect.F
26!||--- called by ------------------------------------------------------
27!|| resol ../engine/source/engine/resol.F
28!||--- calls -----------------------------------------------------
29!||--- uses -----------------------------------------------------
30!|| inoutfile_mod ../common_source/modules/inoutfile_mod.F
31!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
32!||====================================================================
33 SUBROUTINE spmd_collect(A, ITAB, WEIGHT,NODGLOB,SIZP0)
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 "com04_c.inc"
49#include "task_c.inc"
50#include "spmd_c.inc"
51#include "chara_c.inc"
52#include "units_c.inc"
53C-----------------------------------------------
54C D u m m y A r g u m e n t s
55C-----------------------------------------------
56 INTEGER ITAB(*),WEIGHT(*),NODGLOB(*),SIZP0
58 . a(3,*)
59C-----------------------------------------------
60C L o c a l V a r i a b l e s
61C-----------------------------------------------
62#ifdef MPI
63 INTEGER MSGOFF,MSGOFF0,MSGTYP,INFO,I,K,NG,N,
64 . EMPL,SDNODG(NUMNODM),FILEN
65 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
66 double precision
67 . aglob(4,numnodm),recglob(4,sizp0)
68
69 CHARACTER FILNAM*100,CYCLENUM*7
70
71 INTEGER :: LEN_TMP_NAME
72 CHARACTER(len=2148) :: TMP_NAME
73
74 DATA msgoff0/176/
75 DATA msgoff/177/
76C-----------------------------------------------
77C S o u r c e L i n e s
78C-----------------------------------------------
79 IF (ispmd/=0) THEN
80 n = 0
81 DO i = 1, numnod
82 IF (weight(i)==1) THEN
83 n = n+1
84 sdnodg(n) = nodglob(i)
85 aglob(1,n) = itab(i)
86 aglob(2,n) = a(1,i)
87 aglob(3,n) = a(2,i)
88 aglob(4,n) = a(3,i)
89 END IF
90 END DO
91 msgtyp=msgoff0
92 CALL mpi_send(sdnodg,n,mpi_integer,
93 . it_spmd(1),msgtyp,
94 . spmd_comm_world,ierror)
95 msgtyp=msgoff
96 CALL mpi_send(aglob,4*n,mpi_double_precision,
97 . it_spmd(1),msgtyp,
98 . spmd_comm_world,ierror)
99 ELSE
100 WRITE(cyclenum,'(I7.7)')ncycle
101 filnam=rootnam(1:rootlen)//'_'//chrun//'_'//cyclenum//'.adb'
102
103 len_tmp_name = outfile_name_len + len_trim(filnam)
104 tmp_name=outfile_name(1:outfile_name_len)//filnam(1:len_trim(filnam))
105
106 OPEN(unit=idbg5,file=tmp_name(1:len_tmp_name),access='SEQUENTIAL',
107 . form='FORMATTED',status='UNKNOWN')
108
109 filen = rootlen+17
110
111 DO i=1,numnod
112 IF (weight(i)==1) THEN
113 empl = nodglob(i)
114 recglob(1,empl) = itab(i)
115 recglob(2,empl) = a(1,i)
116 recglob(3,empl) = a(2,i)
117 recglob(4,empl) = a(3,i)
118 ENDIF
119 ENDDO
120
121 DO k=2,nspmd
122 msgtyp=msgoff0
123 CALL mpi_recv(sdnodg,numnodm,mpi_integer,
124 . it_spmd(k),msgtyp,
125 . spmd_comm_world,status,ierror)
126
127 CALL mpi_get_count(status,mpi_integer,n,ierror)
128
129 msgtyp=msgoff
130 CALL mpi_recv(aglob,4*n,mpi_double_precision,
131 . it_spmd(k),msgtyp,
132 . spmd_comm_world,status,ierror)
133
134 DO i=1,n
135 empl = sdnodg(i)
136 recglob(1,empl) = aglob(1,i)
137 recglob(2,empl) = aglob(2,i)
138 recglob(3,empl) = aglob(3,i)
139 recglob(4,empl) = aglob(4,i)
140 ENDDO
141
142 END DO
143C
144 DO i = 1, numnodg
145 WRITE(idbg5,'(A,I10,I10,Z20,Z20,Z20)' )
146 . '>',ncycle,nint(recglob(1,i)),
147 . recglob(2,i),recglob(3,i),recglob(4,i)
148 END DO
149 WRITE (iout,1300) filnam(1:filen)
150 WRITE (istdo,1300) filnam(1:filen)
151 CLOSE(unit=idbg5)
152
153 END IF
154C
155 1300 FORMAT (4x,' debug analysis file:',1X,A,' written')
156#endif
157 RETURN
158 END
#define my_real
Definition cppsort.cpp:32
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
Definition mpi.f:461
subroutine mpi_get_count(status, datatype, cnt, ierr)
Definition mpi.f:296
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
Definition mpi.f:480
character(len=outfile_char_len) outfile_name
integer outfile_name_len
subroutine spmd_collect(a, itab, weight, nodglob, sizp0)