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

# The verifier flags an error because unmatching types are specified
# while sending and receiving message

# 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=2
PARAMS1 = -np=2 -block -chansize=4
PARAMS2 = -np=2 -buf=2 -req=4

all: sendrecv_unmatch_0 sendrecv_unmatch_1 sendrecv_unmatch_2 \
     mpi_sendrecv_unmatch

sendrecv_unmatch_0: sendrecv_unmatch.prom
	$(MS) $(PARAMS0) sendrecv_unmatch.prom
	mscc
	./pan -n
	./pan -n -r

sendrecv_unmatch_1: sendrecv_unmatch.prom
	$(MS) $(PARAMS1) sendrecv_unmatch.prom
	mscc
	./pan -n
	./pan -n -r

sendrecv_unmatch_2: sendrecv_unmatch.prom
	$(MS) $(PARAMS2) sendrecv_unmatch.prom
	mscc
	./pan -n
	./pan -n -r

mpi_sendrecv_unmatch: sendrecv_unmatch.c
	mpicc -o sendrecv_unmatch sendrecv_unmatch.c
	mpiexec -n 2 ./sendrecv_unmatch

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