diff options
-rw-r--r-- | HST-L/Makefile | 52 | ||||
-rw-r--r-- | HST-L/host/app.c | 37 | ||||
-rwxr-xr-x | HST-L/run-paper-strong-full.sh | 20 | ||||
-rwxr-xr-x | HST-L/run-paper-strong-rank.sh | 20 | ||||
-rwxr-xr-x | HST-L/run-paper-weak.sh | 20 | ||||
-rwxr-xr-x | HST-L/support/timer.h | 7 |
6 files changed, 116 insertions, 40 deletions
diff --git a/HST-L/Makefile b/HST-L/Makefile index fb1ce5a..1888b0a 100644 --- a/HST-L/Makefile +++ b/HST-L/Makefile @@ -1,46 +1,38 @@ -DPU_DIR := dpu -HOST_DIR := host -BUILDDIR ?= bin -NR_TASKLETS ?= 16 -BL ?= 8 NR_DPUS ?= 1 +NR_TASKLETS ?= 16 NR_HISTO ?= 1 +BL ?= 10 ENERGY ?= 0 -define conf_filename - ${BUILDDIR}/.NR_DPUS_$(1)_NR_TASKLETS_$(2)_BL_$(3)_NR_DPUS_$(4).conf -endef -CONF := $(call conf_filename,${NR_DPUS},${NR_TASKLETS},${BL},${NR_DPUS}) - -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} -DNR_HISTO=${NR_HISTO} +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} -DNR_HISTO=${NR_HISTO} +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-L/host/app.c b/HST-L/host/app.c index 09ab578..b9c07f9 100644 --- a/HST-L/host/app.c +++ b/HST-L/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,11 +180,12 @@ 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 } + DPU_ASSERT(dpu_launch(dpu_set, DPU_SYNCHRONOUS)); if(rep >= p.n_warmup) { stop(&timer, 2); @@ -205,22 +209,36 @@ 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)); } DPU_ASSERT(dpu_push_xfer(dpu_set, DPU_XFER_FROM_DPU, DPU_MRAM_HEAP_POINTER_NAME, input_size_dpu_8bytes * sizeof(T), p.bins * sizeof(unsigned int), DPU_XFER_DEFAULT)); - + // Final histogram merging for(i = 1; i < nr_of_dpus; i++){ for(unsigned int j = 0; j < p.bins; j++){ histo[j] += histo[j + i * p.bins]; - } - } + } + } if(rep >= p.n_warmup) stop(&timer, 3); + if (rep >= p.n_warmup) { + printf("[::] HST-L NMC | n_dpus=%d n_tasklets=%d e_type=%s n_elements=%u 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 @@ -237,8 +255,7 @@ int main(int argc, char **argv) { double energy; DPU_ASSERT(dpu_probe_get(&probe, DPU_ENERGY, DPU_AVERAGE, &energy)); printf("DPU Energy (J): %f\t", energy); - #endif - + #endif // Check output bool status = true; diff --git a/HST-L/run-paper-strong-full.sh b/HST-L/run-paper-strong-full.sh new file mode 100755 index 0000000..0108d40 --- /dev/null +++ b/HST-L/run-paper-strong-full.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +( + +echo "prim-benchmarks HST-S strong-full (dfatool edition)" +echo "Started at $(date)" +echo "Revision $(git describe --always)" + +# >2048 are not part of upstream +for nr_dpus in 2543 2304 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-L/run-paper-strong-rank.sh b/HST-L/run-paper-strong-rank.sh new file mode 100755 index 0000000..f2f80b1 --- /dev/null +++ b/HST-L/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)" + +# >64 are not part of upstream config space +for nr_dpus in 128 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-L/run-paper-weak.sh b/HST-L/run-paper-weak.sh new file mode 100755 index 0000000..3ddd801 --- /dev/null +++ b/HST-L/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 >64 +for nr_dpus in 256 512 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-L/support/timer.h b/HST-L/support/timer.h index eedc385..5c00213 100755 --- a/HST-L/support/timer.h +++ b/HST-L/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");
+}
|