Added test and bench targets to benchmarks

This commit is contained in:
Charlie Curtsinger 2014-07-15 15:54:11 -04:00
parent 6e24fe6232
commit 606d28e449
17 changed files with 93 additions and 53 deletions

View File

@ -1,6 +1,6 @@
ROOT = ..
DIRS = histogram kmeans linear_regression matrix_multiply \
pbzip2 pca producer_consumer string_match word_count
RECURSIVE_TARGETS = debug release bench
RECURSIVE_TARGETS = debug release test bench
include $(ROOT)/common.mk

View File

@ -1,7 +1,8 @@
ROOT = ../..
TARGETS = histogram
TARGET = histogram
LIBS = pthread dl
ARGS = histogram_datafiles/large.bmp
TEST_ARGS = histogram_datafiles/small.bmp
include $(ROOT)/common.mk
@ -13,5 +14,7 @@ histogram_datafiles/%:
rm histogram.tar.gz
bench:: debug/bin/histogram setup
causal --- debug/bin/histogram $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/histogram $(ARGS)
test:: debug/bin/histogram setup
$(ROOT)/debug/bin/causal --- debug/bin/histogram $(TEST_ARGS)

View File

@ -1,9 +1,13 @@
ROOT = ../..
TARGETS = kmeans
TARGET = kmeans
LIBS = pthread dl
ARGS =
ARGS = -d 3 -c 100 -p 100000 -s 1000
TEST_ARGS = -d 3 -c 100 -p 10000 -s 100
include $(ROOT)/common.mk
bench:: debug/bin/kmeans
causal --- debug/bin/kmeans $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/kmeans $(ARGS)
test:: debug/bin/kmeans
$(ROOT)/debug/bin/causal --- debug/bin/kmeans $(TEST_ARGS)

View File

@ -1,7 +1,8 @@
ROOT = ../..
TARGETS = linear_regression
TARGET = linear_regression
LIBS = pthread dl
ARGS = linear_regression_datafiles/key_file_500MB.txt
TEST_ARGS = linear_regression_datafiles/key_file_50MB.txt
include $(ROOT)/common.mk
@ -13,4 +14,7 @@ linear_regression_datafiles/%:
rm linear_regression.tar.gz
bench:: debug/bin/linear_regression setup
causal --- debug/bin/linear_regression $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/linear_regression $(ARGS)
test:: debug/bin/linear_regression setup
$(ROOT)/debug/bin/causal --- debug/bin/linear_regression $(TEST_ARGS)

View File

@ -1,15 +1,19 @@
ROOT = ../..
TARGETS = matrix_multiply
TARGET = matrix_multiply
LIBS = pthread dl
MATRIX_SIZE = 800
ARGS = $(MATRIX_SIZE) > /dev/null
MATRIX_SIZE = 1000
TEST_MATRIX_SIZE = 400
include $(ROOT)/common.mk
setup: matrix_file_A.txt matrix_file_B.txt
bench:: debug/bin/matrix_multiply
@rm -f matrix_file_A.txt matrix_file_B.txt
@echo $(INDENT)[bench] Generating matrix input
@debug/bin/matrix_multiply $(MATRIX_SIZE) $(MATRIX_SIZE) > /dev/null
$(ROOT)/release/bin/causal --- debug/bin/matrix_multiply $(MATRIX_SIZE) > /dev/null
matrix_file_A.txt matrix_file_B.txt: debug/bin/matrix_multiply
./debug/bin/matrix_multiply $(MATRIX_SIZE) $(MATRIX_SIZE) > /dev/null
bench:: debug/bin/matrix_multiply setup
causal --- debug/bin/matrix_multiply $(ARGS)
test:: debug/bin/matrix_multiply
@rm -f matrix_file_A.txt matrix_file_B.txt
@echo $(INDENT)[test] Generating matrix input
@debug/bin/matrix_multiply $(TEST_MATRIX_SIZE) $(TEST_MATRIX_SIZE) > /dev/null
$(ROOT)/debug/bin/causal --- debug/bin/matrix_multiply $(TEST_MATRIX_SIZE) > /dev/null

