c
c	hsend1.f 1.4 92/07/01 15:21:36
c
c  Copyright 1991 Intel Corporation, Inc.
c  See the "Copyright" file for complete rights and liability information.
c
c  Node 0 sends a message to node n and sets up a handler.
c  Node 0 drops into the handler when the send completes.
c  Node n receives the message from node 0 and acknowledges same.
c
c  Requires a two-node cube.

      include 'fcube.h'

      integer      iam
      character*40 buf
      external myhandler

c  Identify self.

      iam = mynode()

c  If node 0, then ...

      if(iam .eq. 0) then
         print *, 'Starting...'

c    Send message and identify a handler procedure.

         write(buf, 100) iam
100      format('Hello from node ', i2)

         call hsend(10, buf, len(buf), 1, 0, myhandler)

         write(*, 200) iam, buf
200      format('Node ', i2, ' sent:     ', a)

c  If not node 0, then...

      else

c    Receive the message.

         call crecv(10, buf, len(buf))

c    Acknowledge receipt.

         write(*, 300) iam, buf
300      format('Node ', i2, ' received: ', a)

      endif

      end
