aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-02-01 16:35:20 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-02-01 16:35:20 +0100
commit130765de719a3ddc475284e13749d09ff371a8e1 (patch)
treec45ea8d47e53481022d641336ec2abd5cb588111 /src
parent8221b8fb0e9ee491590932cd228f17b48155c0f7 (diff)
downloadallocbench-130765de719a3ddc475284e13749d09ff371a8e1.tar.gz
allocbench-130765de719a3ddc475284e13749d09ff371a8e1.zip
rework build system #1
each benchmark has its own Makefile which must put it's binaries into OBJDIR which is added to the PATH during execution.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile27
-rw-r--r--src/benchmark.py2
-rw-r--r--src/benchmarks/dj_trace/Makefile24
-rw-r--r--src/benchmarks/dj_trace/trace_run.c (renamed from src/trace_run.c)0
-rw-r--r--src/benchmarks/falsesharing/Makefile29
-rw-r--r--src/benchmarks/falsesharing/cache-scratch.cc (renamed from src/benchmarks/cache-scratch.cc)0
-rw-r--r--src/benchmarks/falsesharing/cache-thrash.cc (renamed from src/benchmarks/cache-thrash.cc)0
-rw-r--r--src/benchmarks/falsesharing/cpuinfo.h (renamed from src/benchmarks/cpuinfo.h)0
-rw-r--r--src/benchmarks/falsesharing/fred.h (renamed from src/benchmarks/fred.h)0
-rw-r--r--src/benchmarks/falsesharing/timer.h (renamed from src/benchmarks/timer.h)0
-rw-r--r--src/benchmarks/larson/Makefile24
-rw-r--r--src/benchmarks/larson/larson.cc (renamed from src/benchmarks/larson.cc)0
-rw-r--r--src/benchmarks/loop/Makefile24
-rw-r--r--src/benchmarks/loop/loop.c (renamed from src/benchmarks/bench_loop.c)0
-rw-r--r--src/dj_trace.py4
-rw-r--r--src/falsesharing.py4
-rw-r--r--src/larson.py4
-rw-r--r--src/loop.py4
18 files changed, 138 insertions, 8 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..6b7b704
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,27 @@
+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)/print_status_on_exit.so $(OBJDIR)/chattymalloc.so
+
+$(OBJDIR)/print_status_on_exit.so: print_status_on_exit.c | $(OBJDIR)
+ $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
+
+$(OBJDIR)/chattymalloc.so: chattymalloc.c | $(OBJDIR)
+ $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $<
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)
diff --git a/src/benchmark.py b/src/benchmark.py
index 4de05e3..e4dbef2 100644
--- a/src/benchmark.py
+++ b/src/benchmark.py
@@ -81,6 +81,7 @@ 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)
@@ -256,6 +257,7 @@ class Benchmark (object):
if self.posttarget_hook((tname, t), run, verbose):
return False
print()
+ os.environ["PATH"] = os.environ["PATH"].replace(":build/"+self.name, "")
return True
def plot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'", autoticks=True,
diff --git a/src/benchmarks/dj_trace/Makefile b/src/benchmarks/dj_trace/Makefile
new file mode 100644
index 0000000..14eca91
--- /dev/null
+++ b/src/benchmarks/dj_trace/Makefile
@@ -0,0 +1,24 @@
+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)/trace_run
+
+$(OBJDIR)/trace_run: trace_run.c | $(OBJDIR)
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)
diff --git a/src/trace_run.c b/src/benchmarks/dj_trace/trace_run.c
index 604d01e..604d01e 100644
--- a/src/trace_run.c
+++ b/src/benchmarks/dj_trace/trace_run.c
diff --git a/src/benchmarks/falsesharing/Makefile b/src/benchmarks/falsesharing/Makefile
new file mode 100644
index 0000000..7dec230
--- /dev/null
+++ b/src/benchmarks/falsesharing/Makefile
@@ -0,0 +1,29 @@
+OBJDIR ?= obj
+
+CXX ?= g++
+
+WARNFLAGS ?= -Wall -Wextra
+COMMONFLAGS ?= -fno-builtin -fPIC -DPIC -pthread
+OPTFLAGS ?= -O3 -DNDEBUG
+
+CXXFLAGS ?= $(OPTFLAGS) $(WARNFLAGS) $(COMMONFLAGS)
+
+LDXXFLAGS ?= -pthread -static-libgcc -static-libstdc++
+
+HEADER = cpuinfo.h fred.h timer.h
+
+.PHONY = all clean
+
+all: $(OBJDIR)/cache-thrash $(OBJDIR)/cache-scratch
+
+$(OBJDIR)/cache-thrash: cache-thrash.cc $(HEADER) | $(OBJDIR)
+ $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
+
+$(OBJDIR)/cache-scratch: cache-scratch.cc $(HEADER) | $(OBJDIR)
+ $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)
diff --git a/src/benchmarks/cache-scratch.cc b/src/benchmarks/falsesharing/cache-scratch.cc
index 2cb9b28..2cb9b28 100644
--- a/src/benchmarks/cache-scratch.cc
+++ b/src/benchmarks/falsesharing/cache-scratch.cc
diff --git a/src/benchmarks/cache-thrash.cc b/src/benchmarks/falsesharing/cache-thrash.cc
index 79242eb..79242eb 100644
--- a/src/benchmarks/cache-thrash.cc
+++ b/src/benchmarks/falsesharing/cache-thrash.cc
diff --git a/src/benchmarks/cpuinfo.h b/src/benchmarks/falsesharing/cpuinfo.h
index 1ed1f36..1ed1f36 100644
--- a/src/benchmarks/cpuinfo.h
+++ b/src/benchmarks/falsesharing/cpuinfo.h
diff --git a/src/benchmarks/fred.h b/src/benchmarks/falsesharing/fred.h
index b0198a7..b0198a7 100644
--- a/src/benchmarks/fred.h
+++ b/src/benchmarks/falsesharing/fred.h
diff --git a/src/benchmarks/timer.h b/src/benchmarks/falsesharing/timer.h
index d4d42c7..d4d42c7 100644
--- a/src/benchmarks/timer.h
+++ b/src/benchmarks/falsesharing/timer.h
diff --git a/src/benchmarks/larson/Makefile b/src/benchmarks/larson/Makefile
new file mode 100644
index 0000000..9ccce9f
--- /dev/null
+++ b/src/benchmarks/larson/Makefile
@@ -0,0 +1,24 @@
+OBJDIR ?= obj
+
+CXX ?= g++
+
+WARNFLAGS ?= -Wall -Wextra
+COMMONFLAGS ?= -fno-builtin -fPIC -DPIC -pthread
+OPTFLAGS ?= -O3 -DNDEBUG
+
+CXXFLAGS ?= $(OPTFLAGS) $(WARNFLAGS) $(COMMONFLAGS)
+
+LDXXFLAGS ?= -pthread -static-libgcc -static-libstdc++
+
+.PHONY: all clean
+
+all: $(OBJDIR)/larson
+
+$(OBJDIR)/larson: larson.cc | $(OBJDIR)
+ $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $<
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)
diff --git a/src/benchmarks/larson.cc b/src/benchmarks/larson/larson.cc
index be8038f..be8038f 100644
--- a/src/benchmarks/larson.cc
+++ b/src/benchmarks/larson/larson.cc
diff --git a/src/benchmarks/loop/Makefile b/src/benchmarks/loop/Makefile
new file mode 100644
index 0000000..89914b2
--- /dev/null
+++ b/src/benchmarks/loop/Makefile
@@ -0,0 +1,24 @@
+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)/loop
+
+$(OBJDIR)/loop: loop.c | $(OBJDIR)
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
+
+$(OBJDIR):
+ mkdir $@
+
+clean:
+ rm -rf $(OBJDIR)
diff --git a/src/benchmarks/bench_loop.c b/src/benchmarks/loop/loop.c
index bc15808..bc15808 100644
--- a/src/benchmarks/bench_loop.c
+++ b/src/benchmarks/loop/loop.c
diff --git a/src/dj_trace.py b/src/dj_trace.py
index 21b9ddd..f4265ea 100644
--- a/src/dj_trace.py
+++ b/src/dj_trace.py
@@ -34,7 +34,7 @@ class Benchmark_DJ_Trace( Benchmark ):
also used by delorie to measure improvements in the
glibc allocator.""",
- self.cmd = "build/trace_run{binary_suffix} dj_workloads/{workload}.wl"
+ self.cmd = "trace_run{binary_suffix} dj_workloads/{workload}.wl"
self.measure_cmd = ""
self.args = {
@@ -80,7 +80,7 @@ class Benchmark_DJ_Trace( Benchmark ):
"realloc":117, "free":10099261, "threads": 19},
}
- self.requirements = ["build/trace_run"]
+ self.requirements = ["trace_run"]
super().__init__()
def prepare(self, verbose=False):
diff --git a/src/falsesharing.py b/src/falsesharing.py
index 57acf06..6c4ddc0 100644
--- a/src/falsesharing.py
+++ b/src/falsesharing.py
@@ -16,14 +16,14 @@ class Benchmark_Falsesharing( Benchmark ):
on the same cache line the writes will be expensive because
of cache thrashing."""
- self.cmd = "build/cache-{bench}{binary_suffix} {threads} 100 8 1000000"
+ self.cmd = "cache-{bench}{binary_suffix} {threads} 100 8 1000000"
self.args = {
"bench" : ["thrash", "scratch"],
"threads" : range(1, multiprocessing.cpu_count() * 2 + 1)
}
- self.requirements = ["build/cache-thrash", "build/cache-scratch"]
+ self.requirements = ["cache-thrash", "cache-scratch"]
super().__init__()
def process_output(self, result, stdout, stderr, target, perm, verbose):
diff --git a/src/larson.py b/src/larson.py
index 0a4a237..a035de8 100644
--- a/src/larson.py
+++ b/src/larson.py
@@ -13,14 +13,14 @@ class Benchmark_Larson( Benchmark ):
and deallocates objects, and then transfers some objects
(randomly selected) to other threads to be freed."""
- self.cmd = "build/larson{binary_suffix} 1 8 {maxsize} 1000 50000 1 {threads}"
+ self.cmd = "larson{binary_suffix} 1 8 {maxsize} 1000 50000 1 {threads}"
self.args = {
"maxsize" : [8, 32, 64, 128, 256, 512, 1024],
"threads" : range(1, multiprocessing.cpu_count() * 2 + 1)
}
- self.requirements = ["build/larson"]
+ self.requirements = ["larson"]
super().__init__()
def process_output(self, result, stdout, stderr, target, perm, verbose):
diff --git a/src/loop.py b/src/loop.py
index d58b4e2..81ddf19 100644
--- a/src/loop.py
+++ b/src/loop.py
@@ -9,14 +9,14 @@ class Benchmark_Loop( Benchmark ):
How allocations are freed can be changed with the benchmark
version""",
- self.cmd = "build/bench_loop{binary_suffix} {nthreads} 1000000 {maxsize}"
+ self.cmd = "loop{binary_suffix} {nthreads} 1000000 {maxsize}"
self.args = {
"maxsize" : [2 ** x for x in range(6, 16)],
"nthreads" : range(1, multiprocessing.cpu_count() * 2 + 1)
}
- self.requirements = ["build/bench_loop"]
+ self.requirements = ["loop"]
super().__init__()
def summary(self):