File: waitcom.f

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (40 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
      program main
      implicit none
      integer maxloop
      parameter (maxloop = 67 )
      integer buf,me,nproc,loop,lenmes,node, received
      integer nnodes, nodeid 
c
      call pbeginf
c
      nproc = nnodes()
      me = nodeid()
      if(nproc.lt.3)then
          print *,'min 3 processes required ',nproc
          call parerr(0)
      endif
      received =0
      do loop = 1, maxloop
          node = Mod(loop,2)+1
          if(me.eq.0) then
            call snd(loop, buf, 1, node, 0)
          endif
          if(me.eq.node) then
             received = received +1
             call rcv(loop, buf, 1, lenmes, 0, node, 1)
          endif
      enddo
      if(me.eq.0)print *,'0: waiting for coms to node 1 to complete'
      call waitcom(1)
      if(me.eq.0)print *,'0: waiting for remaining coms to complete'
      call waitcom(-1)

      if(me.eq.0) then
          print *,'node=',me, maxloop,' messages sent asynchronously'
      else
          print *, 'node=',me,  received,' messages received'
      endif

c
      call pend
      end