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