From 19d1222c6d179f90c846b8fcbbb2bbfdc05a4587 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 25 May 2023 08:44:21 +0200 Subject: port UNI to dfatool --- UNI/baselines/cpu/Makefile | 31 +++++++++++++++++++++++++++---- UNI/baselines/cpu/app_baseline.c | 39 +++++++++++++++++++++++++++++---------- UNI/baselines/cpu/run.sh | 17 +++++++++++++++++ UNI/support/timer.h | 7 +++++++ 4 files changed, 80 insertions(+), 14 deletions(-) create mode 100755 UNI/baselines/cpu/run.sh (limited to 'UNI') diff --git a/UNI/baselines/cpu/Makefile b/UNI/baselines/cpu/Makefile index a1b4766..10e4f9b 100644 --- a/UNI/baselines/cpu/Makefile +++ b/UNI/baselines/cpu/Makefile @@ -1,6 +1,29 @@ -all: - gcc -o uni -fopenmp app_baseline.c +.PHONY: all +all: uni -clean: - rm uni +TYPE ?= int64_t + +uni: app_baseline.c + gcc -O2 -o uni -fopenmp -DT=${TYPE} app_baseline.c + +uni_O0: app_baseline.c + gcc -o uni_O0 -fopenmp app_baseline.c + +uni_O2: app_baseline.c + gcc -O2 -o uni_O2 -fopenmp app_baseline.c +.PHONY: run +run: uni + ./uni -i 1258291200 -t 4 + +.PHONY: run_O0 +run_O0: uni_O0 + ./uni_O0 -i 1258291200 -t 4 + +.PHONY: run_O2 +run_O2: uni_O2 + ./uni_O2 -i 1258291200 -t 4 + +.PHONY: clean +clean: + rm -f uni uni_O0 uni_O2 diff --git a/UNI/baselines/cpu/app_baseline.c b/UNI/baselines/cpu/app_baseline.c index 9d3184c..39f225a 100644 --- a/UNI/baselines/cpu/app_baseline.c +++ b/UNI/baselines/cpu/app_baseline.c @@ -10,7 +10,12 @@ #include #include "../../support/timer.h" +#define XSTR(x) STR(x) +#define STR(x) #x + +#ifndef T #define T int64_t +#endif static int pos; @@ -124,17 +129,31 @@ int main(int argc, char **argv) { create_test_file(file_size); Timer timer; - start(&timer, 0, 0); - - total_count = unique_host(file_size, p.n_threads); - - stop(&timer, 0); - printf("Total count = %d\t", total_count); - - printf("Kernel "); - print(&timer, 0, 1); - printf("\n"); + for(int rep = 0; rep < p.n_warmup + p.n_reps; rep++) { + start(&timer, 0, 0); + total_count = unique_host(file_size, p.n_threads); + stop(&timer, 0); + + unsigned int nr_threads = 0; +#pragma omp parallel +#pragma omp atomic + nr_threads++; + + if (rep >= p.n_warmup) { + printf("[::] n_threads=%d e_type=%s n_elements=%d " + "| throughput_cpu_MBps=%f\n", + nr_threads, XSTR(T), file_size, + file_size * 2 * sizeof(T) / timer.time[0]); + printf("[::] n_threads=%d e_type=%s n_elements=%d " + "| throughput_cpu_MOpps=%f\n", + nr_threads, XSTR(T), file_size, + file_size / timer.time[0]); + printf("[::] n_threads=%d e_type=%s n_elements=%d | ", + nr_threads, XSTR(T), file_size); + printall(&timer, 0); + } + } free(A); free(B); diff --git a/UNI/baselines/cpu/run.sh b/UNI/baselines/cpu/run.sh new file mode 100755 index 0000000..3c99ad2 --- /dev/null +++ b/UNI/baselines/cpu/run.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +echo "prim-benchmarks UNI CPU (dfatool edition)" +echo "Started at $(date)" +echo "Revision $(git describe --always)" + +for nr_threads in 1 2 4 6 8 12 16 20 24 32; do + for i in 19660800 1258291200 629145600 314572800 157286400 78643200 39321600; do + for dt in int8_t int16_t int32_t int64_t float double; do + if make -B TYPE=${dt}; then + timeout -k 1m 30m ./uni -i ${i} -w 0 -e 100 -t ${nr_threads} || true + fi + done + done +done diff --git a/UNI/support/timer.h b/UNI/support/timer.h index b53d95f..4d597b9 100755 --- a/UNI/support/timer.h +++ b/UNI/support/timer.h @@ -57,3 +57,10 @@ void stop(Timer *timer, int i) { } void print(Timer *timer, int i, int REP) { printf("Time (ms): %f\t", timer->time[i] / (1000 * REP)); } + +void printall(Timer *timer, int maxt) { + for (int i = 0; i <= maxt; i++) { + printf(" timer%d_us=%f", i, timer->time[i]); + } + printf("\n"); +} -- cgit v1.2.3