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

# We check the equivalence between symbolic expressions
# generated from the sequential and the parallel version.

# The associativity of addition and multiplication is 
# supported only in Real arithmetic.
# The verifier flags an error when using 
# IEEE and Herbrand equivalence

# 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_real     = -np=4 -DN=8  -buf=8 -req=8 -sym=2 
PARAMS0_ieee     = -np=4 -DN=8  -buf=8 -req=8 -sym=1 
PARAMS0_herbrand = -np=4 -DN=8  -buf=8 -req=8 -sym=0 
PARAMS1_real     = -np=5 -DN=14 -buf=8 -req=8 -sym=2
PARAMS1_ieee     = -np=5 -DN=14 -buf=8 -req=8 -sym=1
PARAMS1_herbrand = -np=5 -DN=14 -buf=8 -req=8 -sym=0

all: dotproduct_01a dotproduct_01b dotproduct_01c \
     dotproduct_02a dotproduct_02b dotproduct_02c \
     mpi_dotproduct

dotproduct_01a: dotproduct.prom
	$(MS) $(PARAMS0_real) dotproduct.prom
	mscc
	./pan -n

dotproduct_01b: dotproduct.prom
	$(MS) $(PARAMS0_ieee) dotproduct.prom
	mscc
	./pan -n

dotproduct_01c: dotproduct.prom
	$(MS) $(PARAMS0_herbrand) dotproduct.prom
	mscc
	./pan -n

dotproduct_02a: dotproduct.prom	
	$(MS) $(PARAMS1_real) dotproduct.prom
	mscc
	./pan -n

dotproduct_02b: dotproduct.prom	
	$(MS) $(PARAMS1_ieee) dotproduct.prom
	mscc
	./pan -n

dotproduct_02c: dotproduct.prom	
	$(MS) $(PARAMS1_herbrand) dotproduct.prom
	mscc
	./pan -n

mpi_dotproduct: dotproduct.c
	mpicc -DN=8 -o dotproduct dotproduct.c
	mpiexec -n 3 ./dotproduct

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