-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
151 lines (124 loc) · 3.91 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
CC= mpicc
# -DOVERLAP if set indicates overlapping communication
# -DTIME is defined when the main loop needs to be timed.
# Comment out accordingly which ones don't want to be used
# and recompile the code.
DEFINE+= -DOVERLAP
DEFINE+= -DTIME
CCFLAGS= -O3 -Wall -std=c99
CCFLAGS+= $(DEFINE)
LFLAGS= -lm
INC = include
SRC = src
OBJ = obj
BIN = bin
OUT = out
DATA = data
RES = res
TEST_RES = test_resources
SCRIPTS = scripts
MPLIB = $(SRC)/mplib
IMGLIB = $(SRC)/imglib
UTIL = $(SRC)/util
SER = $(SRC)/serlib
MPI2D = $(SRC)/parlib
WRAPLIB = $(SRC)/wraplib
CORR = $(SCRIPTS)/correctness
PERF = $(SCRIPTS)/performance
OVERH = $(SCRIPTS)/overheads
PLOTS = $(SCRIPTS)/plots
PBS = $(SCRIPTS)/pbs
VPATH = $(SRC) $(INC) $(MPLIB) $(IMGLIB) $(UTIL) $(SER) $(MPI2D) $(WRAPLIB)
INCLUDES = -I$(INC) -I$(MPLIB) -I$(IMGLIB) -I$(UTIL) \
-I$(MPI2D) -I$(SER) -I$(WRAPLIB)
UTIL_OBJ = $(OBJ)/mem.o $(OBJ)/args.o $(OBJ)/arralloc.o $(OBJ)/pgmio.o
IMG_OBJ = $(OBJ)/imglib.o
MP_OBJ = $(OBJ)/mplib.o
VER_OBJ = $(OBJ)/serlib.o $(OBJ)/parlib.o $(OBJ)/wraplib.o
MAIN_OBJ = $(OBJ)/main.o
.PHONY: all
## all: compile and create the executables
all: dir
make $(BIN)/image_overlap DEFINE=-DOVERLAP DEFINE+=-DTIME -B
make $(BIN)/image_no_overlap DEFINE=-DTIME -B
.PHONY: dir
## dir: create directories
dir:
mkdir -p $(BIN) $(OBJ) $(OUT)
mkdir -p $(RES)/correctness $(RES)/performance
## ctest: perform correctness tests.
.PHONY: ctest
ctest:
@chmod u+x $(CORR)/correctness_test.sh
@chmod u+x $(TEST_RES)/correctness_resources.sh
@./$(CORR)/correctness_test.sh -e $(EXEC)
## perf: perform basic performance test over a number of processes.
.PHONY: perf
perf:
@chmod u+x $(PERF)/performance.sh
@chmod u+x $(PBS)/performance.pbs
@./$(PERF)/performance.sh -e $(EXEC) -r $(REPS) -i $(ITER) \
-T perf -n 1 -t 00:20:00 \
-R $(RESERV)
## mulnodes: perform multiple nodes performance tests.
.PHONY: mulnodes
mulnodes:
@chmod u+x $(PERF)/performance.sh
@chmod u+x $(PBS)/performance.pbs
@./$(PERF)/performance.sh -e $(EXEC) -r $(REPS) -i $(ITER) \
-T mulnodes -n 1 \
-t 00:20:00 -R $(RESERV)
@./$(PERF)/performance.sh -e $(EXEC) -r $(REPS) -i $(ITER) \
-T mulnodes -n 2 \
-t 00:20:00 -R $(RESERV)
@./$(PERF)/performance.sh -e $(EXEC) -r $(REPS) -i $(ITER) \
-T mulnodes -n 3 \
-t 00:20:00 -R $(RESERV)
## plotperf: plot individual performance results
.PHONY: plotperf
plotperf:
@python $(PLOTS)/plots_$(TEST).py -v $(VER)
## plotperf_all: plot all performance results
.PHONY: plotperf_all
plotperf_all:
@make plotperf TEST=perf VER=overlap
@make plotperf TEST=perf VER=no_overlap
@make plotperf TEST=mulnodes VER=overlap
@make plotperf TEST=mulnodes VER=no_overlap
## overheads: perform basic overhead test over a number of processes.
.PHONY: overheads
overheads:
@chmod u+x $(OVERH)/overheads.sh
@chmod u+x $(PBS)/overheads.pbs
@./$(OVERH)/overheads.sh -e $(EXEC) -r $(REPS) -i 800 \
-T $(TEST) -t 00:20:00 -R $(RESERV)
## plotoverh: plot individual overhead results
.PHONY: plotoverh
plotoverh:
@python $(PLOTS)/plots_overheads.py -v $(VER)
## plotoverh_all: plot all overhead results
.PHONY: plotoverh_all
plotoverh_all:
@make plotoverh VER=overlap
@make plotoverh VER=no_overlap
## conv: runs the converter to generate the desired edge image
.PHONY: conv
conv:
@chmod u+x converter/converter.sh
@./converter/converter.sh -n $(NAME) -w $(WIDTH) -h $(HEIGHT)
# compile all c files and create the output files
$(OBJ)/%.o: %.c
$(CC) $(CCFLAGS) $(INCLUDES) -o $@ -c $<
# link the output files to create the executable
$(BIN)/image_overlap: $(UTIL_OBJ) $(IMG_OBJ) $(MP_OBJ) $(VER_OBJ) $(MAIN_OBJ)
$(CC) $^ -o $@ $(LFLAGS)
$(BIN)/image_no_overlap: $(UTIL_OBJ) $(IMG_OBJ) $(MP_OBJ) $(VER_OBJ) $(MAIN_OBJ)
$(CC) $^ -o $@ $(LFLAGS)
.PHONY: clean
## clean: clean directory
clean:
rm -rf $(OBJ)/* $(BIN)/* $(OUT)/*
.PHONY: help
# help: prints each repice's purpose
help: Makefile
@sed -n 's/^##//p' $<