aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-02-02 14:45:21 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-02-02 14:45:21 +0100
commit8c12b0494aa241bb6ddf3779a99d2f5d6ededf73 (patch)
treeb7bcaf69bfc9c8d7933bcaaedc66a907a04c9ca6
parent130765de719a3ddc475284e13749d09ff371a8e1 (diff)
downloadallocbench-8c12b0494aa241bb6ddf3779a99d2f5d6ededf73.tar.gz
allocbench-8c12b0494aa241bb6ddf3779a99d2f5d6ededf73.zip
rework build system #2: call make before executing any benchmark
Make scans the project directory for Makefiles and executes them. The targets should be build by the new targets/Makefile. All included Makefiles are now "quiet" by default.
-rw-r--r--.gitignore2
-rw-r--r--Makefile24
-rwxr-xr-xbench.py11
-rw-r--r--src/Makefile2
-rw-r--r--src/benchmark.py6
-rw-r--r--src/benchmarks/dj_trace/Makefile3
-rw-r--r--src/benchmarks/falsesharing/Makefile4
-rw-r--r--src/benchmarks/larson/Makefile3
-rw-r--r--src/benchmarks/loop/Makefile3
-rw-r--r--targets/Makefile22
10 files changed, 54 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index e83764b..5e44def 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
build/*
results/*
-targets/*
+targets/*.so
dj_workloads/*
*.png
*__pycache__*
diff --git a/Makefile b/Makefile
index bda8745..78aab1c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,4 @@
-.PHONY: all clean bench
-
-.DEFAULT_GOAL = all
-
-SRCDIR = src
-
-BENCHSRCDIR = $(SRCDIR)/benchmarks
-BENCHMARKS = $(shell dirname $(shell find $(BENCHSRCDIR) -name Makefile))
+MAKEFILES = $(shell dirname $(shell find . -name Makefile ! -path ./Makefile))
OBJDIR = $(PWD)/build
@@ -23,18 +16,11 @@ CXXFLAGS = -std=c++11 $(CFLAGS) -fno-exceptions
LDFLAGS = -pthread -static-libgcc
LDXXFLAGS = $(LDFLAGS) -static-libstdc++
-GLIBC_NOTC = $(PWD)/../glibc/glibc-install-nofs/lib
-
-MAKEFILE_LIST = Makefile
-
-.PHONY: all clean $(SRCDIR) $(BENCHMARKS)
-all: $(OBJDIR)/ccinfo $(BENCHMARKS) $(SRCDIR)
-
-$(SRCDIR):
- make -C $@ OBJDIR=$(OBJDIR)
+.PHONY: all clean $(MAKEFILES)
+all: $(OBJDIR)/ccinfo $(MAKEFILES)
-$(BENCHMARKS): $(MAKEFILE_LIST)
- $(MAKE) -C $@ all OBJDIR=$(OBJDIR)/$(shell basename $@)
+$(MAKEFILES):
+ $(MAKE) -C $@ OBJDIR=$(OBJDIR)/$(shell echo $@ | sed s/src//)
$(OBJDIR)/ccinfo: | $(OBJDIR)
$(CC) -v 2> $@
diff --git a/bench.py b/bench.py
index 2adb0cc..a4283d9 100755
--- a/bench.py
+++ b/bench.py
@@ -4,6 +4,7 @@ import argparse
import datetime
import importlib
import os
+import subprocess
import src.facter
import src.targets
@@ -26,10 +27,18 @@ parser.add_argument("--license", help="print license info and exit", action='sto
def main():
args = parser.parse_args()
if args.license:
- print("Copyright (C) 2018-1029 Florian Fischer")
+ print("Copyright (C) 2018-2019 Florian Fischer")
print("License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>")
return
+ # Prepare allocbench
+ print("Building allocbench")
+ make_cmd = ["make"]
+ if not args.verbose:
+ make_cmd.append("-s")
+
+ subprocess.run(make_cmd)
+
if args.verbose:
print(args)
diff --git a/src/Makefile b/src/Makefile
index 6b7b704..7173c99 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -15,9 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc
all: $(OBJDIR)/print_status_on_exit.so $(OBJDIR)/chattymalloc.so
$(OBJDIR)/print_status_on_exit.so: print_status_on_exit.c | $(OBJDIR)
+ @echo "Compiling $@...";
$(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
$(OBJDIR)/chattymalloc.so: chattymalloc.c | $(OBJDIR)
+ @echo "Compiling $@...";
$(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
$(OBJDIR):
diff --git a/src/benchmark.py b/src/benchmark.py
index e4dbef2..67e8157 100644
--- a/src/benchmark.py
+++ b/src/benchmark.py
@@ -81,16 +81,20 @@ class Benchmark (object):
self.results[target] = d
def prepare(self, verbose=False):
- os.environ["PATH"] += ":build/" + self.name
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+ os.environ["PATH"] += ":" + os.path.join("build", "benchmarks",
+ self.name)
+
for r in self.requirements:
fpath, fname = os.path.split(r)
+ # Search for file
if fpath:
if not is_exe(r):
return False
+ # Search in PATH
else:
found = False
for path in os.environ["PATH"].split(os.pathsep):
diff --git a/src/benchmarks/dj_trace/Makefile b/src/benchmarks/dj_trace/Makefile
index 14eca91..0b04678 100644
--- a/src/benchmarks/dj_trace/Makefile
+++ b/src/benchmarks/dj_trace/Makefile
@@ -15,10 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc
all: $(OBJDIR)/trace_run
$(OBJDIR)/trace_run: trace_run.c | $(OBJDIR)
+ @echo compiling $@...
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
$(OBJDIR):
- mkdir $@
+ mkdir -p $@
clean:
rm -rf $(OBJDIR)
diff --git a/src/benchmarks/falsesharing/Makefile b/src/benchmarks/falsesharing/Makefile
index 7dec230..763864a 100644
--- a/src/benchmarks/falsesharing/Makefile
+++ b/src/benchmarks/falsesharing/Makefile
@@ -17,13 +17,15 @@ HEADER = cpuinfo.h fred.h timer.h
all: $(OBJDIR)/cache-thrash $(OBJDIR)/cache-scratch
$(OBJDIR)/cache-thrash: cache-thrash.cc $(HEADER) | $(OBJDIR)
+ @echo compiling $@...
$(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
$(OBJDIR)/cache-scratch: cache-scratch.cc $(HEADER) | $(OBJDIR)
+ @echo compiling $@...
$(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
$(OBJDIR):
- mkdir $@
+ mkdir -p $@
clean:
rm -rf $(OBJDIR)
diff --git a/src/benchmarks/larson/Makefile b/src/benchmarks/larson/Makefile
index 9ccce9f..0bb9a5b 100644
--- a/src/benchmarks/larson/Makefile
+++ b/src/benchmarks/larson/Makefile
@@ -15,10 +15,11 @@ LDXXFLAGS ?= -pthread -static-libgcc -static-libstdc++
all: $(OBJDIR)/larson
$(OBJDIR)/larson: larson.cc | $(OBJDIR)
+ @echo compiling $@...
$(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
$(OBJDIR):
- mkdir $@
+ mkdir -p $@
clean:
rm -rf $(OBJDIR)
diff --git a/src/benchmarks/loop/Makefile b/src/benchmarks/loop/Makefile
index 89914b2..b297933 100644
--- a/src/benchmarks/loop/Makefile
+++ b/src/benchmarks/loop/Makefile
@@ -15,10 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc
all: $(OBJDIR)/loop
$(OBJDIR)/loop: loop.c | $(OBJDIR)
+ @echo compiling $@...
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
$(OBJDIR):
- mkdir $@
+ mkdir -p $@
clean:
rm -rf $(OBJDIR)
diff --git a/targets/Makefile b/targets/Makefile
new file mode 100644
index 0000000..5df4999
--- /dev/null
+++ b/targets/Makefile
@@ -0,0 +1,22 @@
+OBJDIR ?= obj
+
+CC ?= gcc
+
+WARNFLAGS ?= -Wall -Wextra
+COMMONFLAGS ?= -fno-builtin -fPIC -DPIC -pthread
+OPTFLAGS ?= -O3 -DNDEBUG
+
+CFLAGS ?= $(OPTFLAGS) $(WARNFLAGS) $(COMMONFLAGS)
+
+LDFLAGS ?= -pthread -static-libgcc
+
+.PHONY: all clean
+
+all: $(OBJDIR)
+ @echo building targets
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)