diff options
Diffstat (limited to 'COUNT/baselines')
-rw-r--r-- | COUNT/baselines/cpu/Makefile | 27 | ||||
-rw-r--r-- | COUNT/baselines/cpu/app_baseline.c | 22 |
2 files changed, 43 insertions, 6 deletions
diff --git a/COUNT/baselines/cpu/Makefile b/COUNT/baselines/cpu/Makefile index 4608944..ede0498 100644 --- a/COUNT/baselines/cpu/Makefile +++ b/COUNT/baselines/cpu/Makefile @@ -1,8 +1,23 @@ -NUMA ?= 0 -FLAGS = +benchmark ?= 1 +debug ?= 0 +native ?= 1 +nop_sync ?= 0 +numa ?= 0 +numa_memcpy ?= 0 -ifeq (${NUMA}, 1) - FLAGS += -lnuma +CFLAGS = +LDFLAGS = + +ifeq (${debug}, 1) + CFLAGS += -g +endif + +ifeq (${native}, 1) + CFLAGS += -march=native +endif + +ifeq (${numa}, 1) + LDFLAGS += -lnuma endif .PHONY: all @@ -11,7 +26,7 @@ all: count TYPE ?= uint64_t count: app_baseline.c - gcc -Wall -Wextra -pedantic -march=native -O2 -o count -fopenmp -DT=${TYPE} -DNUMA=${NUMA} app_baseline.c ${FLAGS} + gcc -Wall -Wextra -pedantic -O3 ${CFLAGS} -o count -DT=${TYPE} -DNUMA=${numa} -DNOP_SYNC=${nop_sync} -DWITH_BENCHMARK=${benchmark} app_baseline.c -fopenmp ${LDFLAGS} .PHONY: run run: count @@ -19,4 +34,4 @@ run: count .PHONY: clean clean: - rm -f count count_O0 count_O2 + rm -f count diff --git a/COUNT/baselines/cpu/app_baseline.c b/COUNT/baselines/cpu/app_baseline.c index d52257a..4e96276 100644 --- a/COUNT/baselines/cpu/app_baseline.c +++ b/COUNT/baselines/cpu/app_baseline.c @@ -12,7 +12,13 @@ #include <assert.h> #include <stdint.h> #include <omp.h> + +#if WITH_BENCHMARK #include "../../support/timer.h" +#else +#define start(...) +#define stop(...) +#endif #if NUMA #include <numaif.h> @@ -186,13 +192,22 @@ int main(int argc, char **argv) { // Create an input file with arbitrary data. create_test_file(file_size); +#if WITH_BENCHMARK Timer timer; +#endif + +#if NOP_SYNC + for(int rep = 0; rep < 200000; rep++) { + asm volatile("nop" ::); + } +#endif for(int rep = 0; rep < p.n_warmup + p.n_reps; rep++) { start(&timer, 0, 0); total_count = count_host(file_size, p.n_threads); stop(&timer, 0); +#if WITH_BENCHMARK unsigned int nr_threads = 0; #pragma omp parallel #pragma omp atomic @@ -213,8 +228,15 @@ int main(int argc, char **argv) { file_size / timer.time[0]); printall(&timer, 0); } +#endif // WITH_BENCHMARK } +#if NOP_SYNC + for(int rep = 0; rep < 200000; rep++) { + asm volatile("nop" ::); + } +#endif + #if NUMA numa_free(A, file_size * sizeof(T)); #else |