summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TRNS/baselines/cpu/Makefile11
-rw-r--r--TRNS/baselines/cpu/main.cpp16
2 files changed, 21 insertions, 6 deletions
diff --git a/TRNS/baselines/cpu/Makefile b/TRNS/baselines/cpu/Makefile
index 438b9fb..2f28738 100644
--- a/TRNS/baselines/cpu/Makefile
+++ b/TRNS/baselines/cpu/Makefile
@@ -32,23 +32,30 @@
# THE SOFTWARE.
#
+benchmark ?= 1
+debug ?= 0
native ?= 1
+nop_sync ?= 0
numa ?= 0
numa_memcpy ?= 0
CFLAGS =
LDFLAGS =
+ifeq (${debug}, 1)
+ CFLAGS += -g
+endif
+
ifeq (${native}, 1)
CFLAGS += -march=native
endif
ifeq (${numa}, 1)
- FLAGS += -lnuma
+ LDFLAGS += -lnuma
endif
CXX=g++
-CXX_FLAGS=-std=c++11 -Wall -Wextra -pedantic -DNUMA=${numa} -DNUMA_MEMCPY=${numa_memcpy}
+CXX_FLAGS=-std=c++11 -Wall -Wextra -pedantic -DNUMA=${numa} -DNUMA_MEMCPY=${numa_memcpy} -DNOP_SYNC=${nop_sync} -DWITH_BENCHMARK=${benchmark}
LIB=-L/usr/lib/ -lm -pthread
diff --git a/TRNS/baselines/cpu/main.cpp b/TRNS/baselines/cpu/main.cpp
index c8cccaf..b4cd149 100644
--- a/TRNS/baselines/cpu/main.cpp
+++ b/TRNS/baselines/cpu/main.cpp
@@ -36,9 +36,18 @@
#include "support/setup.h"
#include "kernel.h"
#include "support/common.h"
-#include "support/timer.h"
#include "support/verify.h"
+#if WITH_BENCHMARK
+#include "support/timer.h"
+#else
+#include <string>
+struct Timer {
+ inline void start(std::string name) {(void)name;}
+ inline void stop(std::string name) {(void)name;}
+};
+#endif
+
#include <unistd.h>
#include <thread>
#include <string.h>
@@ -362,6 +371,7 @@ int main(int argc, char **argv) {
timer.stop("free");
#endif
+#if WITH_BENCHMARK
if (rep >= p.n_warmup) {
#if NUMA_MEMCPY
printf("[::] TRNS-CPU-MEMCPY | n_threads=%d e_type=%s n_elements=%d"
@@ -396,10 +406,8 @@ int main(int argc, char **argv) {
timer.get("Step 1") + timer.get("Step 2") + timer.get("Step 3"));
#endif // NUMA_MEMCPY
}
+#endif // WITH_BENCHMARK
}
- //timer.print("Step 1", p.n_reps);
- //timer.print("Step 2", p.n_reps);
- //timer.print("Step 3", p.n_reps);
// Verify answer
//verify(h_local, h_in_backup, M_ * m, N_ * n, 1);