summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/makefiles
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/makefiles
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/common/makefiles')
-rw-r--r--SD-VBS/common/makefiles/Makefile.common135
-rw-r--r--SD-VBS/common/makefiles/Makefile.include16
-rw-r--r--SD-VBS/common/makefiles/Makefile.recurse39
3 files changed, 190 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
diff --git a/SD-VBS/common/makefiles/Makefile.include b/SD-VBS/common/makefiles/Makefile.include
new file mode 100644
index 0000000..f1000b9
--- /dev/null
+++ b/SD-VBS/common/makefiles/Makefile.include
@@ -0,0 +1,16 @@
1find-dir-with = $(shell /usr/bin/perl -e 'chomp($$_ = `pwd`); while ($$_ ne "" && ! -e "$$_/$(1)") { m:(.*)/[^/]+/??:; $$_ = $$1; } print;')
2
3# define canonical directories in starsearch
4ifndef TOP_DIR
5 export TOP_DIR := $(call find-dir-with,.SD-VBS)
6endif
7
8export MAKEFILE_COMMON_DIR=$(TOP_DIR)/common/makefiles
9
10# backward compatibility
11
12ifeq ($(TOP_DIR),)
13$(error file .SD-VBS not found -- try running 'gmake setup' at the top of your source tree)
14endif
15
16
diff --git a/SD-VBS/common/makefiles/Makefile.recurse b/SD-VBS/common/makefiles/Makefile.recurse
new file mode 100644
index 0000000..9a9d088
--- /dev/null
+++ b/SD-VBS/common/makefiles/Makefile.recurse
@@ -0,0 +1,39 @@
1# This file is included in the makefiles of the non-leaf nodes
2# Thus the various targets in this file have to trickle down
3# into the subdirectories
4# List the subdirectories and call the target for each one of them
5
6################################################################
7# RECURSE
8################################################################
9# Listing the subdirectories
10SUBDIRS = $(patsubst %/Makefile,%,$(wildcard */Makefile))
11
12RECURSE-DEPENDS = $(patsubst %,%.traverse,$(SUBDIRS))
13
14all: recurse
15
16debug: recurse
17
18clean: recurse
19
20compile: recurse
21
22c-run: recurse
23
24matlab-run: recurse
25
26mcc-run: recurse
27
28recurse: $(RECURSE-DEPENDS)
29
30time-run: recurse
31
32preload-run: recurse
33
34run: recurse
35
36# MAKECMDGOALS contains the gmake target specified on the command line
37# it is defined automatically by gmake
38%.traverse: