# Makefile for MPI-Spin model of Example 2.4 from
# "MPI: The Complete Reference, vol. 1", 2nd ed.

# We check the assertions (in addition to generic
# properties) for various parameters.   There should
# be no violations.

# Author: Pujan Kafle <kafle@cis.udel.edu>
# Created: 19-jul-2007
# Last modified: 19-jul-2007

PREP        = rm -f pan* *trail mpi-spin-init.c
MS          = $(PREP); ms -notest -nocancel -noprobe -dl

PARAMS0 = -np=2 -block -chansize=0 -dl 
PARAMS1 = -np=2 -block -chansize=2 -dl
PARAMS2 = -np=2 -buf=4 -req=8 -dl

all: sendrecv_match_0 sendrecv_match_1 sendrecv_match_2 \
     mpi_sendrecv_match

sendrecv_match_0: sendrecv_match.prom
	$(MS) $(PARAMS0) sendrecv_match.prom
	mscc
	./pan -n

sendrecv_match_1: sendrecv_match.prom
	$(MS) $(PARAMS1) sendrecv_match.prom
	mscc
	./pan -n

sendrecv_match_2: sendrecv_match.prom
	$(MS) $(PARAMS2) sendrecv_match.prom
	mscc
	./pan -n
	
mpi_sendrecv_match: sendrecv_match.c
	mpicc -o sendrecv_match sendrecv_match.c
	mpiexec -n 2 ./sendrecv_match

clean:
	-rm -f sendrecv_match pan* *.trail *.out mpi-spin-init.c *.err *~
