home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / adaptor / examples / dalib / generic / nodesend.f < prev    next >
Encoding:
Text File  |  1993-06-28  |  765 b   |  29 lines

  1.       program nodesend
  2.  
  3. c     Note: This program should only demonstrate the functionality, but
  4. c           it is a very inefficient program
  5.  
  6.       parameter (N=100)
  7.       real ra (N), a(N), s
  8. cmf$  layout ra(:serial)
  9.  
  10.       integer i, N
  11.  
  12.       do i = 1, N
  13.          a(i) = i     ! initialize the distributed array
  14.       end do
  15.  
  16.       do i = 1, N
  17.          x = a(i)     ! node_get, host_get, indeed N broadcasts
  18.          ra(i) = x    ! have_i_value
  19.       end do
  20.  
  21.       s = sum (ra)    ! prove that host has correct values
  22.       print *, 'Result is ', s, ' should be ', N * (N+1) / 2
  23.  
  24.       a = a + ra(N:1:-1)  ! local operation on nodes
  25.       s = sum (a)     ! prove that nodes have correct values
  26.       print *, 'Result is ', s, ' should be ', N * (N+1) 
  27.  
  28.       end
  29.