summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HST-S/Makefile50
-rw-r--r--HST-S/baselines/cpu/Makefile24
-rw-r--r--HST-S/baselines/cpu/app_baseline.c21
-rwxr-xr-xHST-S/baselines/cpu/run-opti.sh15
-rwxr-xr-xHST-S/baselines/cpu/run.sh24
-rw-r--r--HST-S/host/app.c27
-rwxr-xr-xHST-S/run-paper-strong-full.sh19
-rwxr-xr-xHST-S/run-paper-strong-rank.sh20
-rwxr-xr-xHST-S/run-paper-weak.sh20
-rwxr-xr-xHST-S/support/timer.h7
10 files changed, 186 insertions, 41 deletions
diff --git a/HST-S/Makefile b/HST-S/Makefile
index d71e793..de234d1 100644
--- a/HST-S/Makefile
+++ b/HST-S/Makefile
@@ -1,45 +1,37 @@
-DPU_DIR := dpu
-HOST_DIR := host
-BUILDDIR ?= bin
+NR_DPUS ?= 1
NR_TASKLETS ?= 16
BL ?= 10
-NR_DPUS ?= 1
ENERGY ?= 0
-define conf_filename
- ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3).conf
-endef
-CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL})
-
-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)
+HOST_SOURCES := $(wildcard host/*.c)
+DPU_SOURCES := $(wildcard dpu/*.c)
-.PHONY: all clean test
+COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL}
+HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DENERGY=${ENERGY}
+DPU_FLAGS := ${COMMON_FLAGS} -O2
-__dirs := $(shell mkdir -p ${BUILDDIR})
+QUIET = @
-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} -DENERGY=${ENERGY}
-DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL}
+ifdef verbose
+ QUIET =
+endif
-all: ${HOST_TARGET} ${DPU_TARGET}
+all: bin/host_code bin/dpu_code
-${CONF}:
- $(RM) $(call conf_filename,*,*)
- touch ${CONF}
+bin:
+ ${QUIET}mkdir -p bin
-${HOST_TARGET}: ${HOST_SOURCES} ${COMMON_INCLUDES} ${CONF}
- $(CC) -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
+bin/host_code: ${HOST_SOURCES} ${COMMON_INCLUDES} bin
+ ${QUIET}${CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS}
-${DPU_TARGET}: ${DPU_SOURCES} ${COMMON_INCLUDES} ${CONF}
- dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES}
+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}
+ ${QUIET}bin/host_code
+
+.PHONY: all clean test
diff --git a/HST-S/baselines/cpu/Makefile b/HST-S/baselines/cpu/Makefile
index 708ae72..4405afc 100644
--- a/HST-S/baselines/cpu/Makefile
+++ b/HST-S/baselines/cpu/Makefile
@@ -1,6 +1,24 @@
-all:
- gcc -o hist -fopenmp app_baseline.c
+all: hist
+
+hist: app_baseline.c
+ gcc -O2 -o hist -fopenmp app_baseline.c
+
+hist_O0: app_baseline.c
+ gcc -o hist_O0 -fopenmp app_baseline.c
+
+hist_O2: app_baseline.c
+ gcc -O2 -o hist_O2 -fopenmp app_baseline.c
+
+run: hist
+ ./hist -i 1006632960 -t 4
+
+run_O0: hist_O0
+ ./hist_O0 -i 1006632960 -t 4
+
+run_O2: hist_O2
+ ./hist_O2 -i 1006632960 -t 4
clean:
- rm hist
+ rm -f hist hist_O0 hist_O2
+.PHONY: all run run_O0 run_O2 clean
diff --git a/HST-S/baselines/cpu/app_baseline.c b/HST-S/baselines/cpu/app_baseline.c
index 8ae2c12..d67b6b3 100644
--- a/HST-S/baselines/cpu/app_baseline.c
+++ b/HST-S/baselines/cpu/app_baseline.c
@@ -23,6 +23,9 @@
#include "../../support/common.h"
#include "../../support/timer.h"
+#define XSTR(x) STR(x)
+#define STR(x) #x
+
// Pointer declaration
static T* A;
static unsigned int* histo_host;
@@ -180,9 +183,19 @@ int main(int argc, char **argv) {
histogram_host(histo_host, A, p.bins, input_size, p.exp, nr_of_dpus, p.n_threads);
stop(&timer, 0);
- printf("Kernel ");
- print(&timer, 0, 1);
- printf("\n");
-
+
+ unsigned int nr_threads = 0;
+#pragma omp parallel
+#pragma omp atomic
+ nr_threads++;
+
+ printf("[::] HST-S CPU | n_threads=%d e_type=%s n_elements=%d n_bins=%d "
+ "| throughput_MBps=%f",
+ nr_threads, XSTR(T), input_size, p.exp ? p.bins : p.bins * nr_of_dpus,
+ input_size * sizeof(T) / timer.time[0]);
+ printf(" throughput_MOpps=%f",
+ input_size / timer.time[0]);
+ printall(&timer, 0);
+
return 0;
}
diff --git a/HST-S/baselines/cpu/run-opti.sh b/HST-S/baselines/cpu/run-opti.sh
new file mode 100755
index 0000000..62a3e8b
--- /dev/null
+++ b/HST-S/baselines/cpu/run-opti.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+HOST="$(hostname)"
+
+echo $HOST
+
+make clean
+
+for i in $(seq 1 50); do
+ make run_O0 | sed 's/CPU/CPU O0/'
+done | tee "${HOST}-O0.txt"
+
+for i in $(seq 1 50); do
+ make run_O2 | sed 's/CPU/CPU O2/'
+done | tee "${HOST}-O2.txt"
diff --git a/HST-S/baselines/cpu/run.sh b/HST-S/baselines/cpu/run.sh
new file mode 100755
index 0000000..36fd28b
--- /dev/null
+++ b/HST-S/baselines/cpu/run.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+HOST="$(hostname)"
+
+echo $HOST
+
+(
+echo "prim-benchmarks HST-S CPU (dfatool edition)"
+echo "Started at $(date)"
+echo "Revision $(git describe --always)"
+
+# baseline ./hist supports -x, however -x 0 references uninitialized variables
+# and likely never has been used or tested. So we'll leave that out here.
+
+make -B verbose=1
+
+for nr_threads in 88 64 44 32 24 20 1 2 4 6 8 12 16; do
+ for i in `seq 1 20`; do
+ timeout --foreground -k 1m 30m ./hist -t ${nr_threads} -i 1006632960 || true
+ done
+done
+) | tee "${HOST}-explore.txt"
diff --git a/HST-S/host/app.c b/HST-S/host/app.c
index e50fd62..5dafa3a 100644
--- a/HST-S/host/app.c
+++ b/HST-S/host/app.c
@@ -23,6 +23,9 @@
#define DPU_BINARY "./bin/dpu_code"
#endif
+#define XSTR(x) STR(x)
+#define STR(x) #x
+
#if ENERGY
#include <dpu_probe.h>
#endif
@@ -40,7 +43,7 @@ static void read_input(T* A, const Params p) {
// Open input file
unsigned short temp;
- sprintf(dctFileName, p.file_name);
+ sprintf(dctFileName, "%s", p.file_name);
if((File = fopen(dctFileName, "rb")) != NULL) {
for(unsigned int y = 0; y < p.input_size; y++) {
fread(&temp, sizeof(unsigned short), 1, File);
@@ -138,14 +141,14 @@ int main(int argc, char **argv) {
// 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);
histogram_host(histo_host, A, p.bins, p.input_size, 1, nr_of_dpus);
if(rep >= p.n_warmup)
stop(&timer, 0);
printf("Load input data\n");
if(rep >= p.n_warmup)
- start(&timer, 1, rep - p.n_warmup);
+ start(&timer, 1, 0);
// Input arguments
unsigned int kernel = 0;
i = 0;
@@ -177,7 +180,7 @@ int main(int argc, char **argv) {
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
@@ -206,7 +209,7 @@ int main(int argc, char **argv) {
printf("Retrieve results\n");
i = 0;
if(rep >= p.n_warmup)
- start(&timer, 3, rep - p.n_warmup);
+ start(&timer, 3, 0);
// PARALLEL RETRIEVE TRANSFER
DPU_FOREACH(dpu_set, dpu, i) {
DPU_ASSERT(dpu_prepare_xfer(dpu, histo + p.bins * i));
@@ -222,6 +225,20 @@ int main(int argc, char **argv) {
if(rep >= p.n_warmup)
stop(&timer, 3);
+ if (rep >= p.n_warmup) {
+ printf("[::] HST-S NMC | n_dpus=%d n_tasklets=%d e_type=%s n_elements=%d n_bins=%d "
+ "| throughput_cpu_MBps=%f throughput_pim_MBps=%f throughput_MBps=%f",
+ nr_of_dpus, NR_TASKLETS, XSTR(T), input_size, p.bins,
+ 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",
+ input_size / timer.time[0],
+ input_size / timer.time[2],
+ input_size / (timer.time[1] + timer.time[2] + timer.time[3]));
+ printall(&timer, 3);
+ }
+
}
// Print timing results
diff --git a/HST-S/run-paper-strong-full.sh b/HST-S/run-paper-strong-full.sh
new file mode 100755
index 0000000..3706585
--- /dev/null
+++ b/HST-S/run-paper-strong-full.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+
+(
+
+echo "prim-benchmarks HST-S strong-full (dfatool edition)"
+echo "Started at $(date)"
+echo "Revision $(git describe --always)"
+
+for nr_dpus in 256 512 1024 2048; 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 verbose=1; then
+ timeout --foreground -k 1m 30m bin/host_code -w 0 -e 100 -b 256 -x 2 || true
+ fi
+ done
+done
+) | tee log-paper-strong-full.txt
diff --git a/HST-S/run-paper-strong-rank.sh b/HST-S/run-paper-strong-rank.sh
new file mode 100755
index 0000000..06d1354
--- /dev/null
+++ b/HST-S/run-paper-strong-rank.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+
+(
+
+echo "prim-benchmarks HST-S 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 verbose=1; then
+ timeout --foreground -k 1m 30m bin/host_code -w 0 -e 100 -b 256 -x 1 || true
+ fi
+ done
+done
+) | tee log-paper-strong-rank.txt
diff --git a/HST-S/run-paper-weak.sh b/HST-S/run-paper-weak.sh
new file mode 100755
index 0000000..db4d6fa
--- /dev/null
+++ b/HST-S/run-paper-weak.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+
+(
+
+echo "prim-benchmarks HST-S 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 verbose=1; then
+ timeout --foreground -k 1m 30m bin/host_code -w 0 -e 100 -b 256 -x 0 || true
+ fi
+ done
+done
+) | tee log-paper-weak.txt
diff --git a/HST-S/support/timer.h b/HST-S/support/timer.h
index eedc385..5c00213 100755
--- a/HST-S/support/timer.h
+++ b/HST-S/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");
+}