summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/makefiles/Makefile.common
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/makefiles/Makefile.common')
-rw-r--r--SD-VBS/common/makefiles/Makefile.common135
1 files changed, 135 insertions, 0 deletions
diff --git a/SD-VBS/common/makefiles/Makefile.common b/SD-VBS/common/makefiles/Makefile.common
new file mode 100644
index 0000000..7fc8824
--- /dev/null
+++ b/SD-VBS/common/makefiles/Makefile.common
@@ -0,0 +1,135 @@
1#################################
2# Author: Sravanthi Kota Venkata
3#################################
4SHELL := /bin/bash
5
6# Define MATLAB-PATH with the path to the MATLAB package
7MATLAB_PATH = /pkg/bin/matlab
8ifeq ($(filter matlab-run,$(MAKECMDGOALS)),matlab-run)
9ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH))
10$(error Please set the appropriate MATLAB path in MATLAB_PATH variable)
11endif
12endif
13
14ifeq ($(filter mcc-run,$(MAKECMDGOALS)),mcc-run)
15ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH))
16$(error Please set the appropriate MATLAB path in MATLAB_PATH variable)
17endif
18endif
19
20CC=gcc
21override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK
22
23COMMON_DIR := $(TOP_DIR)/common/c
24M_COMMON := $(TOP_DIR)/common/matlab
25M_TOOLBOX=$(TOP_DIR)/common/toolbox
26TIMING_DIR := $(TOP_DIR)/cycles/$(BMARK)
27TIMES_DIR := $(TOP_DIR)/times/$(BMARK)
28PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK)
29MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK)
30BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK)
31TOOL_DIR := $(TOP_DIR)/tools
32
33#The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =.
34
35# Variables exported from the benchmark specific Makefiles:
36# BMARK
37# INPUT - sqcif/qcif/cif
38
39# Matlab source, data and result directory
40
41M_DIR=$(BMARK_DIR)/src/matlab
42M_DATA=$(BMARK_DIR)/data/$(INPUT)
43M_RESULT=$(BMARK_DIR)/result
44
45# C source, data and result directory
46
47C_DIR=$(BMARK_DIR)/src/c
48DATA_DIR=$(BMARK_DIR)/data/$(INPUT)
49C_RESULT=$(M_RESULT)
50
51# Source files for C and Common folders
52
53C_SRC := $(wildcard $(C_DIR)/*.c)
54COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c)
55
56# RULES
57
58EXE =
59INCLUDES = -I$(COMMON_DIR) -I$(C_DIR)
60COMPILE_C = $(CC) $(CFLAGS) -lm -O2 $(INCLUDES)
61#COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES)
62COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES)
63COMPILE_PG = $(COMPILE_G) -pg
64
65preload-run: compile
66 @echo preloaded timing
67 @echo 3 | tee /proc/sys/vm/drop_caches
68 @find ./ -iname "*.bmp" -exec sh -c '$(TOOL_DIR)/preload {} &' \;
69 @find ./ -iname "*.txt" -exec sh -c '$(TOOL_DIR)/preload {} &' \;
70 mkdir -p $(PRELOAD_TIMES_DIR)
71 @echo -e "Data set\t\t- $(INPUT)"
72 (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(PRELOAD_TIMES_DIR)/T_$(INPUT).txt
73 @kill -2 `pgrep preload`
74
75time-run: compile
76 mkdir -p $(TIMES_DIR)
77 @echo -e "Data set\t\t- $(INPUT)"
78 @echo 3 | tee /proc/sys/vm/drop_caches
79 (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(TIMES_DIR)/T_$(INPUT).txt
80
81c-run: compile
82 @echo -e "Data set\t\t- $(INPUT)"
83 mkdir -p $(TIMING_DIR)
84 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) | tee $(TIMING_DIR)/C_$(INPUT).txt
85
86run: compile
87 @echo -e "Data set\t\t- $(INPUT)"
88 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
89
90rt-run: compile
91 @echo -e "Data set\t\t- $(INPUT)"
92 @./$(BMARK)$(EXE) $(BMARK)-$(INPUT) 5 0 12345 1
93
94debug:
95 @echo Running Debug C Version of the benchmark
96 @$(COMPILE_G) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE)
97 @valgrind --leak-check=full ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
98 #@gdb ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
99
100profile: compile-prof
101 @echo -e "Data set\t\t- $(INPUT)"
102 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
103 @gprof $(BMARK)$(EXE)
104
105compile-preload:
106 @$(COMPILE_C) $(TOOL_DIR)\preload.c -o $(TOOL_DIR)\preload
107
108compile: $(C_SRC)
109 @echo
110 @echo -e "Benchmark\t\t- $(BMARK)"
111 @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -lm -w -o $(BMARK)$(EXE)
112
113compile-prof: $(C_SRC)
114 @echo
115 @echo -e "Benchmark\t\t- $(BMARK)"
116 @$(COMPILE_PG) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE)
117
118matlab-run:
119 @echo
120 @echo -e "Benchmark\t\t- $(BMARK)"
121 @echo -e "Data set\t\t- $(INPUT)"
122 @cd $(M_DIR); $(MATLAB_PATH) -glnx86 -nosplash -nodisplay -r "script_run_profile('$(M_DATA)', '$(M_RESULT)', '$(INPUT)', '$(M_COMMON)', '$(M_TOOLBOX)'); quit" | tee $(MTIMING_DIR)/Matlab_$(INPUT).txt
123
124mcc-run:
125 @echo Generating a C standalone application
126 cd $(M_DIR); $(MATLAB_PATH) -nosplash -nodesktop -r "mcc -m -v script_run_profile -d $(M_RESULT); quit"
127
128all: c-run matlab-run mcc-run
129
130clean:
131 @-rm $(BMARK)
132
133
134
135