summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/makefiles/Makefile.common
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/makefiles/Makefile.common
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/makefiles/Makefile.common')
-rw-r--r--SD-VBS/common/makefiles/Makefile.common134
1 files changed, 134 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..144adb2
--- /dev/null
+++ b/SD-VBS/common/makefiles/Makefile.common
@@ -0,0 +1,134 @@
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
22COMMON_DIR := $(TOP_DIR)/common/c
23M_COMMON := $(TOP_DIR)/common/matlab
24M_TOOLBOX=$(TOP_DIR)/common/toolbox
25TIMING_DIR := $(TOP_DIR)/cycles/$(BMARK)
26TIMES_DIR := $(TOP_DIR)/times/$(BMARK)
27PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK)
28MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK)
29BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK)
30TOOL_DIR := $(TOP_DIR)/tools
31LIBLITMUS := /home/litmus/liblitmus
32#The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =.
33
34# Variables exported from the benchmark specific Makefiles:
35# BMARK
36# INPUT - sqcif/qcif/cif
37
38# Matlab source, data and result directory
39
40M_DIR=$(BMARK_DIR)/src/matlab
41M_DATA=$(BMARK_DIR)/data/$(INPUT)
42M_RESULT=$(BMARK_DIR)/result
43
44# C source, data and result directory
45
46C_DIR=$(BMARK_DIR)/src/c
47DATA_DIR=$(BMARK_DIR)/data/$(INPUT)
48C_RESULT=$(M_RESULT)
49
50# Source files for C and Common folders
51
52C_SRC := $(wildcard $(C_DIR)/*.c)
53COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c)
54
55# RULES
56
57EXE =
58INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
59COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2
60#COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES)
61COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES)
62COMPILE_PG = $(COMPILE_G) -pg
63
64preload-run: compile
65 @echo preloaded timing
66 @echo 3 | tee /proc/sys/vm/drop_caches
67 @find ./ -iname "*.bmp" -exec sh -c '$(TOOL_DIR)/preload {} &' \;
68 @find ./ -iname "*.txt" -exec sh -c '$(TOOL_DIR)/preload {} &' \;
69 mkdir -p $(PRELOAD_TIMES_DIR)
70 @echo -e "Data set\t\t- $(INPUT)"
71 (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(PRELOAD_TIMES_DIR)/T_$(INPUT).txt
72 @kill -2 `pgrep preload`
73
74time-run: compile
75 mkdir -p $(TIMES_DIR)
76 @echo -e "Data set\t\t- $(INPUT)"
77 @echo 3 | tee /proc/sys/vm/drop_caches
78 (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(TIMES_DIR)/T_$(INPUT).txt
79
80c-run: compile
81 @echo -e "Data set\t\t- $(INPUT)"
82 mkdir -p $(TIMING_DIR)
83 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) | tee $(TIMING_DIR)/C_$(INPUT).txt
84
85run: compile
86 @echo -e "Data set\t\t- $(INPUT)"
87 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
88
89rt-run: compile
90 @echo -e "Data set\t\t- $(INPUT)"
91 @./$(BMARK)$(EXE) $(BMARK)-$(INPUT) 5 0 12345 1
92
93debug:
94 @echo Running Debug C Version of the benchmark
95 @$(COMPILE_G) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE)
96 @valgrind --leak-check=full ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
97 #@gdb ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
98
99profile: compile-prof
100 @echo -e "Data set\t\t- $(INPUT)"
101 @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT)
102 @gprof $(BMARK)$(EXE)
103
104compile-preload:
105 @$(COMPILE_C) $(TOOL_DIR)\preload.c -o $(TOOL_DIR)\preload
106
107compile: $(C_SRC)
108 @echo
109 @echo -e "Benchmark\t\t- $(BMARK)"
110 @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -L$(LIBLITMUS) -llitmus -lm -w -o $(BMARK)$(EXE)
111
112compile-prof: $(C_SRC)
113 @echo
114 @echo -e "Benchmark\t\t- $(BMARK)"
115 @$(COMPILE_PG) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE)
116
117matlab-run:
118 @echo
119 @echo -e "Benchmark\t\t- $(BMARK)"
120 @echo -e "Data set\t\t- $(INPUT)"
121 @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
122
123mcc-run:
124 @echo Generating a C standalone application
125 cd $(M_DIR); $(MATLAB_PATH) -nosplash -nodesktop -r "mcc -m -v script_run_profile -d $(M_RESULT); quit"
126
127all: c-run matlab-run mcc-run
128
129clean:
130 @-rm $(BMARK)
131
132
133
134