LIBTHREADS=pthread
RUN=/home/mic/lampi-1.5.10/bin/mpirun -ssh -threads -np
LAMPI=/home/mic/lampi-1.5.10
LCC=gcc -g

EXECS=stereo stereo.o stereoseq stereoseq.o stereodeal stereodeal.o stereo3st stereo3st.o

# set up for stereoseq
SEQPROCS=1
SEQHOSTS=bw64node20

# set up for stereo3st 
ST3PROCS=1,1,1
ST3HOSTS=bw64node20,bw64node35,bw64node39

# set up for stereodeal with 1 worker
D1PROCS=1,1,1
D1HOSTS=bw64node20,bw64node35,bw64node39

# set up for stereodeal with 2 deal workers
D2PROCS=1,1,1,1
D2HOSTS=bw64node20,bw64node35,bw64node39,bw64node40

# set up for stereodeal with 3 deal workers
D3PROCS=1,1,1,1,1
D3HOSTS=bw64node20,bw64node35,bw64node39,bw64node40,bw64node41

# set up for stereodeal with 4 deal workers
D4PROCS=1,1,1,1,1,1
D4HOSTS=bw64node20,bw64node35,bw64node39,bw64node40,bw64node41,bw64node42

# set up for stereodeal with 5 deal workers
D5PROCS=1,1,1,1,1,1,1
D5HOSTS=bw64node20,bw64node35,bw64node39,bw64node40,bw64node41,bw64node42,bw64node43

# set up for stereodeal with 6 deal workers
D6PROCS=1,1,1,1,1,1,1,1
D6HOSTS=bw64node20,bw64node35,bw64node39,bw64node40,bw64node41,bw64node42,bw64node43,bw64node44

all: runstereodeal

stereoseq:		stereoseq.c stereo.h ../pipelinev.c ../dealsupport.c ../eSkel_calltree.c
			$(LCC) -I$(LAMPI)/include -c stereoseq.c -o stereoseq.o
			$(LCC) -o stereoseq stereoseq.o -lm -L$(LAMPI)/lib -lmpi -l$(LIBTHREADS)

runstereoseq:		stereoseq
			$(RUN) $(SEQPROCS) -H $(SEQHOSTS)  stereoseq

stereo3st: 		stereo3st.c stereo.h ../pipelinev.c ../dealsupport.c ../eSkel_calltree.c
			$(LCC) -I$(LAMPI)/include -c stereo3st.c -o stereo3st.o
			$(LCC) -o stereo3st stereo3st.o -lm -L$(LAMPI)/lib -lmpi -l$(LIBTHREADS)

runstereo3st:		stereo3st
			$(RUN)  $(ST3PROCS) -H $(ST3HOSTS) stereo3st

stereodeal: 		stereodeal.c stereo.h
			$(LCC) -I$(LAMPI)/include -c stereodeal.c -o stereodeal.o
			$(LCC) -o stereodeal stereodeal.o -lm -L$(LAMPI)/lib -lmpi -l$(LIBTHREADS)

runstereodeal1:		stereodeal
			$(RUN)  $(D1PROCS) -H $(D1HOSTS) stereodeal

runstereodeal2:		stereodeal
			$(RUN)  $(D2PROCS) -H $(D2HOSTS) stereodeal

runstereodeal3:		stereodeal
			$(RUN)  $(D3PROCS) -H $(D3HOSTS) stereodeal

runstereodeal4:		stereodeal
			$(RUN)  $(D4PROCS) -H $(D4HOSTS) stereodeal

runstereodeal5:		stereodeal
			$(RUN)  $(D5PROCS) -H $(D5HOSTS) stereodeal

runstereodeal6:		stereodeal
			$(RUN)  $(D6PROCS) -H $(D6HOSTS) stereodeal

MPIstereodeal: 		MPIstereodeal.c stereo.h
			$(LCC) -I$(LAMPI)/include -c MPIstereodeal.c -o MPIstereodeal.o
			$(LCC) -o MPIstereodeal MPIstereodeal.o -lm -L$(LAMPI)/lib -lmpi -l$(LIBTHREADS)

runMPIstereodeal1:		MPIstereodeal
			$(RUN)  $(D1PROCS) -H $(D1HOSTS) MPIstereodeal

runMPIstereodeal2:		MPIstereodeal
			$(RUN)  $(D2PROCS) -H $(D2HOSTS) MPIstereodeal

runMPIstereodeal3:		MPIstereodeal
			$(RUN)  $(D3PROCS) -H $(D3HOSTS) MPIstereodeal

runMPIstereodeal4:		MPIstereodeal
			$(RUN)  $(D4PROCS) -H $(D4HOSTS) MPIstereodeal

runMPIstereodeal5:		MPIstereodeal
			$(RUN)  $(D5PROCS) -H $(D5HOSTS) MPIstereodeal

runMPIstereodeal6:		MPIstereodeal
			$(RUN)  $(D6PROCS) -H $(D6HOSTS) MPIstereodeal

clean:
			rm *~ $(EXECS)

