# Makefile for MPI-Spin model of Example 2.8 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 
PARAMS1 = -np=2 -block -chansize=2
PARAMS2 = -np=2 -buf=2 -req=4

all: msg_exchg_0 msg_exchg_1 msg_exchg_2 mpi_msg_exchg

msg_exchg_0: msg_exchg.prom
	$(MS) $(PARAMS0) msg_exchg.prom
	mscc
	./pan -n

msg_exchg_1: msg_exchg.prom
	$(MS) $(PARAMS1) msg_exchg.prom
	mscc
	./pan -n

msg_exchg_2: msg_exchg.prom
	$(MS) $(PARAMS2) msg_exchg.prom
	mscc
	./pan -n

mpi_msg_exchg: msg_exchg.c
	mpicc -o msg_exchg msg_exchg.c
	mpiexec -n 2 ./msg_exchg

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