OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_tagncont.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_exch_tagncont ../engine/source/mpi/forces/spmd_exch_tagncont.F
25!||--- called by ------------------------------------------------------
26!|| resol ../engine/source/engine/resol.F
27!||--- calls -----------------------------------------------------
28!|| ancmsg ../engine/source/output/message/message.F
29!|| arret ../engine/source/system/arret.f
30!||--- uses -----------------------------------------------------
31!|| message_mod ../engine/share/message_module/message_mod.F
32!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
33!||====================================================================
34 SUBROUTINE spmd_exch_tagncont(TAGNCONT,IAD_ELEM ,FR_ELEM,LENR )
35C--------------------------------------
36C--------------------------------------
37 USE message_mod
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41 USE spmd_comm_world_mod, ONLY : spmd_comm_world
42#include "implicit_f.inc"
43C-----------------------------------------------------------------
44C M e s s a g e P a s s i n g
45C-----------------------------------------------
46#include "spmd.inc"
47C-----------------------------------------------
48C C o m m o n B l o c k s
49C-----------------------------------------------
50#include "com01_c.inc"
51#include "com04_c.inc"
52#include "task_c.inc"
53C-----------------------------------------------
54C D u m m y A r g u m e n t s
55C-----------------------------------------------
56 INTEGER IAD_ELEM(2,*),FR_ELEM(*), TAGNCONT(NLOADP_HYD_INTER,NUMNOD),LENR
57C-----------------------------------------------
58C L o c a l V a r i a b l e s
59C-----------------------------------------------
60#ifdef MPI
61 INTEGER MSGTYP,I,NOD,IERROR,MSGOFF,IERROR2,
62 . SIZ,J,K,L,NB_NOD,NP,
63 . STATUS(MPI_STATUS_SIZE),
64 . IAD_SEND(NSPMD+1),IAD_RECV(NSPMD+1),
65 . REQ_R(NSPMD),REQ_S(NSPMD)
66 DATA msgoff/120/
67
68 INTEGER, DIMENSION(:), ALLOCATABLE :: RBUF,SBUF
69C-----------------------------------------------
70C S o u r c e L i n e s
71C-----------------------------------------------
72
73
74 ierror = 0
75 ALLOCATE( rbuf(nloadp_hyd_inter*lenr),stat=ierror2)
76 ierror = ierror + ierror2
77 ALLOCATE( sbuf(nloadp_hyd_inter*lenr),stat=ierror2)
78 ierror = ierror + ierror2
79
80 IF(ierror/=0) THEN
81 CALL ancmsg(msgid=20,anmode=aninfo)
82 CALL arret(2)
83 END IF
84 l = 1
85 iad_recv(1) = 1
86 DO i=1,nspmd
87 siz = nloadp_hyd_inter*(iad_elem(1,i+1)-iad_elem(1,i))
88 IF(siz/=0)THEN
89 msgtyp = msgoff
90 CALL mpi_irecv(
91 s rbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
92 g spmd_comm_world,req_r(i),ierror)
93 l = l + siz
94 ENDIF
95 iad_recv(i+1) = l
96 END DO
97C
98
99
100 l = 1
101 iad_send(1) = 1
102 DO i=1,nspmd
103 DO np=1,nloadp_hyd_inter
104#include "vectorize.inc"
105 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
106 nod = fr_elem(j)
107 sbuf(l ) = tagncont(np,nod)
108 l = l + 1
109 END DO
110 ENDDO
111C
112 iad_send(i+1) = l
113 ENDDO
114C
115C sending messages
116C
117 DO i=1,nspmd
118C--------------------------------------------------------------------
119C Send to N+I mod P
120C-------------------------------------------------------------------
121 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
122 msgtyp = msgoff
123 siz = iad_send(i+1)-iad_send(i)
124 l = iad_send(i)
125 CALL mpi_isend(
126 s sbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
127 g spmd_comm_world,req_s(i),ierror)
128 ENDIF
129C--------------------------------------------------------------------
130 ENDDO
131C
132C Counting
133C
134
135C
136 DO i = 1, nspmd
137C
138 nb_nod = iad_elem(1,i+1)-iad_elem(1,i)
139 IF(nb_nod>0)THEN
140 CALL mpi_wait(req_r(i),status,ierror)
141 l = iad_recv(i)
142
143 DO np=1,nloadp_hyd_inter
144#include "vectorize.inc"
145 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
146 nod = fr_elem(j)
147 tagncont(np,nod) = max(tagncont(np,nod), rbuf(l))
148 l = l + 1
149 END DO
150 ENDDO
151
152 ENDIF
153C
154C
155
156 END DO
157C
158C wait terminaison isend
159C
160
161 DO i = 1, nspmd
162 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
163 CALL mpi_wait(req_s(i),status,ierror)
164 ENDIF
165 ENDDO
166
167 DEALLOCATE(rbuf,sbuf)
168C
169#endif
170 RETURN
171 END
#define max(a, b)
Definition macros.h:21
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
Definition mpi.f:382
subroutine mpi_wait(ireq, status, ierr)
Definition mpi.f:525
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
Definition mpi.f:372
subroutine spmd_exch_tagncont(tagncont, iad_elem, fr_elem, lenr)
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)
Definition message.F:889
subroutine arret(nn)
Definition arret.F:87