summaryrefslogtreecommitdiff
path: root/SEL/baselines/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'SEL/baselines/cpu')
-rw-r--r--SEL/baselines/cpu/Makefile31
-rw-r--r--SEL/baselines/cpu/app_baseline.c59
-rwxr-xr-xSEL/baselines/cpu/run.sh17
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