From 0f0243a8e9ca87b7ce5d5ffc2fb567508dbde270 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 7 Jun 2024 10:49:07 +0200 Subject: Allow benchmarking with #ranks instead of #dpus --- Microbenchmarks/CPU-DPU/Makefile | 5 +++-- Microbenchmarks/CPU-DPU/host/app.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Microbenchmarks/CPU-DPU/Makefile b/Microbenchmarks/CPU-DPU/Makefile index f354e67..f758d74 100644 --- a/Microbenchmarks/CPU-DPU/Makefile +++ b/Microbenchmarks/CPU-DPU/Makefile @@ -1,6 +1,7 @@ NR_TASKLETS ?= 16 BL ?= 8 -NR_DPUS ?= 1 +NR_DPUS ?= 0 +NR_RANKS ?= 0 TRANSFER ?= PUSH DPU_BINARY ?= '"bin/dpu_code"' @@ -8,7 +9,7 @@ COMMON_INCLUDES := support HOST_SOURCES := $(wildcard host/*.c) COMMON_FLAGS := -Wall -Wextra -g -I${COMMON_INCLUDES} -HOST_FLAGS := ${COMMON_FLAGS} -D_POSIX_C_SOURCE=200809L -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TRANSFER} -DDPU_BINARY=${DPU_BINARY} +HOST_FLAGS := ${COMMON_FLAGS} -D_POSIX_C_SOURCE=200809L -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DNR_RANKS=${NR_RANKS} -DBL=${BL} -D${TRANSFER} -DDPU_BINARY=${DPU_BINARY} DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TRANSFER} QUIET = @ diff --git a/Microbenchmarks/CPU-DPU/host/app.c b/Microbenchmarks/CPU-DPU/host/app.c index 7ef5f21..401722f 100644 --- a/Microbenchmarks/CPU-DPU/host/app.c +++ b/Microbenchmarks/CPU-DPU/host/app.c @@ -68,7 +68,13 @@ int main(int argc, char **argv) { snprintf(ntpp, 24, "nrThreadPerPool=%d", p.n_threads); // Allocate DPUs and load binary start(&timer, 4, 0); +#if NR_DPUS DPU_ASSERT(dpu_alloc(NR_DPUS, ntpp, &dpu_set)); +#elif NR_RANKS + DPU_ASSERT(dpu_alloc_ranks(NR_RANKS, ntpp, &dpu_set)); +#else +#error "NR_DPUS o NR_RANKS must be set" +#endif stop(&timer, 4); start(&timer, 5, 0); DPU_ASSERT(dpu_load(dpu_set, DPU_BINARY, NULL)); @@ -175,7 +181,7 @@ int main(int argc, char **argv) { #ifdef BROADCAST nr_of_dpus, nr_of_ranks, NR_TASKLETS, p.n_nops, p.n_instr, XSTR(T), transfer_size, transfer_size, transfer_mode, #else - nr_of_dpus, nr_of_ranks, NR_TASKLETS, p.n_nops, p.n_instr, XSTR(T), transfer_size, transfer_size / NR_DPUS, transfer_mode, + nr_of_dpus, nr_of_ranks, NR_TASKLETS, p.n_nops, p.n_instr, XSTR(T), transfer_size, transfer_size / nr_of_dpus, transfer_mode, #endif timer.nanoseconds[1], timer.nanoseconds[3], transfer_size * sizeof(T) * 1e9 / timer.nanoseconds[1], @@ -190,7 +196,7 @@ int main(int argc, char **argv) { // Check output bool status = true; -#ifdef BROADCASTX +#ifdef BROADCAST for (i = 0; i < input_size/nr_of_dpus; i++) { if(B[i] != bufferC[i]){ status = false; -- cgit v1.2.3