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 LEN, FR_WALL(*)
54 . fs(len)
55
56
57
58#ifdef MPI
59 INTEGER MSGOFF,MSGOFF2,MSGTYP,INFO,P,PMAIN, LOC_PROC, J
60 DATA msgoff/110/
61 DATA msgoff2/111/
62 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
64 . ftmp(len)
65
66
67
68 pmain = fr_wall(nspmd+2)
69 loc_proc = ispmd+1
70 IF(loc_proc==pmain) THEN
71 DO p = 1, nspmd
72 IF(loc_proc/=p.AND.fr_wall(p)/=0)THEN
73 msgtyp = msgoff
74 CALL mpi_recv(ftmp ,len ,real ,it_spmd(p),
75 . msgtyp,spmd_comm_world,status,ierror )
76
77 DO j = 1, len
78 fs(j) = fs(j) + ftmp(j)
79 END DO
80 ENDIF
81 ENDDO
82
83 DO p = 1, nspmd
84 IF(loc_proc/=p.AND.fr_wall(p)/=0)THEN
85 msgtyp = msgoff2
86 CALL mpi_send(fs ,len ,real ,it_spmd(p),
87 . msgtyp,spmd_comm_world,ierror)
88 ENDIF
89 ENDDO
90
91 ELSE
92 msgtyp = msgoff
93 CALL mpi_send(fs ,len ,real ,it_spmd(pmain),
94 . msgtyp,spmd_comm_world,ierror)
95 msgtyp = msgoff2
96 CALL mpi_recv(fs ,len ,real ,it_spmd(pmain),
97 . msgtyp,spmd_comm_world,status,ierror )
98 ENDIF
99
100#endif
101 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)