summaryrefslogtreecommitdiff
path: root/RED
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2023-06-01 16:20:07 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2023-06-01 16:20:07 +0200
commit80e965ed9678192ad205979ce9a9af9f8c89a6db (patch)
tree5e194f94784dd75d93676e3a6269f7f07f4fefc1 /RED
parent7bb062e2e774a1d8d06b4aa7d856097a4bc8b589 (diff)
RED: update dfatool integration; port nmc version; add eval scripts
Diffstat (limited to 'RED')
-rw-r--r--RED/Makefile46
-rw-r--r--RED/baselines/cpu/Makefile9
-rw-r--r--RED/baselines/cpu/app_baseline.cpp10
-rwxr-xr-xRED/baselines/cpu/run-opti.sh9
-rwxr-xr-xRED/baselines/cpu/run.sh18
-rw-r--r--RED/host/app.c59
-rwxr-xr-xRED/run-paper-strong-rank.sh25
-rwxr-xr-xRED/run-paper-weak.sh25
8 files changed, 142 insertions, 59 deletions
diff --git a/RED/Makefile b/RED/Makefile
index ffdeecc..fc8298d 100644
--- a/RED/Makefile
+++ b/RED/Makefile
@@ -1,6 +1,3 @@
-DPU_DIR := dpu
-HOST_DIR := host
-BUILDDIR ?= bin
NR_TASKLETS ?= 16
BL ?= 10
NR_DPUS ?= 1
@@ -10,40 +7,35 @@ TYPE ?= INT64
ENERGY ?= 0
PERF ?= 0
-define conf_filename
- ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_VERSION_$(4)_SYNC_$(5)_TYPE_$(6).conf
-endef
-CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${VERSION},${SYNC},${TYPE})
-
-HOST_TARGET := ${BUILDDIR}/host_code
-DPU_TARGET := ${BUILDDIR}/dpu_code
-
COMMON_INCLUDES := support
-HOST_SOURCES := $(wildcard ${HOST_DIR}/*.c)
-DPU_SOURCES := $(wildcard ${DPU_DIR}/*.c)
-
-.PHONY: all clean test
-
-__dirs := $(shell mkdir -p ${BUILDDIR})
+HOST_SOURCES := $(wildcard host/*.c)
+DPU_SOURCES := $(wildcard dpu/*.c)
COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES}
HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${VERSION} -D${SYNC} -D${TYPE} -DENERGY=${ENERGY} -DPERF=${PERF}
DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${VERSION} -D${SYNC} -D${TYPE} -DPERF=${PERF}
-all: ${HOST_TARGET} ${DPU_TARGET}
+QUIET = @
-${CONF}:
- $(RM) $(call conf_filename,*,*)
- touch ${CONF}
+ifdef verbose
+ QUIET =
+endif
-${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF}
- $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+all: bin/host_code bin/dpu_code
-${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF}
- dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
+bin:
+ ${QUIET}mkdir -p bin
+
+bin/host_code: ${HOST_SOURCES} ${COMMON_INCLUDES} bin
+ ${QUIET}${CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+
+bin/dpu_code: ${DPU_SOURCES} ${COMMON_INCLUDES} bin
+ ${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
clean:
- $(RM) -r $(BUILDDIR)
+ ${QUIET}rm -rf bin
test: all
- ./${HOST_TARGET} -w 0 -e 1 -i 6553600 -x 1
+ ${QUIET}bin/host_code -w 0 -e 1 -i 6553600 -x 1
+
+.PHONY: all clean test
diff --git a/RED/baselines/cpu/Makefile b/RED/baselines/cpu/Makefile
index e4d935c..4350185 100644
--- a/RED/baselines/cpu/Makefile
+++ b/RED/baselines/cpu/Makefile
@@ -1,5 +1,12 @@
-all:
+all: red
+
+red: app_baseline.cpp
g++ -O2 app_baseline.cpp -fopenmp -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_CPP -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP -lgomp -lm -o red -D${TYPE}
+run: red
+ ./red -i 1048576000 -t 4
+
clean:
rm red
+
+.PHONY: all clean run
diff --git a/RED/baselines/cpu/app_baseline.cpp b/RED/baselines/cpu/app_baseline.cpp
index db4b060..10534c6 100644
--- a/RED/baselines/cpu/app_baseline.cpp
+++ b/RED/baselines/cpu/app_baseline.cpp
@@ -194,18 +194,14 @@ int main(int argc, char **argv) {
if (status) {
printf("[" ANSI_COLOR_GREEN "OK" ANSI_COLOR_RESET "] Outputs are equal\n");
if(rep >= p.n_warmup) {
- printf("[::] n_threads=%d e_type=%s n_elements=%d "
- "| throughput_cpu_ref_MBps=%f throughput_cpu_thrust_MBps=%f\n",
+ printf("[::] RED CPU | n_threads=%d e_type=%s n_elements=%u "
+ "| throughput_seq_MBps=%f throughput_MBps=%f",
nr_threads, XSTR(T), input_size,
input_size * sizeof(T) / timer.time[0],
input_size * sizeof(T) / timer.time[1]);
- printf("[::] n_threads=%d e_type=%s n_elements=%d "
- "| throughput_cpu_ref_MOpps=%f throughput_cpu_thrust_MOpps=%f\n",
- nr_threads, XSTR(T), input_size,
+ printf(" throughput_seq_MOpps=%f throughput_MOpps=%f",
input_size / timer.time[0],
input_size / timer.time[1]);
- printf("[::] n_threads=%d e_type=%s n_elements=%d | ",
- nr_threads, XSTR(T), input_size);
printall(&timer, 1);
}
} else {
diff --git a/RED/baselines/cpu/run-opti.sh b/RED/baselines/cpu/run-opti.sh
new file mode 100755
index 0000000..bd380c7
--- /dev/null
+++ b/RED/baselines/cpu/run-opti.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+HOST="$(hostname)"
+
+echo $HOST
+
+make -B TYPE=UINT64 verbose=1
+
+./red -i 1048576000 -t 4 -w 0 -e 100 | sed 's/CPU/CPU Baseline/' | tee "${HOST}-baseline.txt"
diff --git a/RED/baselines/cpu/run.sh b/RED/baselines/cpu/run.sh
index 1707edf..3a0fb09 100755
--- a/RED/baselines/cpu/run.sh
+++ b/RED/baselines/cpu/run.sh
@@ -2,16 +2,26 @@
set -e
+HOST="$(hostname)"
+
+echo $HOST
+
+(
+
echo "prim-benchmarks RED CPU/Thrust (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
+# default: UINT64 -i 1048576000 -t 4
+
+for nr_threads in 88 64 44 1 2 4 6 8 12 16 20 24 32; do
for i in 2048 4096 8192 16384 65536 262144 1048576 3932160 15728640 31457280 262144000 1048576000 2097152000; do
- for dt in UINT32 UINT64 INT32 INT64 FLOAT DOUBLE; do
- if make -B TYPE=${dt}; then
- timeout -k 1m 30m ./red -i ${i} -w 0 -e 100 -t ${nr_threads} || true
+ #for dt in UINT32 UINT64 INT32 INT64 FLOAT DOUBLE; do
+ for dt in UINT64; do
+ if make -B TYPE=${dt} verbose=1; then
+ timeout -k 1m 60m ./red -i ${i} -w 0 -e 100 -t ${nr_threads} || true
fi
done
done
done
+) | tee "${HOST}-explore.txt"
diff --git a/RED/host/app.c b/RED/host/app.c
index c274db0..eefb696 100644
--- a/RED/host/app.c
+++ b/RED/host/app.c
@@ -22,6 +22,9 @@
#define DPU_BINARY "./bin/dpu_code"
#endif
+#define XSTR(x) STR(x)
+#define STR(x) #x
+
#if ENERGY
#include <dpu_probe.h>
#endif
@@ -32,7 +35,7 @@ static T* A;
// Create input arrays
static void read_input(T* A, unsigned int nr_elements) {
srand(0);
- printf("nr_elements\t%u\t", nr_elements);
+ //printf("nr_elements\t%u\t", nr_elements);
for (unsigned int i = 0; i < nr_elements; i++) {
A[i] = (T)(rand());
}
@@ -64,7 +67,7 @@ int main(int argc, char **argv) {
DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set));
DPU_ASSERT(dpu_load(dpu_set, DPU_BINARY, NULL));
DPU_ASSERT(dpu_get_nr_dpus(dpu_set, &nr_of_dpus));
- printf("Allocated %d DPU(s)\n", nr_of_dpus);
+ //printf("Allocated %d DPU(s)\n", nr_of_dpus);
unsigned int i = 0;
#if PERF
@@ -91,21 +94,21 @@ int main(int argc, char **argv) {
// Timer declaration
Timer timer;
- printf("NR_TASKLETS\t%d\tBL\t%d\n", NR_TASKLETS, BL);
+ //printf("NR_TASKLETS\t%d\tBL\t%d\n", NR_TASKLETS, BL);
// Loop over main kernel
for(int rep = 0; rep < p.n_warmup + p.n_reps; rep++) {
// Compute output on CPU (performance comparison and verification purposes)
if(rep >= p.n_warmup)
- start(&timer, 0, rep - p.n_warmup);
+ start(&timer, 0, 0);
count_host = reduction_host(A, input_size);
if(rep >= p.n_warmup)
stop(&timer, 0);
- printf("Load input data\n");
+ //printf("Load input data\n");
if(rep >= p.n_warmup)
- start(&timer, 1, rep - p.n_warmup);
+ start(&timer, 1, 0);
count = 0;
// Input arguments
unsigned int kernel = 0;
@@ -129,10 +132,10 @@ int main(int argc, char **argv) {
if(rep >= p.n_warmup)
stop(&timer, 1);
- printf("Run program on DPU(s) \n");
+ //printf("Run program on DPU(s) \n");
// Run DPU kernel
if(rep >= p.n_warmup) {
- start(&timer, 2, rep - p.n_warmup);
+ start(&timer, 2, 0);
#if ENERGY
DPU_ASSERT(dpu_probe_start(&probe));
#endif
@@ -158,11 +161,11 @@ int main(int argc, char **argv) {
}
#endif
- printf("Retrieve results\n");
+ //printf("Retrieve results\n");
dpu_results_t results[nr_of_dpus];
T* results_count = malloc(nr_of_dpus * sizeof(T));
if(rep >= p.n_warmup)
- start(&timer, 3, rep - p.n_warmup);
+ start(&timer, 3, 0);
i = 0;
// PARALLEL RETRIEVE TRANSFER
dpu_results_t* results_retrieve[nr_of_dpus];
@@ -223,12 +226,36 @@ int main(int argc, char **argv) {
// Free memory
free(results_count);
+
+ // Check output
+ bool status = true;
+ if(count != count_host) status = false;
+ if (status) {
+ printf("[" ANSI_COLOR_GREEN "OK" ANSI_COLOR_RESET "] Outputs are equal\n");
+ if (rep >= p.n_warmup) {
+ printf("[::] RED NMC | n_dpus=%d n_tasklets=%d e_type=%s block_size_B=%d n_elements=%d "
+ "| throughput_cpu_MBps=%f throughput_pim_MBps=%f throughput_MBps=%f",
+ nr_of_dpus, NR_TASKLETS, XSTR(T), BLOCK_SIZE, input_size,
+ input_size * sizeof(T) / timer.time[0],
+ input_size * sizeof(T) / (timer.time[2]),
+ input_size * sizeof(T) / (timer.time[1] + timer.time[2] + timer.time[3]));
+ printf(" throughput_cpu_MOpps=%f throughput_pim_MOpps=%f throughput_MOpps=%f\n",
+ input_size / timer.time[0],
+ input_size / (timer.time[2]),
+ input_size / (timer.time[1] + timer.time[2] + timer.time[3]));
+ printall(&timer, 3);
+ }
+ } else {
+ printf("[" ANSI_COLOR_RED "ERROR" ANSI_COLOR_RESET "] Outputs differ!\n");
+ }
+
}
#if PERF
printf("DPU cycles = %g cc\n", cc / p.n_reps);
#endif
// Print timing results
+/*
printf("CPU ");
print(&timer, 0, p.n_reps);
printf("CPU-DPU ");
@@ -237,6 +264,7 @@ int main(int argc, char **argv) {
print(&timer, 2, p.n_reps);
printf("Inter-DPU ");
print(&timer, 3, p.n_reps);
+*/
#if ENERGY
double energy;
@@ -244,18 +272,9 @@ int main(int argc, char **argv) {
printf("DPU Energy (J): %f\t", energy);
#endif
- // Check output
- bool status = true;
- if(count != count_host) status = false;
- if (status) {
- printf("[" ANSI_COLOR_GREEN "OK" ANSI_COLOR_RESET "] Outputs are equal\n");
- } else {
- printf("[" ANSI_COLOR_RED "ERROR" ANSI_COLOR_RESET "] Outputs differ!\n");
- }
-
// Deallocation
free(A);
DPU_ASSERT(dpu_free(dpu_set));
- return status ? 0 : -1;
+ return 0;
}
diff --git a/RED/run-paper-strong-rank.sh b/RED/run-paper-strong-rank.sh
new file mode 100755
index 0000000..ed6e60e
--- /dev/null
+++ b/RED/run-paper-strong-rank.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+# BL: use 2^(BL) B blocks for MRAM <-> WRAM transfers on PIM module
+# T: data type
+# -w: number of un-timed warmup iterations
+# -e: number of timed iterations
+
+(
+
+echo "prim-benchmarks RED strong-rank (dfatool edition)"
+echo "Started at $(date)"
+echo "Revision $(git describe --always)"
+
+# 256 and 512 are not part of upstream config space
+for nr_dpus in 512 256 1 4 16 64; do
+ for nr_tasklets in 1 2 4 8 16; do
+ echo
+ if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 VERSION=SINGLE verbose=1; then
+ timeout --foreground -k 1m 30m bin/host_code -w 0 -e 100 -i 6553600 -x 1 || true
+ fi
+ done
+done
+) | tee log-paper-strong-rank.txt
diff --git a/RED/run-paper-weak.sh b/RED/run-paper-weak.sh
new file mode 100755
index 0000000..5a66cbc
--- /dev/null
+++ b/RED/run-paper-weak.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+# BL: use 2^(BL) B blocks for MRAM <-> WRAM transfers on PIM module
+# T: data type
+# -w: number of un-timed warmup iterations
+# -e: number of timed iterations
+
+(
+
+echo "prim-benchmarks RED weak (dfatool edition)"
+echo "Started at $(date)"
+echo "Revision $(git describe --always)"
+
+# upstream does not include 256 and 512 in config space
+for nr_dpus in 512 256 1 4 16 64; do
+ for nr_tasklets in 1 2 4 8 16; do
+ echo
+ if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} BL=10 VERSION=SINGLE verbose=1; then
+ timeout --foreground -k 1m 30m bin/host_code -w 0 -e 100 -i 6553600 -x 0 || true
+ fi
+ done
+done
+) | tee log-paper-weak.txt