View File

@ -1,7 +1,8 @@
ROOT = ../..
TARGETS = pbzip2
TARGET = pbzip2
LIBS = pthread dl
ARGS = -c < data/input.txt > data/output.txt
TEST_ARGS = -c < data/input.txt > data/output.txt
all:: debug
@ -32,4 +33,7 @@ data/input.txt:
cp ../linear_regression/linear_regression_datafiles/key_file_500MB.txt data/input.txt
bench:: debug/bin/pbzip2 setup
causal -i libbz2 --- debug/bin/pbzip2 $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/pbzip2 $(ARGS)
test:: debug/bin/pbzip2 setup
$(ROOT)/debug/bin/causal --- debug/bin/pbzip2 $(TEST_ARGS)

View File

@ -1,9 +1,13 @@
ROOT = ../..
TARGETS = pca
TARGET = pca
LIBS = pthread dl
ARGS = > /dev/null
TEST_ARGS = > /dev/null
include $(ROOT)/common.mk
bench:: debug/bin/pca
causal --- debug/bin/pca $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/pca $(ARGS)
test:: debug/bin/pca
$(ROOT)/debug/bin/causal --- debug/bin/pca $(TEST_ARGS)

View File

@ -1,9 +1,13 @@
ROOT = ../..
TARGETS = producer_consumer
TARGET = producer_consumer
LIBS = pthread dl
ARGS =
TEST_ARGS =
include $(ROOT)/common.mk
bench:: debug/bin/producer_consumer
causal --- debug/bin/producer_consumer $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/producer_consumer $(ARGS)
test:: debug/bin/producer_consumer
$(ROOT)/debug/bin/causal --- debug/bin/producer_consumer $(TEST_ARGS)

View File

@ -1,7 +1,8 @@
ROOT = ../..
TARGETS = string_match
TARGET = string_match
LIBS = pthread dl
ARGS = string_match_datafiles/key_file_500MB.txt > /dev/null
TEST_ARGS = string_match_datafiles/key_file_50MB.txt > /dev/null
include $(ROOT)/common.mk
@ -13,4 +14,7 @@ string_match_datafiles/%:
rm string_match.tar.gz
bench:: debug/bin/string_match setup
causal --- debug/bin/string_match $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/string_match $(ARGS)
test:: debug/bin/string_match setup
$(ROOT)/debug/bin/causal --- debug/bin/string_match $(TEST_ARGS)

View File

@ -1,7 +1,8 @@
ROOT = ../..
TARGETS = word_count
TARGET = word_count
LIBS = pthread dl
ARGS = word_count_datafiles/word_100MB.txt
TEST_ARGS = word_count_datafiles/word_10MB.txt
include $(ROOT)/common.mk
@ -13,4 +14,7 @@ word_count_datafiles/%:
rm word_count.tar.gz
bench:: debug/bin/word_count setup
causal --- debug/bin/word_count $(ARGS)
$(ROOT)/release/bin/causal --- debug/bin/word_count $(ARGS)
test:: debug/bin/word_count setup
$(ROOT)/debug/bin/causal --- debug/bin/word_count $(TEST_ARGS)

View File

