diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/makefiles/Makefile.common | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (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.common | 134 |
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 | ################################# | ||
| 4 | SHELL := /bin/bash | ||
| 5 | |||
| 6 | # Define MATLAB-PATH with the path to the MATLAB package | ||
| 7 | MATLAB_PATH = /pkg/bin/matlab | ||
| 8 | ifeq ($(filter matlab-run,$(MAKECMDGOALS)),matlab-run) | ||
| 9 | ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH)) | ||
| 10 | $(error Please set the appropriate MATLAB path in MATLAB_PATH variable) | ||
| 11 | endif | ||
| 12 | endif | ||
| 13 | |||
| 14 | ifeq ($(filter mcc-run,$(MAKECMDGOALS)),mcc-run) | ||
| 15 | ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH)) | ||
| 16 | $(error Please set the appropriate MATLAB path in MATLAB_PATH variable) | ||
| 17 | endif | ||
| 18 | endif | ||
| 19 | |||
| 20 | CC=gcc | ||
| 21 | override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK | ||
| 22 | COMMON_DIR := $(TOP_DIR)/common/c | ||
| 23 | M_COMMON := $(TOP_DIR)/common/matlab | ||
| 24 | M_TOOLBOX=$(TOP_DIR)/common/toolbox | ||
| 25 | TIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) | ||
| 26 | TIMES_DIR := $(TOP_DIR)/times/$(BMARK) | ||
| 27 | PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK) | ||
| 28 | MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) | ||
| 29 | BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) | ||
| 30 | TOOL_DIR := $(TOP_DIR)/tools | ||
| 31 | LIBLITMUS := /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 | |||
| 40 | M_DIR=$(BMARK_DIR)/src/matlab | ||
| 41 | M_DATA=$(BMARK_DIR)/data/$(INPUT) | ||
| 42 | M_RESULT=$(BMARK_DIR)/result | ||
| 43 | |||
| 44 | # C source, data and result directory | ||
| 45 | |||
| 46 | C_DIR=$(BMARK_DIR)/src/c | ||
| 47 | DATA_DIR=$(BMARK_DIR)/data/$(INPUT) | ||
| 48 | C_RESULT=$(M_RESULT) | ||
| 49 | |||
| 50 | # Source files for C and Common folders | ||
| 51 | |||
| 52 | C_SRC := $(wildcard $(C_DIR)/*.c) | ||
| 53 | COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c) | ||
| 54 | |||
| 55 | # RULES | ||
| 56 | |||
| 57 | EXE = | ||
| 58 | INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | ||
| 59 | COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2 | ||
| 60 | #COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) | ||
| 61 | COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) | ||
| 62 | COMPILE_PG = $(COMPILE_G) -pg | ||
| 63 | |||
| 64 | preload-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 | |||
| 74 | time-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 | |||
| 80 | c-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 | |||
| 85 | run: compile | ||
| 86 | @echo -e "Data set\t\t- $(INPUT)" | ||
| 87 | @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) | ||
| 88 | |||
| 89 | rt-run: compile | ||
| 90 | @echo -e "Data set\t\t- $(INPUT)" | ||
| 91 | @./$(BMARK)$(EXE) $(BMARK)-$(INPUT) 5 0 12345 1 | ||
| 92 | |||
| 93 | debug: | ||
| 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 | |||
| 99 | profile: compile-prof | ||
| 100 | @echo -e "Data set\t\t- $(INPUT)" | ||
| 101 | @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) | ||
| 102 | @gprof $(BMARK)$(EXE) | ||
| 103 | |||
| 104 | compile-preload: | ||
| 105 | @$(COMPILE_C) $(TOOL_DIR)\preload.c -o $(TOOL_DIR)\preload | ||
| 106 | |||
| 107 | compile: $(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 | |||
| 112 | compile-prof: $(C_SRC) | ||
| 113 | @echo | ||
| 114 | @echo -e "Benchmark\t\t- $(BMARK)" | ||
| 115 | @$(COMPILE_PG) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE) | ||
| 116 | |||
| 117 | matlab-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 | |||
| 123 | mcc-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 | |||
| 127 | all: c-run matlab-run mcc-run | ||
| 128 | |||
| 129 | clean: | ||
| 130 | @-rm $(BMARK) | ||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
