OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_min_max.F File Reference
#include "implicit_f.inc"
#include "spmd.inc"
#include "com01_c.inc"
#include "com04_c.inc"
#include "task_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine spmd_exch_min_max (iad_elem, fr_elem, min_array, max_array)

Function/Subroutine Documentation

◆ spmd_exch_min_max()

subroutine spmd_exch_min_max ( integer, dimension(2,*), intent(in) iad_elem,
integer, dimension(*), intent(in) fr_elem,
dimension(numnod), intent(inout) min_array,
dimension(numnod), intent(inout) max_array )

Definition at line 35 of file spmd_exch_min_max.F.

36C-----------------------------------------------
37C M o d u l e s
38C-----------------------------------------------
39 USE message_mod
40C-----------------------------------------------
41C I m p l i c i t T y p e s
42C-----------------------------------------------
43 USE spmd_comm_world_mod, ONLY : spmd_comm_world
44#include "implicit_f.inc"
45C-----------------------------------------------
46C M e s s a g e P a s s i n g
47C-----------------------------------------------
48#include "spmd.inc"
49C-----------------------------------------------
50C C o m m o n B l o c k s
51C-----------------------------------------------
52#include "com01_c.inc"
53#include "com04_c.inc"
54#include "task_c.inc"
55C-----------------------------------------------
56C D u m m y A r g u m e n t s
57C-----------------------------------------------
58 INTEGER, INTENT(IN) :: IAD_ELEM(2,*),FR_ELEM(*)
59 my_real , INTENT(INOUT) :: min_array(numnod),max_array(numnod)
60C-----------------------------------------------
61C L o c a l V a r i a b l e s
62C-----------------------------------------------
63#ifdef MPI
64 INTEGER LENCOM,MSGOFF ,MSGTYP
65 my_real, dimension(:), ALLOCATABLE :: send_buf,rec_buf
66 INTEGER STATUS(MPI_STATUS_SIZE),REQ_R(NSPMD),REQ_S(NSPMD)
67 INTEGER IERROR
68 INTEGER P,J,NOD,SIZ,L,IAD
69C-----------------------------------------------
70 DATA msgoff/400/
71 msgtyp=msgoff
72
73 lencom = ( iad_elem(1,nspmd+1) - iad_elem(1,1) )
74
75C Allocation des Buffers
76 ALLOCATE(send_buf(2 * lencom),stat=ierror)
77 IF(ierror/=0) THEN
78 CALL ancmsg(msgid=20,anmode=aninfo)
79 CALL arret(2)
80 ENDIF
81
82 ALLOCATE(rec_buf(2 * lencom),stat=ierror)
83 IF(ierror/=0) THEN
84 CALL ancmsg(msgid=20,anmode=aninfo)
85 CALL arret(2)
86 ENDIF
87C
88C ----------
89C Set IRECV
90C ----------
91 l=1
92 DO p=1,nspmd
93 siz = iad_elem(1,p+1)-iad_elem(1,p)
94 IF(siz > 0) THEN
95 CALL mpi_irecv(
96 s rec_buf(l),2*siz,real,it_spmd(p),msgtyp,
97 g spmd_comm_world,req_r(p),ierror)
98 l=l+2*siz
99 ENDIF
100 ENDDO
101
102C -----------------
103C PREPARE SEND_BUF
104C -----------------
105 l=1
106 DO p=1,nspmd
107 siz = iad_elem(1,p+1)-iad_elem(1,p)
108 IF(siz > 0)THEN
109 iad = l
110 DO j=iad_elem(1,p),iad_elem(1,p+1)-1
111 nod = fr_elem(j)
112 send_buf(l)=min_array(nod)
113 send_buf(l + 1)=max_array(nod)
114 l=l+2
115 ENDDO
116
117 CALL mpi_isend(
118 s send_buf(iad),2*siz,real,it_spmd(p),msgtyp,
119 g spmd_comm_world,req_s(p),ierror)
120
121 ENDIF
122 ENDDO
123
124C ------------
125C END RECEIVE
126C ------------
127 l=1
128 DO p=1,nspmd
129 siz = iad_elem(1,p+1)-iad_elem(1,p)
130 IF(siz > 0)THEN
131 CALL mpi_wait(req_r(p),status,ierror)
132
133 DO j=iad_elem(1,p),iad_elem(1,p+1)-1
134 nod = fr_elem(j)
135 min_array(nod) = min(min_array(nod), rec_buf(l))
136 max_array(nod) = max(max_array(nod), rec_buf(l + 1))
137 l = l+2
138 ENDDO
139 ENDIF
140 ENDDO
141
142C ------------
143C END SEND
144C ------------
145 DO p = 1, nspmd
146 IF(iad_elem(1,p+1)-iad_elem(1,p)>0)THEN
147 CALL mpi_wait(req_s(p),status,ierror)
148 ENDIF
149 ENDDO
150 IF (ALLOCATED(send_buf)) DEALLOCATE(send_buf)
151 IF (ALLOCATED(rec_buf)) DEALLOCATE(rec_buf)
152
153#endif
154
#define my_real
Definition cppsort.cpp:32
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
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 ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)
Definition message.F:889
subroutine arret(nn)
Definition arret.F:87