@ -71,36 +71,36 @@ DEBUG_OBJS = $(addprefix debug/, $(OBJS))
RELEASE_OBJS = $(addprefix release/, $(OBJS))
# Separate target names by type
SHLIB_TARGETS = $(filter %.so, $(TARGETS))
LIB_TARGETS = $(filter %.a, $(TARGETS))
BIN_TARGETS = $(filter-out %.so, $(filter-out %.a, $(TARGETS)))
SHLIB_TARGET = $(filter %.so, $(TARGET))
LIB_TARGET = $(filter %.a, $(TARGET))
BIN_TARGET = $(filter-out %.so, $(filter-out %.a, $(TARGET)))
# Add the local debug path prefix to each target type
DEBUG_SHLIB_TARGETS = $(addprefix debug/lib/, $(SHLIB_TARGETS))
DEBUG_LIB_TARGETS = $(addprefix debug/lib/, $(LIB_TARGETS))
DEBUG_BIN_TARGETS = $(addprefix debug/bin/, $(BIN_TARGETS))
DEBUG_TARGETS = $(DEBUG_SHLIB_TARGETS) $(DEBUG_LIB_TARGETS) $(DEBUG_BIN_TARGETS)
DEBUG_SHLIB_TARGET = $(addprefix debug/lib/, $(SHLIB_TARGET))
DEBUG_LIB_TARGET = $(addprefix debug/lib/, $(LIB_TARGET))
DEBUG_BIN_TARGET = $(addprefix debug/bin/, $(BIN_TARGET))
DEBUG_TARGET = $(DEBUG_SHLIB_TARGET) $(DEBUG_LIB_TARGET) $(DEBUG_BIN_TARGET)
# Add the local release path prefix to each target type
RELEASE_SHLIB_TARGETS = $(addprefix release/lib/, $(SHLIB_TARGETS))
RELEASE_LIB_TARGETS = $(addprefix release/lib/, $(LIB_TARGETS))
RELEASE_BIN_TARGETS = $(addprefix release/bin/, $(BIN_TARGETS))
RELEASE_TARGETS = $(RELEASE_SHLIB_TARGETS) $(RELEASE_LIB_TARGETS) $(RELEASE_BIN_TARGETS)
RELEASE_SHLIB_TARGET = $(addprefix release/lib/, $(SHLIB_TARGET))
RELEASE_LIB_TARGET = $(addprefix release/lib/, $(LIB_TARGET))
RELEASE_BIN_TARGET = $(addprefix release/bin/, $(BIN_TARGET))
RELEASE_TARGET = $(RELEASE_SHLIB_TARGET) $(RELEASE_LIB_TARGET) $(RELEASE_BIN_TARGET)
debug:: $(addprefix $(INSTALL_DIR)/, $(DEBUG_TARGETS))
debug:: $(addprefix $(INSTALL_DIR)/, $(DEBUG_TARGET))
release:: $(addprefix $(INSTALL_DIR)/, $(RELEASE_TARGETS))
release:: $(addprefix $(INSTALL_DIR)/, $(RELEASE_TARGET))
ifneq ($(INSTALL),)
# Copy debug files to the root debug directory
$(addprefix $(INSTALL_DIR)/, $(DEBUG_TARGETS)):: $(DEBUG_TARGETS)
$(addprefix $(INSTALL_DIR)/, $(DEBUG_TARGET)):: $(DEBUG_TARGET)
@echo $(INDENT)[make] Copying `basename $@` to `dirname $@`
@mkdir -p `dirname $@`
@cp $< $@
# Copy release files to the root release directory
$(addprefix $(INSTALL_DIR)/, $(RELEASE_TARGETS)):: $(RELEASE_TARGETS)
$(addprefix $(INSTALL_DIR)/, $(RELEASE_TARGET)):: $(RELEASE_TARGET)
@echo $(INDENT)[make] Copying `basename $@` to `dirname $@`
@mkdir -p `dirname $@`
@cp $< $@
@ -131,17 +131,17 @@ debug/obj/%.o:: %.C Makefile $(ROOT)/common.mk $(INCLUDE_DIRS) $(INCLUDES)
# Linking rules for debug
$(DEBUG_SHLIB_TARGETS):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(DEBUG_SHLIB_TARGET):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[$(notdir $(firstword $(CXXLIB)))] Linking `basename $@` for debug build
@mkdir -p debug/lib
@$(CXXLIB) $(CXXFLAGS) $(LINKFLAGS) $(DEBUG_LINKFLAGS) $(INCFLAGS) $(DEBUG_OBJS) -o $@ $(LIBFLAGS)
$(DEBUG_LIB_TARGETS):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(DEBUG_LIB_TARGET):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[ar] Linking `basename $@` for debug build
@mkdir -p debug/lib
@ar rcs $@ $(DEBUG_OBJS)
$(DEBUG_BIN_TARGETS):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(DEBUG_BIN_TARGET):: $(DEBUG_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[$(notdir $(firstword $(CXX)))] Linking `basename $@` for debug build
@mkdir -p debug/bin
@$(CXX) $(CXXFLAGS) $(LINKFLAGS) $(DEBUG_LINKFLAGS) $(INCFLAGS) $(DEBUG_OBJS) -o $@ $(LIBFLAGS)
@ -170,17 +170,17 @@ release/obj/%.o:: %.C Makefile $(ROOT)/common.mk $(INCLUDE_DIRS) $(INCLUDES)
# Linking rules for release
$(RELEASE_SHLIB_TARGETS):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(RELEASE_SHLIB_TARGET):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[$(notdir $(firstword $(CXXLIB)))] Linking `basename $@` for release build
@mkdir -p release/lib
@$(CXXLIB) $(CXXFLAGS) $(LINKFLAGS) $(RELEASE_LINKFLAGS) $(INCFLAGS) $(RELEASE_OBJS) -o $@ $(LIBFLAGS)
$(RELEASE_LIB_TARGETS):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(RELEASE_LIB_TARGET):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[ar] Linking `basename $@` for release build
@mkdir -p release/lib
@ar rcs $@ $(RELEASE_OBJS)
$(RELEASE_BIN_TARGETS):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
$(RELEASE_BIN_TARGET):: $(RELEASE_OBJS) $(INCLUDE_DIRS) $(INCLUDES) Makefile $(ROOT)/common.mk
@echo $(INDENT)[$(notdir $(firstword $(CXX)))] Linking `basename $@` for release build
@mkdir -p release/bin
@$(CXX) $(CXXFLAGS) $(LINKFLAGS) $(RELEASE_LINKFLAGS) $(INCFLAGS) $(RELEASE_OBJS) -o $@ $(LIBFLAGS)

View File

@ -1,5 +1,5 @@
ROOT = ../..
TARGETS = libcausal.so
TARGET = libcausal.so
INSTALL = 1
LIBS = pthread dl rt causal_support dwarf++ elf++ boost_filesystem boost_program_options boost_system
INCLUDE_DIRS = $(ROOT)/lib/support/include\

View File

@ -1,5 +1,5 @@
ROOT = ../..
TARGETS = libcausal_support.a
TARGET = libcausal_support.a
INSTALL = 1
LIBS = dwarf++ elf++ boost_filesystem boost_system
INCLUDE_DIRS = $(ROOT)/deps/cppgoodies/include \

View File

@ -1,5 +1,5 @@
ROOT = ../..
TARGETS = loopy
TARGET = loopy
LIBS = pthread dl
include $(ROOT)/common.mk

View File

@ -1,5 +1,5 @@
ROOT = ../..
TARGETS = causal
TARGET = causal
INSTALL = 1
LIBS = boost_program_options
INCLUDE_DIRS = $(ROOT)/lib/runtime/include

View File

@ -41,8 +41,13 @@ int main(int argc, char** argv, char** env) {
// Set the program name in the first argument, otherwise file name resolution won't work
argv[0] = prog_name;
#if !defined(NDEBUG)
// Set the preload string to the path to the debug causal library
string causal_preload = CAUSAL_ROOT_PATH "/debug/lib/libcausal.so";
#else
// Preload the release version of the causal library
string causal_preload = CAUSAL_ROOT_PATH "/release/lib/libcausal.so";
#endif
// Loop over the environment array, looking for an LD_PRELOAD entry
bool ld_preload_found = false;

View File

@ -1,5 +1,5 @@
ROOT = ../..
TARGETS = inspect
TARGET = inspect
INSTALL = 1
LIBS = causal_support dwarf++ elf++ boost_filesystem boost_system
INCLUDE_DIRS = $(ROOT)/lib/support/include \