31
32
33
34
35
36
37
38 USE spmd_comm_world_mod, ONLY : spmd_comm_world
39#include "implicit_f.inc"
40
41
42
43#include "spmd.inc"
44
45
46
47#include "com01_c.inc"
48#include "task_c.inc"
49
50
51
52 INTEGER SRBUF(*), LEN, LRECV
53
54
55
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/
63
64
65
66
67 s1 = 1
68
69
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
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
92
93 IF(ispmd == 0) THEN
94 DO i=1,lrecv
95 srbuf(i) = srbuf2(i)
96 ENDDO
97 ENDIF
98 DEALLOCATE(srbuf2)
99
100
101#endif
102 RETURN
subroutine mpi_barrier(comm, ierr)
subroutine mpi_gather(sendbuf, cnt, datatype, recvbuf, reccnt, rectype, root, comm, ierr)
subroutine mpi_gatherv(sendbuf, cnt, datatype, recvbuf, reccnt, displs, rectype, root, comm, ierr)