From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: 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. --- SD-VBS/common/makefiles/Makefile.common | 134 +++++++++++++++++++++++++++++++ SD-VBS/common/makefiles/Makefile.include | 16 ++++ SD-VBS/common/makefiles/Makefile.recurse | 41 ++++++++++ 3 files changed, 191 insertions(+) create mode 100644 SD-VBS/common/makefiles/Makefile.common create mode 100644 SD-VBS/common/makefiles/Makefile.include create mode 100644 SD-VBS/common/makefiles/Makefile.recurse (limited to 'SD-VBS/common/makefiles') 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 @@ +################################# +# Author: Sravanthi Kota Venkata +################################# +SHELL := /bin/bash + +# Define MATLAB-PATH with the path to the MATLAB package +MATLAB_PATH = /pkg/bin/matlab +ifeq ($(filter matlab-run,$(MAKECMDGOALS)),matlab-run) +ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH)) +$(error Please set the appropriate MATLAB path in MATLAB_PATH variable) +endif +endif + +ifeq ($(filter mcc-run,$(MAKECMDGOALS)),mcc-run) +ifneq ($(wildcard $(MATLAB_PATH)),$(MATLAB_PATH)) +$(error Please set the appropriate MATLAB path in MATLAB_PATH variable) +endif +endif + +CC=gcc +override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK +COMMON_DIR := $(TOP_DIR)/common/c +M_COMMON := $(TOP_DIR)/common/matlab +M_TOOLBOX=$(TOP_DIR)/common/toolbox +TIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) +TIMES_DIR := $(TOP_DIR)/times/$(BMARK) +PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK) +MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) +BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) +TOOL_DIR := $(TOP_DIR)/tools +LIBLITMUS := /home/litmus/liblitmus +#The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. + +# Variables exported from the benchmark specific Makefiles: +# BMARK +# INPUT - sqcif/qcif/cif + +# Matlab source, data and result directory + +M_DIR=$(BMARK_DIR)/src/matlab +M_DATA=$(BMARK_DIR)/data/$(INPUT) +M_RESULT=$(BMARK_DIR)/result + +# C source, data and result directory + +C_DIR=$(BMARK_DIR)/src/c +DATA_DIR=$(BMARK_DIR)/data/$(INPUT) +C_RESULT=$(M_RESULT) + +# Source files for C and Common folders + +C_SRC := $(wildcard $(C_DIR)/*.c) +COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c) + +# RULES + +EXE = +INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include +COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2 +#COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) +COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) +COMPILE_PG = $(COMPILE_G) -pg + +preload-run: compile + @echo preloaded timing + @echo 3 | tee /proc/sys/vm/drop_caches + @find ./ -iname "*.bmp" -exec sh -c '$(TOOL_DIR)/preload {} &' \; + @find ./ -iname "*.txt" -exec sh -c '$(TOOL_DIR)/preload {} &' \; + mkdir -p $(PRELOAD_TIMES_DIR) + @echo -e "Data set\t\t- $(INPUT)" + (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(PRELOAD_TIMES_DIR)/T_$(INPUT).txt + @kill -2 `pgrep preload` + +time-run: compile + mkdir -p $(TIMES_DIR) + @echo -e "Data set\t\t- $(INPUT)" + @echo 3 | tee /proc/sys/vm/drop_caches + (time ./$(BMARK)$(EXE) $(DATA_DIR)) |& tee $(TIMES_DIR)/T_$(INPUT).txt + +c-run: compile + @echo -e "Data set\t\t- $(INPUT)" + mkdir -p $(TIMING_DIR) + @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) | tee $(TIMING_DIR)/C_$(INPUT).txt + +run: compile + @echo -e "Data set\t\t- $(INPUT)" + @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) + +rt-run: compile + @echo -e "Data set\t\t- $(INPUT)" + @./$(BMARK)$(EXE) $(BMARK)-$(INPUT) 5 0 12345 1 + +debug: + @echo Running Debug C Version of the benchmark + @$(COMPILE_G) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE) + @valgrind --leak-check=full ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) + #@gdb ./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) + +profile: compile-prof + @echo -e "Data set\t\t- $(INPUT)" + @./$(BMARK)$(EXE) $(DATA_DIR) $(C_RESULT) + @gprof $(BMARK)$(EXE) + +compile-preload: + @$(COMPILE_C) $(TOOL_DIR)\preload.c -o $(TOOL_DIR)\preload + +compile: $(C_SRC) + @echo + @echo -e "Benchmark\t\t- $(BMARK)" + @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -L$(LIBLITMUS) -llitmus -lm -w -o $(BMARK)$(EXE) + +compile-prof: $(C_SRC) + @echo + @echo -e "Benchmark\t\t- $(BMARK)" + @$(COMPILE_PG) $(COMMON_SRC) $(C_SRC) -o $(BMARK)$(EXE) + +matlab-run: + @echo + @echo -e "Benchmark\t\t- $(BMARK)" + @echo -e "Data set\t\t- $(INPUT)" + @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 + +mcc-run: + @echo Generating a C standalone application + cd $(M_DIR); $(MATLAB_PATH) -nosplash -nodesktop -r "mcc -m -v script_run_profile -d $(M_RESULT); quit" + +all: c-run matlab-run mcc-run + +clean: + @-rm $(BMARK) + + + + 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 @@ +find-dir-with = $(shell /usr/bin/perl -e 'chomp($$_ = `pwd`); while ($$_ ne "" && ! -e "$$_/$(1)") { m:(.*)/[^/]+/??:; $$_ = $$1; } print;') + +# define canonical directories in starsearch +ifndef TOP_DIR + export TOP_DIR := $(call find-dir-with,.SD-VBS) +endif + +export MAKEFILE_COMMON_DIR=$(TOP_DIR)/common/makefiles + +# backward compatibility + +ifeq ($(TOP_DIR),) +$(error file .SD-VBS not found -- try running 'gmake setup' at the top of your source tree) +endif + + diff --git a/SD-VBS/common/makefiles/Makefile.recurse b/SD-VBS/common/makefiles/Makefile.recurse new file mode 100644 index 0000000..ed575bb --- /dev/null +++ b/SD-VBS/common/makefiles/Makefile.recurse @@ -0,0 +1,41 @@ +# This file is included in the makefiles of the non-leaf nodes +# Thus the various targets in this file have to trickle down +# into the subdirectories +# List the subdirectories and call the target for each one of them + +################################################################ +# RECURSE +################################################################ +# Listing the subdirectories +SUBDIRS = $(patsubst %/Makefile,%,$(wildcard */Makefile)) + +RECURSE-DEPENDS = $(patsubst %,%.traverse,$(SUBDIRS)) + +all: recurse + +debug: recurse + +clean: recurse + +compile: recurse + +c-run: recurse + +matlab-run: recurse + +mcc-run: recurse + +recurse: $(RECURSE-DEPENDS) + +time-run: recurse + +preload-run: recurse + +run: recurse + +rt-run: recurse + +# MAKECMDGOALS contains the gmake target specified on the command line +# it is defined automatically by gmake +%.traverse: + $(MAKE) -C $* $(MAKECMDGOALS) -- cgit v1.2.2 From 163c440444c74a4e0bbe0a8db3d1ca725413994b Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 03:17:31 -0400 Subject: Make SD-VBS compatible with run_bench.sh and cleanup SD-VBS: - Run silently - Fix some whitespace errors - Don't duplicate extra.h - Auto-detect if building with LITMUS-RT - Disable result checking - Add helper symlinks Misc: - Remove unused code from libextra - Set some missing rt_param fields in libextra - Disable CSV info dump from computeSMTslowdown.sh - Widen scope of .gitignore on .txt files - Include list of 2MB DIS pair benchmarks and inputs --- SD-VBS/common/makefiles/Makefile.common | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'SD-VBS/common/makefiles') diff --git a/SD-VBS/common/makefiles/Makefile.common b/SD-VBS/common/makefiles/Makefile.common index 144adb2..9c28cfc 100644 --- a/SD-VBS/common/makefiles/Makefile.common +++ b/SD-VBS/common/makefiles/Makefile.common @@ -18,7 +18,7 @@ endif endif CC=gcc -override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK +override CFLAGS += -DGCC -D$(INPUT) -pthread -I../../../../.. COMMON_DIR := $(TOP_DIR)/common/c M_COMMON := $(TOP_DIR)/common/matlab M_TOOLBOX=$(TOP_DIR)/common/toolbox @@ -28,7 +28,11 @@ PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK) MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) TOOL_DIR := $(TOP_DIR)/tools -LIBLITMUS := /home/litmus/liblitmus +LIBLITMUS ?= /home/litmus/liblitmus +ifneq ($(shell grep "define LITMUS 1" ../../../../../extra.h),) + CFLAGS += -I${LIBLITMUS}/include + LDFLAGS += -L${LIBLITMUS} -llitmus +endif #The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. # Variables exported from the benchmark specific Makefiles: @@ -55,8 +59,8 @@ COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c) # RULES EXE = -INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include -COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2 +INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) +COMPILE_C = $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) -O2 #COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) COMPILE_PG = $(COMPILE_G) -pg @@ -107,7 +111,7 @@ compile-preload: compile: $(C_SRC) @echo @echo -e "Benchmark\t\t- $(BMARK)" - @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -L$(LIBLITMUS) -llitmus -lm -w -o $(BMARK)$(EXE) + @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -lm -w -o $(BMARK)$(EXE) compile-prof: $(C_SRC) @echo -- cgit v1.2.2 From a7c3210215bd1181ae93b23c313941dfb44519fb Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 22:46:39 -0400 Subject: Transform LITMUS-RT support in libextra to imply case-study mode Adds and parameters to benchmarks and disables cache flushing when compiled with LITMUS. Also fixes build with LITMUS enabled on yamaha.cs.unc.edu. Also allows output to be disabled, automatically infers _rt_lock_id, and allows for a specific pair ID for paired tasks. (The pair ID is added to all the semaphore and shared memory names, allowing multiple pairs to run in the system at a time.) --- SD-VBS/common/makefiles/Makefile.common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'SD-VBS/common/makefiles') diff --git a/SD-VBS/common/makefiles/Makefile.common b/SD-VBS/common/makefiles/Makefile.common index 9c28cfc..964ece6 100644 --- a/SD-VBS/common/makefiles/Makefile.common +++ b/SD-VBS/common/makefiles/Makefile.common @@ -30,8 +30,8 @@ BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) TOOL_DIR := $(TOP_DIR)/tools LIBLITMUS ?= /home/litmus/liblitmus ifneq ($(shell grep "define LITMUS 1" ../../../../../extra.h),) - CFLAGS += -I${LIBLITMUS}/include - LDFLAGS += -L${LIBLITMUS} -llitmus + override CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include + override LDFLAGS += -L${LIBLITMUS} -llitmus endif #The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. -- cgit v1.2.2