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

# We check the assertions for various parameters.
# There should be no violations.

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

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

PARAMS0 = -np=3 -buf=0 -req=4
PARAMS1 = -np=4 -buf=2 -req=4
PARAMS2 = -np=5 -buf=2 -req=8

all: bcast_01 bcast_02 bcast_03 mpi_bcast

bcast_01: bcast.prom
	$(MS) $(PARAMS0) bcast.prom
	mscc -DVECTORSZ=2048
	./pan -n

bcast_02: bcast.prom
	$(MS) $(PARAMS1) bcast.prom
	mscc -DVECTORSZ=2048
	./pan -n
bcast_03: bcast.prom
	$(MS) $(PARAMS2) bcast.prom
	mscc -DVECTORSZ=4096
	./pan -n

mpi_bcast: bcast.c
	mpicc -o bcast bcast.c
	mpiexec -n 4 ./bcast

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