c
c	cubeinfo1.f 1.4 92/07/01 15:18:45
c
c  Copyright 1991 Intel Corporation, Inc.
c  See the "Copyright" file for complete rights and liability information.
c
c  Part 1 of 2:
c    Runs on the host (this example assumes the host is an SRM).
c    Gets two cubes ("alpha" and "beta"), makes "alpha" the current cube,
c      and loads the node program defined in the file "nodeprog.f"
c      on all nodes of alpha.

      include 'fcube.h'

      character*80 msg
      character*16 cubetbl(slotsize, 10)

c  Get two cubes ("alpha" and "beta").
c    Note the different "keep" parameters.  Setting keep = 0 for "alpha"
c    means that "alpha" will be released automatically when this program
c    terminates, while setting keep = 1 for "beta" means that "beta" must
c    be released explicitly.

      call getcube('alpha', '2', '', 0, '')
      call getcube('beta', '1', '', 1, '')

c  Display information about all cubes allocated from this SRM.

      do 10, i = 1, cubeinfo(cubetbl, 10, 2)

         write(*, 100) i,
     1                 cubetbl(cubename, i),
     2                 cubetbl(username, i),
     3                 cubetbl(cubetype, i)
100      format(/, 'Cube Number ', i3, ': ',
     1          /, '     Name:   ', a,
     2          /, '     Owner:  ', a,
     3          /, '     Type:   ', a)

c    Make "alpha" the currently attached cube.

         if(cubetbl(cubename, i) .eq. 'alpha') then

            call attachcube('alpha')

c    Set host PID.

            call setpid(100)

c    Load "nodeprog" program on all nodes of current cube.

            call load("nodeprog", -1, 0)

         endif

10    continue

c  Receive and display first type 10 message from cube.

      call crecv(10, msg, len(msg))

      write (*, 200) msg
200   format('Host received: ', a)

c  Wait until all nodes have responded.

      call waitall(-1, -1)

c  Kill and clean up cube "alpha."

      call killcube(-1, 0)

c  Release cube "beta" explicitly (it was gotten with keep = 1).

      call relcube('beta')

      end
