      subroutine exchng1( a, nx, s, e, win, 
     *     bottom_nbr, top_nbr )
      include 'mpif.h'
      integer nx, s, e
      double precision a(0:nx+1,s-1:e+1)
      integer win, bottom_nbr, top_nbr
      integer ierr
c     Special case for IRIX
      integer*8 bottom_ghost_disp, top_ghost_disp

c --
      print *, 'Before fence'
c --      
      call MPI_WIN_FENCE( 0, win, ierr )
c Put bottom edge into bottom neighbor's top ghost cells
c See text about top_ghost_disp
      top_ghost_disp = 1 + (nx+2)*(e-s+2)
c --
      print *, 'Before put'
c --      
      if (bottom_nbr .ne. MPI_PROC_NULL) then
      call MPI_PUT( a(1,s), nx, MPI_DOUBLE_PRECISION, 
     *     bottom_nbr, top_ghost_disp, nx, 
     *     MPI_DOUBLE_PRECISION, win, ierr )
      endif
c Put top edge into top neighbor's bottom ghost cells
      bottom_ghost_disp = 1
c --
      print *, 'Before put2'
c --      
      if (top_nbr .ne. MPI_PROC_NULL) then
      call MPI_PUT( a(1,e), nx, MPI_DOUBLE_PRECISION, 
     *     top_nbr, bottom_ghost_disp, nx, 
     *     MPI_DOUBLE_PRECISION, win, ierr )
      endif
c --
      print *, 'Before fence2'
c --      
      call MPI_WIN_FENCE( 0, win, ierr )
c --
      print *, 'Before fence3'
c --      
      return
      end

