OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gath_collective.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_gath_collective (srbuf, len, lrecv)

Function/Subroutine Documentation

◆ spmd_gath_collective()

subroutine spmd_gath_collective ( integer, dimension(*) srbuf,
integer len,
integer lrecv )

Definition at line 30 of file spmd_gath_collective.F.

31C Description:
32C Collective communication version of SPMD_IGATH
33C expected to be less efficient than SPMD_IGATH
34C But useful to debug MPI problems: less pending communication
35C-----------------------------------------------
36C I m p l i c i t T y p e s
37C-----------------------------------------------
38 USE spmd_comm_world_mod, ONLY : spmd_comm_world
39#include "implicit_f.inc"
40C-----------------------------------------------------------------
41C M e s s a g e P a s s i n g
42C-----------------------------------------------
43#include "spmd.inc"
44C-----------------------------------------------
45C C o m m o n B l o c k s
46C-----------------------------------------------
47#include "com01_c.inc"
48#include "task_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C-----------------------------------------------
52 INTEGER SRBUF(*), LEN, LRECV
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
56#ifdef MPI
57 INTEGER MSGOFF,MSGOFF2,MSGTYP,INFO,I,K,ATID,ATAG,ALEN,RLEN,S1
58 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
59 INTEGER SIZES(NSPMD),POINTERS(NSPMD)
60 INTEGER,ALLOCATABLE,DIMENSION(:) :: SRBUF2
61 DATA msgoff/7013/
62 DATA msgoff2/7068/
63C-----------------------------------------------
64C S o u r c e L i n e s
65C-----------------------------------------------
66
67 s1 = 1
68
69 ! Send Local sizes to Zero
70 CALL mpi_gather(len,s1,mpi_integer,sizes,s1,mpi_integer,0,spmd_comm_world,ierror)
71
72
73 IF(ispmd == 0) THEN
74 lrecv = 0
75 DO i=1,nspmd
76 lrecv = lrecv + sizes(i)
77 ENDDO
78 ! Pointers starts at 0
79 pointers(1) = 0
80 DO i=2,nspmd
81 pointers(i) = pointers(i-1)+sizes(i-1)
82 ENDDO
83 ALLOCATE(srbuf2(lrecv))
84 ELSE
85 ALLOCATE(srbuf2(1))
86 ENDIF
87
88 CALL mpi_gatherv(srbuf,len,mpi_integer,srbuf2,sizes,pointers,mpi_integer,0,spmd_comm_world,ierror)
89
90
91 CALL mpi_barrier(spmd_comm_world,ierror)
92
93 IF(ispmd == 0) THEN
94 DO i=1,lrecv
95 srbuf(i) = srbuf2(i)
96 ENDDO
97 ENDIF
98 DEALLOCATE(srbuf2)
99
100C
101#endif
102 RETURN
subroutine mpi_barrier(comm, ierr)
Definition mpi.f:188
subroutine mpi_gather(sendbuf, cnt, datatype, recvbuf, reccnt, rectype, root, comm, ierr)
Definition mpi.f:56
subroutine mpi_gatherv(sendbuf, cnt, datatype, recvbuf, reccnt, displs, rectype, root, comm, ierr)
Definition mpi.f:76