37
38
39
40 USE spmd_comm_world_mod, ONLY : spmd_comm_world
41#include "implicit_f.inc"
42
43
44
45#include "spmd.inc"
46
47
48
49#include "com01_c.inc"
50#include "task_c.inc"
51
52
53
54 INTEGER LEN
56 . lsum(*), lsumt(*)
57
58
59
60#ifdef MPI
61 INTEGER MSGOFF, MSGOFF2,ITAG, REQ(2), TSTAT(MPI_STATUS_SIZE,2), IERR,
62 . I, II, REQ1(NSPMD-1), J,
63 . STAT1(MPI_STATUS_SIZE,NSPMD-1)
65 . lsumc(len)
66
67 DATA msgoff/186/
68 DATA msgoff2/187/
69
70 IF (ispmd/=0) THEN
71 itag=msgoff
72 CALL mpi_isend(lsum, len, real, it_spmd(1), itag,
73 . spmd_comm_world, req(1), ierr)
74
75 itag=msgoff2
76 CALL mpi_irecv(lsumt, len, real, it_spmd(1), itag,
77 . spmd_comm_world, req(2), ierr)
78
80 ELSE
81 DO i=1,len
82 lsumt(i)=lsum(i)
83 ENDDO
84
85 DO i=1,nspmd-1
86 ii=i+1
87 itag=msgoff
88 CALL mpi_irecv(lsumc, len, real, it_spmd(ii), itag,
89 . spmd_comm_world, req1(1), ierr)
90 CALL mpi_wait(req1(1), stat1(1,1), ierr)
91
92 DO j=1,len
93 lsumt(j)=lsumt(j)+lsumc(j)
94 ENDDO
95 ENDDO
96
97 DO i=1,nspmd-1
98 ii=i+1
99 itag=msgoff2
100 CALL mpi_isend(lsumt, len, real, it_spmd(ii), itag,
101 . spmd_comm_world, req1(i), ierr)
102 ENDDO
103
105 ENDIF
106
107#endif
108 RETURN
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
subroutine mpi_wait(ireq, status, ierr)
subroutine mpi_waitall(cnt, array_of_requests, status, ierr)
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)