OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_icodt.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_exch_icodt ../engine/source/mpi/nodes/spmd_exch_icodt.F
26!||--- called by ------------------------------------------------------
27!|| resol ../engine/source/engine/resol.F
28!||--- calls -----------------------------------------------------
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
31!||====================================================================
32 SUBROUTINE spmd_exch_icodt(ICODT,IAD_ELEM,FR_ELEM,SIZE,LENR)
33C-----------------------------------------------
34C I m p l i c i t T y p e s
35C-----------------------------------------------
36 USE spmd_comm_world_mod, ONLY : spmd_comm_world
37#include "implicit_f.inc"
38C-----------------------------------------------------------------
39C M e s s a g e P a s s i n g
40C-----------------------------------------------
41#include "spmd.inc"
42C-----------------------------------------------
43C C o m m o n B l o c k s
44C-----------------------------------------------
45#include "com01_c.inc"
46#include "task_c.inc"
47C-----------------------------------------------
48C D u m m y A r g u m e n t s
49C-----------------------------------------------
50 INTEGER ICODT(*), IAD_ELEM(2,*), FR_ELEM(*), SIZE, LENR
51C-----------------------------------------------
52C L o c a l V a r i a b l e s
53C-----------------------------------------------
54#ifdef MPI
55 INTEGER MSGTYP,I,NOD,LOC_PROC,IERROR, MSGOFF,
56 . SIZ,J,L,NB_NOD,
57 . STATUS(MPI_STATUS_SIZE),
58 . IAD_SEND(NSPMD+1),IAD_RECV(NSPMD+1),
59 . REQ_R(NSPMD),REQ_S(NSPMD),
60 . RBUF(SIZE*LENR), SBUF(SIZE*LENR)
61 DATA msgoff/127/
62
63C-----------------------------------------------
64C S o u r c e L i n e s
65C-----------------------------------------------
66 loc_proc = ispmd + 1
67 l = 1
68 iad_recv(1) = 1
69 DO i=1,nspmd
70 siz = size*(iad_elem(1,i+1)-iad_elem(1,i))
71 IF(siz/=0)THEN
72 msgtyp = msgoff
73 CALL mpi_irecv(
74 s rbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
75 g spmd_comm_world,req_r(i),ierror)
76 l = l + siz
77 ENDIF
78 iad_recv(i+1) = l
79 END DO
80 l = 1
81 iad_send(1) = 1
82 DO i=1,nspmd
83#include "vectorize.inc"
84 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
85 nod = fr_elem(j)
86 sbuf(l ) = icodt(nod)
87 l = l + SIZE
88 END DO
89 iad_send(i+1) = l
90 ENDDO
91C
92C echange messages
93C
94 DO i=1,nspmd
95C--------------------------------------------------------------------
96 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
97 msgtyp = msgoff
98 siz = iad_send(i+1)-iad_send(i)
99 l = iad_send(i)
100 CALL mpi_isend(
101 s sbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
102 g spmd_comm_world,req_s(i),ierror)
103 ENDIF
104C--------------------------------------------------------------------
105 ENDDO
106C
107 DO i = 1, nspmd
108 nb_nod = iad_elem(1,i+1)-iad_elem(1,i)
109 IF(nb_nod>0)THEN
110 CALL mpi_wait(req_r(i),status,ierror)
111 l = iad_recv(i)
112#include "vectorize.inc"
113 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
114 nod = fr_elem(j)
115 icodt(nod) = min(icodt(nod),rbuf(l))
116 l = l + SIZE
117 END DO
118 ENDIF
119 END DO
120C
121 DO i = 1, nspmd
122 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
123 CALL mpi_wait(req_s(i),status,ierror)
124 ENDIF
125 ENDDO
126C
127#endif
128 RETURN
129 END
#define min(a, b)
Definition macros.h:20
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_icodt(icodt, iad_elem, fr_elem, size, lenr)