home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adaptor.zip / adapt.zip / adaptor / examples / dalib / move / move3.f < prev    next >
Text File  |  1993-06-28  |  2KB  |  89 lines

  1.       program move3
  2.  
  3.       real a(10,10,10), ha(10,10,10), ha1(10,10,10)
  4. cmf$  layout ha(:host), ha1(:host)
  5.  
  6.       real b(10,10), hb(10,10), hb1(10,10)
  7. cmf$  layout hb(:host), hb1(:host)
  8.  
  9.       integer i, j, k, errors, switch
  10.  
  11.       call cmf_random (a)
  12.       call cmf_random (b)
  13.  
  14.       ha = a
  15.       hb = b
  16.  
  17.       print *, 'Initialisation is ready'
  18.       print *, 'Chosse switch (1-6) : '
  19.       read  *, switch
  20.  
  21. c     now operate on distributed arrays, make the same with host
  22.  
  23.       if (switch .eq. 1) then
  24.          print * , 'one -> one'
  25.          b(3:6,4) = a(2:5,5,7)
  26.          hb(3:6,4) = ha(2:5,5,7)
  27.       end if
  28. c
  29.       if (switch .eq. 2) then
  30.          print * , 'many -> many'
  31.          b(2:5,2:5) = a(3:6,4,3:6)
  32.          hb(2:5,2:5) = ha(3:6,4,3:6)
  33.       end if
  34.  
  35.       if (switch .eq. 3) then
  36.          print *, 'many -> one'
  37.          a(4:8,4:8,3) = b(5:9,2:6)
  38.          ha(4:8,4:8,3) = hb(5:9,2:6)
  39.       end if
  40.  
  41.       if (switch .eq. 4) then
  42.          print *, 'one -> many'
  43.          b(5:9,2:6) = a(6:10,1:5,3)
  44.          hb(5:9,2:6) = ha(6:10,1:5,3)
  45.       end if
  46.  
  47.       if (switch .eq. 5) then
  48.          print *, 'full contiguous'
  49.          b(1:10,2:8) = a(1:10,3:9,4)
  50.          hb(1:10,2:8) = ha(1:10,3:9,4)
  51.       end if
  52.  
  53.       if (switch .eq. 6) then
  54.          print *, 'shifting in dim1'
  55.          a(2:9,2:9,1:8) = a(2:9,2:9,2:9)
  56.          ha(2:9,2:9,1:8) = ha(2:9,2:9,2:9)
  57.       end if
  58.  
  59. c     now compare distributed arrays with host arrays
  60.  
  61.       print *,'Operations are finished'
  62.  
  63.       ha1 = a
  64.       hb1 = b
  65. c
  66. c     ha1 == ha ?,  hb1 == b ?
  67.  
  68.       print *,'Now checking (this may take a while)'
  69.  
  70.       errors = 0
  71.       do k = 1, 10
  72.        do j = 1, 10
  73.         do i = 1, 10
  74.           if (ha(i,j,k) .ne. ha1(i,j,k)) then
  75.              print *, 'HA for i, j, k = ', i, j, k
  76.              errors = errors + 1
  77.           end if
  78.         end do
  79.         if (hb(j,k) .ne. hb1(j,k)) then
  80.              print *, 'HB for j, k = ', j, k
  81.              errors = errors + 1
  82.         end if
  83.        end do
  84.       end do
  85.  
  86.       print *, 'Errors = ', errors
  87.  
  88.       end
  89.