c
c This is a non-blocking exchange.  
	subroutine nbexchng1( a, nx, s, e, comm1d, 
     *                        nbrbottom, nbrtop, flag  )
	integer nx, s, e, flag
	double precision a(0:nx+1,s-1:e+1)
	integer comm1d
	integer nbrbottom, nbrtop
	include 'mpif.h'
	integer statuses(MPI_STATUS_SIZE,4), ierr
        integer handles(4)
	save handles
c
	if (flag .eq. 0) then
c
c Begin the communications (start both receives and then both sends)
c
	    call MPI_irecv( a(1,s-1), nx, 
     *                     MPI_DOUBLE_PRECISION, 
     *                     nbrbottom, 0, comm1d, handles(1), ierr )
            call MPI_irecv( a(1,e+1), nx, 
     *                     MPI_DOUBLE_PRECISION,
     *                     nbrtop, 1, comm1d, handles(2), ierr )
            call MPI_isend( a(1,e), nx, MPI_DOUBLE_PRECISION,
     *                     nbrtop, 0, comm1d, handles(3), ierr )
            call MPI_isend( a(1,s), nx, MPI_DOUBLE_PRECISION,
     *                     nbrbottom, 1, comm1d, handles(4), ierr ) 
        else
c
c Complete all of the sends and receives
c
	    call MPI_Waitall( 4, handles, statuses, ierr ) 
	endif
	return
	end

