OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_vfi_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_vfi_sms ../engine/source/mpi/ams/spmd_vfi_sms.F
25!||--- called by ------------------------------------------------------
26!|| sms_mav_lt ../engine/source/ams/sms_pcg.F
27!||--- calls -----------------------------------------------------
28!||--- uses -----------------------------------------------------
29!|| spmd_mod ../engine/source/mpi/spmd_mod.f90
30!||====================================================================
31 SUBROUTINE spmd_vfi_sms(V ,SIZE,VFI,FR_RMS,
32 . FR_SMS ,LIST_RMS ,LIST_SMS,IFLAG,
33 . IAD_SEND,IAD_RECV,REQ_R,REQ_S,RBUF,SBUF)
34 USE spmd_mod
35C-----------------------------------------------
36C I m p l i c i t T y p e s
37C-----------------------------------------------
38#include "implicit_f.inc"
39C-----------------------------------------------------------------
40C M e s s a g e P a s s i n g
41C-----------------------------------------------
42#include "spmd.inc"
43C-----------------------------------------------
44C C o m m o n B l o c k s
45C-----------------------------------------------
46#include "com01_c.inc"
47#include "task_c.inc"
48C-----------------------------------------------
49C D u m m y A r g u m e n t s
50C-----------------------------------------------
51 INTEGER SIZE, IFLAG,
52 . FR_RMS(NSPMD+1), FR_SMS(NSPMD+1),LIST_RMS(*), LIST_SMS(*),
53 . iad_send(nspmd+1),iad_recv(nspmd+1),
54 . req_r(nspmd),req_s(nspmd)
56 . v(SIZE,*), vfi(SIZE,*)
58 . rbuf(size*(fr_rms(nspmd+1)+fr_sms(nspmd+1))),
59 . sbuf(size*(fr_rms(nspmd+1)+fr_sms(nspmd+1)))
60C-----------------------------------------------
61C L o c a l V a r i a b l e s
62C-----------------------------------------------
63#ifdef MPI
64 INTEGER MSGTYP,I,NOD,LOC_PROC,IERROR,MSGOFF,
65 . SIZ,J,L,NB_NOD,K,M,KK,
66 . status(mpi_status_size)
67 DATA msgoff/217/
68C-----------------------------------------------
69C S o u r c e L i n e s
70C-----------------------------------------------
71 loc_proc = ispmd + 1
72
73 IF(iflag==1)THEN
74 l = 1
75 iad_recv(1) = 1
76 DO i=1,nspmd
77
78 siz = fr_rms(i+1) - fr_rms(i)
79 IF(i/=loc_proc)THEN
80 siz = siz + fr_sms(i+1) - fr_sms(i)
81 ENDIF
82 siz = size*siz
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 ENDIF
90 l = l + siz
91 iad_recv(i+1) = l
92
93 END DO
94
95 l = 1
96 iad_send(1) = 1
97 m = 1
98 DO i=1,nspmd
99 IF(i/=loc_proc)THEN
100#include "vectorize.inc"
101 DO j=fr_sms(i),fr_sms(i+1)-1
102 nod = list_sms(m)
103 IF(nod/=0)THEN
104 DO k=1,SIZE
105 sbuf(l+k-1) = v(k,nod)
106 END DO
107 ELSE
108 DO k=1,SIZE
109 sbuf(l+k-1) = zero
110 END DO
111 END IF
112 l = l + SIZE
113 m = m + 1
114 END DO
115 END IF
116#include "vectorize.inc"
117 DO j=fr_rms(i),fr_rms(i+1)-1
118 nod = list_rms(j)
119 IF(nod/=0)THEN
120 DO k=1,SIZE
121 sbuf(l+k-1) = v(k,nod)
122 END DO
123 ELSE
124 DO k=1,SIZE
125 sbuf(l+k-1) = zero
126 END DO
127 END IF
128 l = l + SIZE
129 END DO
130 iad_send(i+1) = l
131 ENDDO
132C
133C echange messages
134C
135 DO i=1,nspmd
136C--------------------------------------------------------------------
137 IF(iad_send(i+1)-iad_send(i)>0)THEN
138 msgtyp = msgoff
139 siz = iad_send(i+1)-iad_send(i)
140 l = iad_send(i)
141 CALL mpi_isend(
142 s sbuf(l),siz,real,it_spmd(i),msgtyp,
143 g spmd_comm_world,req_s(i),ierror)
144 ENDIF
145C--------------------------------------------------------------------
146 ENDDO
147C
148 ELSE ! IFLAG==1
149C
150 m = 1
151 kk= 1
152 DO i = 1, nspmd
153 IF(iad_recv(i+1)-iad_recv(i)>0)THEN
154 CALL mpi_wait(req_r(i),status,ierror)
155 l = iad_recv(i)
156#include "vectorize.inc"
157 DO j=fr_rms(i),fr_rms(i+1)-1
158 IF(list_rms(j)/=0)THEN
159 DO k=1,SIZE
160 vfi(k,kk) = rbuf(l+k-1)
161 END DO
162 END IF
163 l = l + SIZE
164 kk= kk + 1
165 END DO
166 IF(i/=loc_proc)THEN
167#include "vectorize.inc"
168 DO j=fr_sms(i),fr_sms(i+1)-1
169 IF(list_sms(m)/=0)THEN
170 DO k=1,SIZE
171 vfi(k,kk) = rbuf(l+k-1)
172 END DO
173 END IF
174 l = l + SIZE
175 m = m + 1
176 kk= kk + 1
177 END DO
178 END IF
179 ENDIF
180 END DO
181C
182 DO i = 1, nspmd
183 IF(iad_send(i+1)-iad_send(i)>0)THEN
184 CALL mpi_wait(req_s(i),status,ierror)
185 ENDIF
186 ENDDO
187C
188 END IF
189#endif
190 RETURN
191 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_vfi_sms(v, size, vfi, fr_rms, fr_sms, list_rms, list_sms, iflag, iad_send, iad_recv, req_r, req_s, rbuf, sbuf)