OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gatherf.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/.
23!||====================================================================
24!|| spmd_gatherf ../engine/source/mpi/anim/spmd_gatherf.F
25!||--- called by ------------------------------------------------------
26!|| genani ../engine/source/output/anim/generate/genani.F
27!||--- calls -----------------------------------------------------
28!|| write_r_c ../common_source/tools/input_output/write_routtines.c
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.f90
31!||====================================================================
32 SUBROUTINE spmd_gatherf(V,WEIGHT,NODGLOB,NUM)
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"
38#include "spmd.inc"
39C-----------------------------------------------
40C C o m m o n B l o c k s
41C-----------------------------------------------
42#include "com01_c.inc"
43#include "com04_c.inc"
44#include "task_c.inc"
45#include "spmd_c.inc"
46C-----------------------------------------------
47C D u m m y A r g u m e n t s
48C-----------------------------------------------
49 real
50 . v(*)
51 INTEGER WEIGHT(*),NODGLOB(*),NUM,SRECBUF
52C-----------------------------------------------
53C L O C A L V A R I A B L E S
54C-----------------------------------------------
55#ifdef MPI
56 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
57 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2
58
59 DATA msgoff/7014/
60 DATA msgoff2/7015/
61 REAL, DIMENSION(:) , ALLOCATABLE :: BUFSR
62 INTEGER, DIMENSION(:) , ALLOCATABLE :: IBUF
63C Tableau utilise par proc 0
64 REAL, DIMENSION(:) , ALLOCATABLE :: XGLOB
65C=======================================================================
66 ALLOCATE(bufsr(numnodm), ibuf(numnodm))
67 ALLOCATE(xglob(num))
68
69 xglob = 1000000
70 bufsr = 100000
71
72 IF (ispmd/=0) THEN
73 siz = 0
74 DO i=1,numnod
75 IF (weight(i)==1) THEN
76 siz = siz + 1
77 ibuf(siz) = nodglob(i)
78 bufsr(siz) = v(i)
79 END IF
80 END DO
81
82C a cause de la version simple precision, on ne peux pas metre l'entier
83C dans le buffer flottant car on n a que 2puiss 24 bits dispo ~ 16 Million
84C de noeuds au max
85
86 msgtyp = msgoff2
87 CALL mpi_send(ibuf,siz,mpi_integer,it_spmd(1),msgtyp,
88 . spmd_comm_world,ierror)
89
90 msgtyp = msgoff
91 CALL mpi_send(bufsr,siz,mpi_real,it_spmd(1),msgtyp,
92 . spmd_comm_world,ierror)
93
94 ELSE
95 siz = 0
96 DO i=1,numnod
97 IF (weight(i)==1) THEN
98 siz = siz +1
99 ng = nodglob(i)
100 xglob(ng) = v(i)
101 ENDIF
102 ENDDO
103
104 DO i=2,nspmd
105
106C Reception du buffer entier des adresses NODGLOB
107 msgtyp = msgoff2
108
109 CALL mpi_probe(it_spmd(i),msgtyp,
110 . spmd_comm_world,status,ierror)
111 CALL mpi_get_count(status,mpi_integer,siz,ierror)
112
113 CALL mpi_recv(ibuf,siz,mpi_integer,it_spmd(i),msgtyp,
114 . spmd_comm_world,status,ierror)
115
116C Reception du buffer flottant des adresses NODGLOB
117
118 msgtyp = msgoff
119 CALL mpi_recv(bufsr,siz,mpi_real,it_spmd(i),msgtyp,
120 . spmd_comm_world,status,ierror)
121
122 nrec = siz
123
124 DO k = 1, nrec
125 ng = ibuf(k)
126 xglob(ng) = bufsr(k)
127 ENDDO
128 ENDDO
129 CALL write_r_c(xglob,numnodg)
130
131 ENDIF
132 DEALLOCATE(bufsr,ibuf,xglob)
133
134#endif
135 RETURN
136 END
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
subroutine spmd_gatherf(v, weight, nodglob, num)
void write_r_c(float *w, int *len)