-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·163 lines (124 loc) · 4.29 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
152
153
154
155
156
157
158
159
160
161
162
163
#
# C compiler and options for Intel
#
CC = icc
# Uncomment below to compile the affinity scheduler with locks
# DEFINE += -DLOCK -DAFFINITY -DRUNTIME -DBEST_SCHEDULE -DBEST_SCHEDULE_LOOP2
DEFINE =
CCFLAGS = -O3 -qopenmp -std=c99
CCFLAGS += -Wall
LIB= -lm -qopenmp
SRC = src
OBJ = obj
BIN = bin
RES = res
OUT = out
SCRIPTS = scripts
INC = includes
AFF = $(SRC)/affinity
LOOPS = $(SRC)/loops
OMPLIB = $(SRC)/omplib
PBS = $(SCRIPTS)/pbs
PERF = $(SCRIPTS)/performance
PLOTS = $(SCRIPTS)/plots
VPATH = $(SRC) $(OBJ) $(BIN) $(RES) $(OUT) $(SCR) $(INC) \
$(AFF) $(LOOPS) $(OMPLIB)
INCLUDES += -I$(INC) -I$(AFF) -I$(LOOPS) -I$(OMPLIB)
OMPLIB_OBJ = $(OBJ)/omplib.o
LOOPS_OBJ = $(OBJ)/workload.o
AFFINITY_OBJ = $(OBJ)/affinity.o $(OBJ)/mem.o
MAIN_OBJ = $(OBJ)/main.o
## all: compile and create the executables
.PHONY: all
all: dir
@make $(BIN)/serial -B
@make $(BIN)/runtime DEFINE=-DRUNTIME -B
@make $(BIN)/best_schedule DEFINE=-DBEST_SCHEDULE -B
@make $(BIN)/best_schedule_loop2 DEFINE=-DBEST_SCHEDULE_LOOP2 -B
@make $(BIN)/affinity DEFINE=-DAFFINITY -B
@make $(BIN)/affinity_lock DEFINE=-DAFFINITY DEFINE+=-DLOCK -B
## dir: create necessary directories
.PHONY: dir
dir:
@mkdir -p $(OBJ) $(BIN) $(OUT)
## run_tests_front: Runs all tests on the front end
.PHONY: run_tests_front
run_tests_front: runtime_test best_schedule_test best_schedule_loop2_test affinity_schedule_test performance_comparison_test
## run_tests_back: Runs all tests on the back end
.PHONY: run_tests_back
run_tests_back: runtime_test_back best_schedule_test_back best_schedule_loop2_test_back affinity_schedule_test_back performance_comparison_test_back
## plot_tests: Plots all test results
.PHONY: plot_tests
plot_tests: plot_runtime_test plot_best_schedule_test plot_best_schedule_loop2_test plot_affinity_schedule_test plot_performance_comparison_test
# Performance tests on the front end
runtime_test:
chmod u+x $(PERF)/runtime.sh
./$(PERF)/runtime.sh
best_schedule_test:
chmod u+x $(PERF)/best_schedule.sh
./$(PERF)/best_schedule.sh
best_schedule_loop2_test:
chmod u+x $(PERF)/best_schedule_loop2.sh
./$(PERF)/best_schedule_loop2.sh
affinity_schedule_test:
chmod u+x $(PERF)/affinity_schedule.sh
./$(PERF)/affinity_schedule.sh
performance_comparison_test:
chmod u+x $(PERF)/performance_comparison.sh
./$(PERF)/performance_comparison.sh
# Performance tests on the back end
runtime_test_back:
chmod u+x $(PERF)/runtime.sh
chmod u+x $(PBS)/runtime.pbs
qsub ./$(PBS)/runtime.pbs
best_schedule_test_back:
chmod u+x $(PERF)/best_schedule.sh
chmod u+x $(PBS)/best_schedule.pbs
qsub ./$(PBS)/best_schedule.pbs
best_schedule_loop2_test_back:
chmod u+x $(PERF)/best_schedule_loop2.sh
chmod u+x $(PBS)/best_schedule_loop2.pbs
qsub ./$(PBS)/best_schedule_loop2.pbs
affinity_schedule_test_back:
chmod u+x $(PERF)/affinity_schedule.sh
chmod u+x $(PBS)/affinity_schedule.pbs
qsub ./$(PBS)/affinity_schedule.pbs
performance_comparison_test_back:
chmod u+x $(PERF)/performance_comparison.sh
chmod u+x $(PBS)/performance_comparison.pbs
qsub ./$(PBS)/performance_comparison.pbs
# Plot the test results
plot_runtime_test:
python $(PLOTS)/plot_runtime.py
plot_best_schedule_test:
python $(PLOTS)/plot_best_schedule.py
plot_best_schedule_loop2_test:
python $(PLOTS)/plot_best_schedule_loop2.py
plot_affinity_schedule_test:
python $(PLOTS)/plot_affinity_schedule.py
plot_performance_comparison_test:
python $(PLOTS)/plot_performance_comparison.py
# compile all c files and create the output files
$(OBJ)/%.o: %.c
$(CC) $(CCFLAGS) $(DEFINE) $(INCLUDES) -o $@ -c $<
# link the output files to create the executable
$(BIN)/serial: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/runtime: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/best_schedule: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/best_schedule_loop2: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/affinity: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(AFFINITY_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/affinity_lock: $(OMPLIB_OBJ) $(LOOPS_OBJ) $(AFFINITY_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
## clean: clean directory
.PHONY: clean
clean:
@rm -rf $(OBJ) $(BIN) $(OUT)
# help: prints each repice's purpose
.PHONY: help
help: Makefile
@sed -n 's/^##//p' $<