OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_iget_partn.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_iget_partn (size, nbf_l, np, nbpart, iadg, srbuf, iflag)

Function/Subroutine Documentation

◆ spmd_iget_partn()

subroutine spmd_iget_partn ( integer size,
integer nbf_l,
integer, dimension(*) np,
integer nbpart,
integer, dimension(nspmd,*) iadg,
integer srbuf,
integer iflag )

Definition at line 49 of file spmd_iget_partn.F.

50C gather on p0 of the wa array according to the parts (IADG)
51C-----------------------------------------------
52C I m p l i c i t T y p e s
53C-----------------------------------------------
54 USE spmd_comm_world_mod, ONLY : spmd_comm_world
55#include "implicit_f.inc"
56C-----------------------------------------------
57C M e s s a g e P a s s i n g
58C-----------------------------------------------
59
60#include "spmd.inc"
61
62C-----------------------------------------------
63C C o m m o n B l o c k s
64C-----------------------------------------------
65#include "com01_c.inc"
66#include "task_c.inc"
67C-----------------------------------------------
68C D u m m y A r g u m e n t s
69C-----------------------------------------------
70 INTEGER NBF_L, NP(*),IADG(NSPMD,*),SIZE
71 INTEGER NBPART, IFLAG,SRBUF
72C-----------------------------------------------
73C L o c a l V a r i a b l e s
74C-----------------------------------------------
75#ifdef MPI
76 INTEGER MSGOFF,MSGTYP,IDEB,K,N,NB_TMP,LEN,IADP(NSPMD)
77
78 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
79 INTEGER, DIMENSION(:),ALLOCATABLE :: RBUF
80 DATA msgoff/7029/
81C-----------------------------------------------
82C S o u r c e L i n e s
83C-----------------------------------------------
84C Bug here: The actual recieve buffer size is not the same
85C as the size written. Removing the initialization to -HUGE(IERROR)
86C will cause valgrind errors about uninitialized memory.
87 ALLOCATE(rbuf(srbuf+1))
88 rbuf(1:srbuf) = -huge(ierror)
89
90 IF (ispmd/=0) THEN
91 msgtyp= msgoff
92
93 CALL mpi_send(np,nbf_l,mpi_integer,it_spmd(1),msgtyp,
94 . spmd_comm_world,ierror)
95
96 ELSE
97 DO k=1,nbf_l
98 rbuf(k) = np(k)
99 ENDDO
100 ideb = nbf_l + 1
101 iadp(1) = 1
102C
103 DO k=2,nspmd
104 iadp(k) = ideb
105 msgtyp= msgoff
106
107 CALL mpi_probe(it_spmd(k),msgtyp,
108 . spmd_comm_world,status,ierror)
109 CALL mpi_get_count(status,mpi_integer,nb_tmp,ierror)
110
111 CALL mpi_recv(rbuf(ideb),nb_tmp,mpi_integer,it_spmd(k),msgtyp,
112 . spmd_comm_world,status,ierror)
113
114 ideb = ideb + nb_tmp
115 END DO
116C
117 DO n = 1, nbpart
118 DO k = 1, nspmd
119 IF (n>1) THEN
120 len = (iadg(k,n) - iadg(k,n-1))*SIZE
121 ELSE
122 len = iadg(k,n)*SIZE
123 ENDIF
124
125 IF (iflag==1) THEN
126 IF(len>0)CALL write_i_c(rbuf(iadp(k)),len)
127 ELSEIF(iflag==2) THEN
128 IF(len>0)CALL write_c_c(rbuf(iadp(k)),len)
129 ENDIF
130 iadp(k) = iadp(k) + len
131 ENDDO
132 ENDDO
133 ENDIF
134C
135 DEALLOCATE(rbuf)
136#endif
137 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
Definition mpi.f:461
subroutine mpi_get_count(status, datatype, cnt, ierr)
Definition mpi.f:296
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
Definition mpi.f:480
subroutine mpi_probe(source, tag, comm, status, ierr)
Definition mpi.f:449
void write_i_c(int *w, int *len)
void write_c_c(int *w, int *len)