OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_sms.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_sms ../engine/source/mpi/ams/spmd_exch_sms.F
25!||--- called by ------------------------------------------------------
26!|| sms_build_diag ../engine/source/ams/sms_build_diag.F
27!|| sms_inisi ../engine/source/ams/sms_proj.F
28!|| sms_mav_lt ../engine/source/ams/sms_pcg.F
29!|| sms_mav_lt2 ../engine/source/ams/sms_pcg.F
30!||--- calls -----------------------------------------------------
31!||--- uses -----------------------------------------------------
32!|| spmd_mod ../engine/source/mpi/spmd_mod.F90
33!||====================================================================
34 SUBROUTINE spmd_exch_sms(V,NODNX_SMS,IAD_ELEM,FR_ELEM,
35 . SIZE,LENR)
36 USE spmd_mod
37C-----------------------------------------------
38C I m p l i c i t T y p e s
39C-----------------------------------------------
40#include "implicit_f.inc"
41C-----------------------------------------------------------------
42C M e s s a g e P a s s i n g
43C-----------------------------------------------
44#include "spmd.inc"
45C-----------------------------------------------
46C C o m m o n B l o c k s
47C-----------------------------------------------
48#include "com01_c.inc"
49#include "task_c.inc"
50C-----------------------------------------------
51C D u m m y A r g u m e n t s
52C-----------------------------------------------
53 INTEGER NODNX_SMS(*), IAD_ELEM(2,*), FR_ELEM(*), SIZE, LENR
55 . v(SIZE,*)
56C-----------------------------------------------
57C L o c a l V a r i a b l e s
58C-----------------------------------------------
59#ifdef MPI
60 INTEGER MSGTYP,I,NOD,LOC_PROC,IERROR, MSGOFF,
61 . siz,j,l,nb_nod,k,
62 . status(mpi_status_size),
63 . iad_send(nspmd+1),iad_recv(nspmd+1),
64 . req_r(nspmd),req_s(nspmd)
66 . rbuf(size*lenr), sbuf(size*lenr), w(SIZE,lenr)
67 DATA msgoff/213/
68C-----------------------------------------------
69C S o u r c e L i n e s
70C-----------------------------------------------
71 loc_proc = ispmd + 1
72 l = 1
73 iad_recv(1) = 1
74 DO i=1,nspmd
75
76 siz = 0
77 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
78 nod = fr_elem(j)
79 IF(nodnx_sms(nod)/=0)THEN
80 siz = siz + SIZE
81 END IF
82 END DO
83
84 IF(siz/=0)THEN
85 msgtyp = msgoff
86 CALL mpi_irecv(
87 s rbuf(l),siz,real,it_spmd(i),msgtyp,
88 g spmd_comm_world,req_r(i),ierror)
89 l = l + siz
90 ENDIF
91 iad_recv(i+1) = l
92 END DO
93 l = 1
94 iad_send(1) = 1
95 DO i=1,nspmd
96#include "vectorize.inc"
97 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
98 nod = fr_elem(j)
99 IF(nodnx_sms(nod)/=0)THEN
100 DO k=1,SIZE
101 sbuf(l+k-1) = v(k,nod)
102 END DO
103 l = l + SIZE
104 END IF
105 END DO
106 iad_send(i+1) = l
107 ENDDO
108C
109C echange messages
110C
111 DO i=1,nspmd
112C--------------------------------------------------------------------
113ccc IF(IAD_ELEM(1,I+1)-IAD_ELEM(1,I)>0)THEN
114 IF(iad_send(i+1)-iad_send(i)>0)THEN
115 msgtyp = msgoff
116 siz = iad_send(i+1)-iad_send(i)
117 l = iad_send(i)
118 CALL mpi_isend(
119 s sbuf(l),siz,real,it_spmd(i),msgtyp,
120 g spmd_comm_world,req_s(i),ierror)
121 ENDIF
122C--------------------------------------------------------------------
123 ENDDO
124C
125 DO j=1,iad_elem(1,nspmd+1)-1
126 nod = fr_elem(j)
127 IF(nodnx_sms(nod)/=0)THEN
128 DO k=1,SIZE
129 w(k,j) = v(k,nod)
130 v(k,nod) = zero
131 END DO
132 END IF
133 END DO
134C
135 DO i = 1, loc_proc-1
136ccc IF(IAD_ELEM(1,I+1)-IAD_ELEM(1,I)>0)THEN
137 IF(iad_recv(i+1)-iad_recv(i)>0)THEN
138 CALL mpi_wait(req_r(i),status,ierror)
139 l = iad_recv(i)
140#include "vectorize.inc"
141 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
142 nod = fr_elem(j)
143 IF(nodnx_sms(nod)/=0) THEN
144 DO k=1,SIZE
145 v(k,nod) = v(k,nod)+rbuf(l+k-1)
146 END DO
147 l = l + SIZE
148 END IF
149 END DO
150 ENDIF
151 END DO
152C
153 DO j=1,iad_elem(1,nspmd+1)-1
154 nod = fr_elem(j)
155 IF(nodnx_sms(nod)/=0)THEN
156 DO k=1,SIZE
157 v(k,nod) = v(k,nod) + w(k,j)
158 END DO
159 END IF
160 END DO
161C
162 DO i = loc_proc+1,nspmd
163ccc IF(IAD_ELEM(1,I+1)-IAD_ELEM(1,I)>0)THEN
164 IF(iad_recv(i+1)-iad_recv(i)>0)THEN
165 CALL mpi_wait(req_r(i),status,ierror)
166 l = iad_recv(i)
167#include "vectorize.inc"
168 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
169 nod = fr_elem(j)
170 IF(nodnx_sms(nod)/=0) THEN
171 DO k=1,SIZE
172 v(k,nod) = v(k,nod)+rbuf(l+k-1)
173 END DO
174 l = l + SIZE
175 END IF
176 END DO
177 ENDIF
178 END DO
179C
180 DO i = 1, nspmd
181ccc IF(IAD_ELEM(1,I+1)-IAD_ELEM(1,I)>0)THEN
182 IF(iad_send(i+1)-iad_send(i)>0)THEN
183 CALL mpi_wait(req_s(i),status,ierror)
184 ENDIF
185 ENDDO
186C
187#endif
188 RETURN
189 END
#define my_real
Definition cppsort.cpp:32
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_sms(v, nodnx_sms, iad_elem, fr_elem, size, lenr)