-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (74 loc) · 2.1 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
MF= Makefile
# set compiler command: icc ...
CC = icc
CCFLAGS = -O3 -qopenmp -std=c99
CCFLAGS += -Wall
LIB = -lm
DEFINE =
# set various paths
SRC = src
OBJ = obj
BIN = bin
RES = res
OUT = out
SCRIPTS = scripts
INC = includes
AFF = $(SRC)/affinity
LOO = $(SRC)/loops
OMP = $(SRC)/omplib
UTI = $(SRC)/utils
SCN = $(SCRIPTS)/new
INCLUDES += -I$(INC) -I$(AFF) -I$(LOO) -I$(OMP) -I$(UTI)
VPATH = $(SRC) $(AFF) $(LOO) $(OMP) $(UTI)
MAIN_OBJ = $(OBJ)/main.o
AFF_OBJ = $(OBJ)/affinity.o
LOO_OBJ = $(OBJ)/workload.o
OMP_OBJ = $(OBJ)/omplib.o
UTI_OBJ = $(OBJ)/mem.o
# set executable name
AFFINITY = affinity
SERIAL = serial
RUNTIME = runtime
BSL1 = best_schedule_loop_1
BSL2 = best_schedule_loop_2
## dir: create all necessary directories
.PHONY: dir
dir:
@mkdir -p $(OBJ) $(BIN) $(OUT)
## clean: clean all directories
.PHONY: clean
clean:
@rm -rf $(OBJ) $(BIN) $(OUT)
# here is the make command, and using different flag to compile
.PHONY: all
all: dir
@make $(BIN)/$(SERIAL) -B
@make $(BIN)/$(AFFINITY) DEFINE=-DAFFINITY -B
@make $(BIN)/$(RUNTIME) DEFINE=-DRUNTIME -B
@make $(BIN)/$(BSL1) DEFINE=-DBEST_SCHEDULE_LOOP_1 -B
@make $(BIN)/$(BSL2) DEFINE=-DBEST_SCHEDULE_LOOP_2 -B
$(OBJ)/%.o: %.c
$(CC) $(CCFLAGS) $(DEFINE) $(INCLUDES) -o $@ -c $<
$(BIN)/$(SERIAL): $(OMP_OBJ) $(UTI_OBJ) $(LOO_OBJ) $(AFF_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/$(AFFINITY): $(OMP_OBJ) $(UTI_OBJ) $(LOO_OBJ) $(AFF_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/$(RUNTIME): $(OMP_OBJ) $(UTI_OBJ) $(LOO_OBJ) $(AFF_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/$(BSL1): $(OMP_OBJ) $(UTI_OBJ) $(LOO_OBJ) $(AFF_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
$(BIN)/$(BSL2): $(OMP_OBJ) $(UTI_OBJ) $(LOO_OBJ) $(AFF_OBJ) $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
# Automatically Running Script to test
.PHONY: test
test:
chmod u+x $(SCRIPTS)/autotest.sh
./$(SCRIPTS)/autotest.sh
.PHONY: backend_test
backend_test:
chmod u+x $(SCRIPTS)/autotest.sh
chmod u+x $(SCRIPTS)/autotest_backend.pbs
qsub ./$(SCRIPTS)/autotest_backend.pbs
.PHONY: plot
plot:
python $(SCRIPTS)/plot.py