diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2023-05-25 09:00:26 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2023-05-25 09:00:26 +0200 |
commit | b3235ccc79c0783e95c1c5524b8b421d2d048cf7 (patch) | |
tree | 20e04b64fa79d4bc4f02c151de3af423ee690784 /SEL/baselines | |
parent | 19d1222c6d179f90c846b8fcbbb2bbfdc05a4587 (diff) |
port SEL cpu baseline to dfatool
Diffstat (limited to 'SEL/baselines')
-rw-r--r-- | SEL/baselines/cpu/Makefile | 31 | ||||
-rw-r--r-- | SEL/baselines/cpu/app_baseline.c | 59 | ||||
-rwxr-xr-x | SEL/baselines/cpu/run.sh | 17 |
3 files changed, 83 insertions, 24 deletions
diff --git a/SEL/baselines/cpu/Makefile b/SEL/baselines/cpu/Makefile index 9da107e..02d930c 100644 --- a/SEL/baselines/cpu/Makefile +++ b/SEL/baselines/cpu/Makefile @@ -1,6 +1,29 @@ -all: - gcc -o sel -fopenmp app_baseline.c +.PHONY: all +all: sel -clean: - rm sel +TYPE ?= uint64_t + +sel: app_baseline.c + gcc -O2 -o sel -fopenmp -DT=${TYPE} app_baseline.c + +sel_O0: app_baseline.c + gcc -o sel_O0 -fopenmp app_baseline.c + +sel_O2: app_baseline.c + gcc -O2 -o sel_O2 -fopenmp app_baseline.c +.PHONY: run +run: sel + ./sel -i 1258291200 -t 4 + +.PHONY: run_O0 +run_O0: sel_O0 + ./sel_O0 -i 1258291200 -t 4 + +.PHONY: run_O2 +run_O2: sel_O2 + ./sel_O2 -i 1258291200 -t 4 + +.PHONY: clean +clean: + rm -f sel sel_O0 sel_O2 diff --git a/SEL/baselines/cpu/app_baseline.c b/SEL/baselines/cpu/app_baseline.c index 96949c3..04a569f 100644 --- a/SEL/baselines/cpu/app_baseline.c +++ b/SEL/baselines/cpu/app_baseline.c @@ -14,13 +14,20 @@ #include <omp.h> #include "../../support/timer.h" -static uint64_t *A; -static uint64_t *B; -static uint64_t *C; -static uint64_t *C2; +#define XSTR(x) STR(x) +#define STR(x) #x + +#ifndef T +#define T uint64_t +#endif + +static T *A; +static T *B; +static T *C; +static T *C2; static int pos; -bool pred(const uint64_t x){ +bool pred(const T x){ return (x % 2) == 0; } @@ -28,11 +35,10 @@ bool pred(const uint64_t x){ void *create_test_file(unsigned int nr_elements) { //srand(0); - A = (uint64_t*) malloc(nr_elements * sizeof(uint64_t)); - B = (uint64_t*) malloc(nr_elements * sizeof(uint64_t)); - C = (uint64_t*) malloc(nr_elements * sizeof(uint64_t)); + A = (T*) malloc(nr_elements * sizeof(T)); + B = (T*) malloc(nr_elements * sizeof(T)); + C = (T*) malloc(nr_elements * sizeof(T)); - printf("nr_elements\t%u\t", nr_elements); for (int i = 0; i < nr_elements; i++) { //A[i] = (unsigned int) (rand()); A[i] = i+1; @@ -123,25 +129,38 @@ int main(int argc, char **argv) { struct Params p = input_params(argc, argv); const unsigned int file_size = p.input_size; - uint32_t accum = 0; int total_count; // Create an input file with arbitrary data. create_test_file(file_size); Timer timer; - start(&timer, 0, 0); - - total_count = select_host(file_size, p.n_threads); - stop(&timer, 0); - - printf("Total count = %d\t", total_count); + for(int rep = 0; rep < p.n_warmup + p.n_reps; rep++) { + start(&timer, 0, 0); + total_count = select_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); + } + } - printf("Kernel "); - print(&timer, 0, 1); - printf("\n"); - free(A); free(B); free(C); diff --git a/SEL/baselines/cpu/run.sh b/SEL/baselines/cpu/run.sh new file mode 100755 index 0000000..ce72e1f --- /dev/null +++ b/SEL/baselines/cpu/run.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +echo "prim-benchmarks SEL 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 1258291200 629145600 314572800 157286400 78643200 39321600 19660800; do + for dt in uint8_t uint16_t uint32_t uint64_t float double; do + if make -B TYPE=${dt}; then + timeout -k 1m 30m ./sel -i ${i} -w 0 -e 100 -t ${nr_threads} || true + fi + done + done +done |