OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_v.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_v ../engine/source/mpi/generic/spmd_exch_v.F
26!||--- called by ------------------------------------------------------
27!|| gps_solid ../engine/source/output/outmaxsubr.F
28!||--- calls -----------------------------------------------------
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
31!||====================================================================
32 SUBROUTINE spmd_exch_v(XNORM,NSIZ,IAD_ELEM,FR_ELEM,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 IAD_ELEM(2,*),FR_ELEM(*), NSIZ, LENR
51 my_real xnorm(nsiz,*)
52C-----------------------------------------------
53C L o c a l V a r i a b l e s
54C-----------------------------------------------
55#ifdef mpi
56 INTEGER MSGTYP,I,NOD,LOC_PROC,IERROR,
57 . SIZ,J,K,L,NB_NOD,
58 . STATUS(MPI_STATUS_SIZE),
59 . IAD_SEND(NSPMD+1),IAD_RECV(NSPMD+1),
60 . REQ_R(NSPMD),REQ_S(NSPMD),MSGOFF,NSIZ1
61
62 my_real, DIMENSION(:),ALLOCATABLE :: sbuf,rbuf
63
64 DATA msgoff/7000/
65C-----------------------------------------------
66C S o u r c e L i n e s
67C-----------------------------------------------
68 ALLOCATE(sbuf(lenr*nsiz))
69 ALLOCATE(rbuf(lenr*nsiz))
70C-----------------------------------------------
71 loc_proc = ispmd+1
72 l = 1
73 iad_recv(1)=1
74
75C
76 DO i=1,nspmd
77 siz = nsiz*(iad_elem(1,i+1)-iad_elem(1,i))
78 IF(siz/=0) THEN
79 msgtyp = msgoff
80 CALL mpi_irecv(
81 s rbuf(l),siz,real,it_spmd(i),msgtyp,
82 g spmd_comm_world,req_r(i),ierror)
83 l = l+siz
84 END IF
85 iad_recv(i+1) = l
86 END DO
87
88C
89 l=1
90 iad_send(1)=1
91 nsiz1 = nsiz-1
92 DO i=1,nspmd
93 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
94 nod = fr_elem(j)
95 sbuf(l:l+nsiz1) = xnorm(1:nsiz,nod)
96 l = l+nsiz
97 END DO
98 iad_send(i+1) = l
99 END DO
100
101 DO i=1,nspmd
102
103 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
104
105 msgtyp = msgoff
106 siz = iad_send(i+1)-iad_send(i)
107 l = iad_send(i)
108 CALL mpi_isend(
109 s sbuf(l),siz,real,it_spmd(i),msgtyp,
110 g spmd_comm_world,req_s(i),ierror)
111 ENDIF
112 END DO
113
114C
115 DO i = 1, nspmd
116C
117 nb_nod = iad_elem(1,i+1)-iad_elem(1,i)
118 IF(nb_nod>0)THEN
119 CALL mpi_wait(req_r(i),status,ierror)
120 l = iad_recv(i)
121
122 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
123
124 nod = fr_elem(j)
125 xnorm(1:nsiz,nod) = xnorm(1:nsiz,nod) + rbuf(l:l+nsiz1)
126 l = l+nsiz
127 ENDDO
128 ENDIF
129 ENDDO
130
131 DO i = 1, nspmd
132 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
133 CALL mpi_wait(req_s(i),status,ierror)
134 ENDIF
135 ENDDO
136
137 DEALLOCATE(sbuf)
138 DEALLOCATE(rbuf)
139
140#endif
141 RETURN
142 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_v(xnorm, nsiz, iad_elem, fr_elem, lenr)
Definition spmd_exch_v.F:33