-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
95 lines (77 loc) · 2.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
CC=clang
PLATFORM_MK=./common/c.mk
include $(PLATFORM_MK)
BENCH_MK=$(BENCH_DIR)/../Makefile
include $(BENCH_MK)
SRC_MK=$(BENCH_DIR)/src/Makefile
include $(SRC_MK)
LD_PRELOAD=$(GOMP_LIB)
ifeq ($(OMP_LIB),gomp)
LD_PRELOAD=$(GOMP_LIB)
endif
ifeq ($(OMP_LIB),iomp)
LD_PRELOAD=$(IOMP_LIB)
endif
ifeq ($(OMP_LIB),mtsp)
LD_PRELOAD=$(MTSP_LIB)
endif
$(BENCH_DIR)/build/$(BENCH_NAME):
ifeq ($(TGT_ARCH),gpu)
make compile
else
make compileSimple
endif
$(BENCH_DIR)/build:
mkdir $(BENCH_DIR)/build
$(BENCH_DIR)/log:
mkdir $(BENCH_DIR)/log
cleanbin:
rm -rf $(BENCH_DIR)/build/*
cleanlog:
rm -rf $(BENCH_DIR)/log/*
cleanall: cleanbin cleanlog
compile:
ifeq ($(TGT_ARCH),gpu)
make compileGPU
else
make compileSimple
endif
compileSimple: $(BENCH_DIR)/build $(BENCH_DIR)/log
echo "Compiling" $(BENCH_NAME); \
echo "\n---------------------------------------------------------" >> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
date >> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
echo "$(CC) $(COMMON_FLAGS) $(BENCH_FLAGS) $(AUX_SRC) $(SRC_OBJS) -o $(BENCH_DIR)/build/$(BENCH_NAME)" 2>> $(BENCH_DIR)/log/$(NAME).compile; \
$(CC) $(COMMON_FLAGS) $(BENCH_FLAGS) $(AUX_SRC) $(SRC_OBJS) -o $(BENCH_DIR)/build/$(BENCH_NAME) 2>> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
echo ""
compileGPU: $(BENCH_DIR)/build $(BENCH_DIR)/log
echo "Compiling" $(BENCH_NAME); \
echo "\n---------------------------------------------------------" >> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
date >> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
echo "$(CC) $(COMMON_FLAGS) $(BENCH_FLAGS) $(AUX_SRC) $(SRC_OBJS) -o $(BENCH_DIR)/build/$(BENCH_NAME)" 2>> $(BENCH_DIR)/log/$(NAME).compile; \
$(CC) $(COMMON_FLAGS) $(BENCH_FLAGS) $(AUX_SRC) $(SRC_OBJS) -o $(BENCH_DIR)/build/$(BENCH_NAME) 2>> $(BENCH_DIR)/log/$(BENCH_NAME).compile; \
rm -f kernel*.cl~
mv kernel* $(BENCH_DIR)/build/; \
echo ""
run: $(BENCH_DIR)/build/$(BENCH_NAME)
cd $(BENCH_DIR)/build;\
echo "Running" $(BENCH_NAME); \
echo "./$(BENCH_NAME) $(INPUT_FLAGS)" >> ../log/$(BENCH_NAME).execute; \
./$(BENCH_NAME) $(INPUT_FLAGS) > ../log/$(BENCH_NAME).tmp; \
cat ../log/$(BENCH_NAME).tmp; \
cat ../log/$(BENCH_NAME).tmp >> ../log/$(BENCH_NAME).execute; \
rm ../log/$(BENCH_NAME).tmp; \
echo "\n"
runmali: $(BENCH_DIR)/build/$(BENCH_NAME)
cd $(BENCH_DIR)/build;\
echo "Copying files to device"; \
adb shell "mkdir -p /data/local/medium/$(BENCH_DIR)"; \
adb push ../build /data/local/medium/$(BENCH_DIR)/build; \
adb push ../input /data/local/medium/$(BENCH_DIR)/input; \
echo "\nRunning" $(BENCH_NAME); \
echo "./$(BENCH_NAME) $(INPUT_FLAGS)" >> ../log/$(BENCH_NAME).execute; \
adb shell "cd /data/local/medium/$(BENCH_DIR)/build; ./$(BENCH_NAME) $(INPUT_FLAGS) > $(BENCH_NAME).tmp"; \
adb pull "/data/local/medium/$(BENCH_DIR)/build/$(BENCH_NAME).tmp" ../log/$(BENCH_NAME).tmp; \
cat ../log/$(BENCH_NAME).tmp; \
cat ../log/$(BENCH_NAME).tmp >> ../log/$(BENCH_NAME).execute; \
rm ../log/$(BENCH_NAME).tmp; \
echo "\n"