c
c Transmit a message in a two process system.
c
	program trivial

#include <mpif.h>

	integer*4 BUFSIZE

	parameter (BUFSIZE = 64)

	integer*4	buffer(BUFSIZE)
	integer		rank
	integer		size
	integer 	status(MPI_STATUS_SIZE)

c
c Initialize MPI.
c
	call MPI_INIT(ierror)
c
c Error check the number of processes.
c Determine my rank in the world group.
c The sender will be rank 0 and the receiver, rank 1.
c
	call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)

	if (size .ne. 2) then
		call MPI_FINALIZE(ierror)
		stop
	endif

	call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
c
c As rank 0, send a message to rank 1.
c
	if (rank .eq. 0) then
		call MPI_SEND(buffer(1), BUFSIZE, MPI_INTEGER,
     +				1, 11, MPI_COMM_WORLD, ierror)
c
c As rank 1, receive a message from rank 0.
c
	else
		call MPI_RECV(buffer(1), BUFSIZE, MPI_INTEGER,
     +				0, 11, MPI_COMM_WORLD, status, ierror)      
	endif

	call MPI_FINALIZE(ierror)
	stop
	end
