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

Go to the source code of this file.

Functions/Subroutines

subroutine spmd_exch_v (xnorm, nsiz, iad_elem, fr_elem, lenr)

Function/Subroutine Documentation

◆ spmd_exch_v()

subroutine spmd_exch_v ( xnorm,
integer nsiz,
integer, dimension(2,*) iad_elem,
integer, dimension(*) fr_elem,
integer lenr )

Definition at line 32 of file spmd_exch_v.F.

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
#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