OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_fvb_igath.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_fvb_igath ../engine/source/mpi/airbags/spmd_fvb_igath.F
26!||--- called by ------------------------------------------------------
27!|| fv_up_switch ../engine/source/airbag/fv_up_switch.F
28!|| fvbag1 ../engine/source/airbag/fvbag1.F
29!||--- calls -----------------------------------------------------
30!||--- uses -----------------------------------------------------
31!|| fvbag_mod ../engine/share/modules/fvbag_mod.F
32!||====================================================================
33 SUBROUTINE spmd_fvb_igath(IFV, ITABS, ITABG)
34C-----------------------------------------------
35C M o d u l e s
36C-----------------------------------------------
37 USE fvbag_mod
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41#include "implicit_f.inc"
42C-----------------------------------------------------------------
43C M e s s a g e P a s s i n g
44C-----------------------------------------------
45#include "spmd.inc"
46C-----------------------------------------------
47C C o m m o n B l o c k s
48C-----------------------------------------------
49#include "com01_c.inc"
50C-----------------------------------------------
51C D u m m y A r g u m e n t s
52C-----------------------------------------------
53 INTEGER IFV, ITABS(*), ITABG(*)
54C-----------------------------------------------
55C L o c a l V a r i a b l e s
56C-----------------------------------------------
57#ifdef MPI
58 INTEGER II, I, ITAG, MSGOFF, REQ(NSPMD-1), IERR,
59 . STAT(MPI_STATUS_SIZE, NSPMD-1), LEN, IADI(NSPMD-1),
60 . IAD, I1, I2, J1, J2, PMAIN, NNT, J, ITAB(NSPMD-1)
61 INTEGER, DIMENSION(:), ALLOCATABLE :: IBUF
62 DATA msgoff/205/
63C
64 IF (fvspmd(ifv)%RANK == 0) THEN
65C Reception des longueurs
66 ii=0
67 DO i=1,fvspmd(ifv)%NSPMD - 1
68 ii=ii+1
69 itag=msgoff+i
70 CALL mpi_irecv(itab(ii), 1, mpi_integer, i,
71 . itag, fvspmd(ifv)%MPI_COMM, req(ii), ierr)
72 ENDDO
73C
74 CALL mpi_waitall(fvspmd(ifv)%NSPMD-1, req, stat, ierr)
75C
76 len=0
77 ii=0
78 DO i=1,fvspmd(ifv)%NSPMD-1
79 ii=ii+1
80 iadi(ii)=len+1
81 len=len+2*itab(ii)
82 ENDDO
83 ALLOCATE(ibuf(len))
84C Reception des entiers
85 ii=0
86 DO i=1,fvspmd(ifv)%NSPMD-1
87 ii=ii+1
88 itag=msgoff+nspmd+i
89 iad=iadi(ii)
90 len=2*itab(ii)
91 CALL mpi_irecv(ibuf(iad), len, mpi_integer, i,
92 . itag, fvspmd(ifv)%MPI_COMM, req(ii), ierr)
93 ENDDO
94C Remplissage du tableau de sortie ITABG
95 DO i=1,fvspmd(ifv)%NN_L+fvspmd(ifv)%NNI_L
96 i1=fvspmd(ifv)%IBUF_L(1,i)
97 i2=fvspmd(ifv)%IBUF_L(2,i)
98 itabg(i1)=itabs(i2)
99 ENDDO
100C
101 CALL mpi_waitall(fvspmd(ifv)%NSPMD-1, req, stat, ierr)
102C
103 ii=0
104 DO i=1,fvspmd(ifv)%NSPMD - 1
105 ii=ii+1
106 iad=iadi(ii)
107 DO j=1,itab(ii)
108 j1=ibuf(iad-1+j)
109 j2=ibuf(iad-1+itab(ii)+j)
110 itabg(j1)=j2
111 ENDDO
112 ENDDO
113 DEALLOCATE(ibuf)
114 ELSE IF(fvspmd(ifv)%RANK > 0) THEN
115 pmain=fvspmd(ifv)%PMAIN
116 nnt=fvspmd(ifv)%NN_L+fvspmd(ifv)%NNI_L
117 itag=msgoff+fvspmd(ifv)%RANK
118 CALL mpi_isend(nnt, 1, mpi_integer, 0,
119 . itag, fvspmd(ifv)%MPI_COMM, req(1), ierr)
120C
121 CALL mpi_wait(req(1), stat, ierr)
122C
123 len=2*nnt
124 ALLOCATE(ibuf(len))
125 DO i=1,nnt
126 ibuf(i)=fvspmd(ifv)%IBUF_L(1,i)
127 ii=fvspmd(ifv)%IBUF_L(2,i)
128 ibuf(nnt+i)=itabs(ii)
129 ENDDO
130C
131 itag=msgoff+nspmd+fvspmd(ifv)%RANK
132 CALL mpi_isend(ibuf, len, mpi_integer, 0,
133 . itag, fvspmd(ifv)%MPI_COMM, req(2), ierr)
134C
135 CALL mpi_wait(req(2), stat, ierr)
136 DEALLOCATE(ibuf)
137 ENDIF
138C
139#endif
140 RETURN
141 END
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_waitall(cnt, array_of_requests, status, ierr)
Definition mpi.f:536
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
Definition mpi.f:372
type(fvbag_spmd), dimension(:), allocatable fvspmd
Definition fvbag_mod.F:129
subroutine spmd_fvb_igath(ifv, itabs, itabg)