From 53762e189a5efaa279ccd978ad52b27c4721566d Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 27 Nov 2023 10:55:01 +0100 Subject: VA: add dpuinfo and singlethreaded options singlethreading does not seem to work at all. Funny SDK. --- VA/Makefile | 4 +++- VA/host/app.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'VA') diff --git a/VA/Makefile b/VA/Makefile index b3c6199..0994df9 100644 --- a/VA/Makefile +++ b/VA/Makefile @@ -6,13 +6,15 @@ ENERGY ?= 0 WITH_ALLOC_OVERHEAD ?= 0 WITH_LOAD_OVERHEAD ?= 0 WITH_FREE_OVERHEAD ?= 0 +WITH_DPUINFO ?= 0 +SDK_SINGLETHREADED ?= 0 COMMON_INCLUDES := support 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${TYPE} -DENERGY=${ENERGY} -DWITH_ALLOC_OVERHEAD=${WITH_ALLOC_OVERHEAD} -DWITH_LOAD_OVERHEAD=${WITH_LOAD_OVERHEAD} -DWITH_FREE_OVERHEAD=${WITH_FREE_OVERHEAD} +HOST_FLAGS := ${COMMON_FLAGS} -std=c11 -O3 `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DBL=${BL} -D${TYPE} -DENERGY=${ENERGY} -DWITH_ALLOC_OVERHEAD=${WITH_ALLOC_OVERHEAD} -DWITH_LOAD_OVERHEAD=${WITH_LOAD_OVERHEAD} -DWITH_FREE_OVERHEAD=${WITH_FREE_OVERHEAD} -DWITH_DPUINFO=${WITH_DPUINFO} -DSDK_SINGLETHREADED=${SDK_SINGLETHREADED} DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} -DBL=${BL} -D${TYPE} QUIET = @ diff --git a/VA/host/app.c b/VA/host/app.c index cc8e180..70377e6 100644 --- a/VA/host/app.c +++ b/VA/host/app.c @@ -29,6 +29,17 @@ #include #endif +#if WITH_DPUINFO +#include +#include +#endif + +#if SDK_SINGLETHREADED +#define DPU_ALLOC_PROFILE "nrThreadsPerRank=0" +#else +#define DPU_ALLOC_PROFILE NULL +#endif + // Pointer declaration static T* A; static T* B; @@ -72,7 +83,7 @@ int main(int argc, char **argv) { // Allocate DPUs and load binary #if !WITH_ALLOC_OVERHEAD - DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set)); + DPU_ASSERT(dpu_alloc(NR_DPUS, DPU_ALLOC_PROFILE, &dpu_set)); timer.time[0] = 0; // alloc #endif #if !WITH_LOAD_OVERHEAD @@ -113,11 +124,21 @@ int main(int argc, char **argv) { if(rep >= p.n_warmup) { start(&timer, 0, 0); } - DPU_ASSERT(dpu_alloc(NR_DPUS, NULL, &dpu_set)); + DPU_ASSERT(dpu_alloc(NR_DPUS, DPU_ALLOC_PROFILE, &dpu_set)); if(rep >= p.n_warmup) { stop(&timer, 0); } #endif +#if WITH_DPUINFO + printf("DPUs:"); + DPU_FOREACH (dpu_set, dpu) { + int rank = dpu_get_rank_id(dpu_get_rank(dpu_from_set(dpu))) & DPU_TARGET_MASK; + int slice = dpu_get_slice_id(dpu_from_set(dpu)); + int member = dpu_get_member_id(dpu_from_set(dpu)); + printf(" %d(%d.%d)", rank, slice, member); + } + printf("\n"); +#endif #if WITH_LOAD_OVERHEAD if(rep >= p.n_warmup) { start(&timer, 1, 0); @@ -242,8 +263,8 @@ 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("[::] VA UPMEM | n_dpus=%d n_tasklets=%d e_type=%s block_size_B=%d n_elements=%d ", - nr_of_dpus, NR_TASKLETS, XSTR(T), BLOCK_SIZE, input_size); + printf("[::] VA UPMEM | n_dpus=%d n_ranks=%d n_tasklets=%d e_type=%s block_size_B=%d n_elements=%d b_sdk_singlethreaded=%d ", + nr_of_dpus, nr_of_ranks, NR_TASKLETS, XSTR(T), BLOCK_SIZE, input_size, SDK_SINGLETHREADED); printf("| latency_alloc_us=%f latency_load_us=%f latency_cpu_us=%f latency_write_us=%f latency_kernel_us=%f latency_read_us=%f latency_free_us=%f", timer.time[0], timer.time[1], @@ -264,7 +285,7 @@ int main(int argc, char **argv) { input_size / timer.time[2], input_size / (timer.time[4]), input_size / (timer.time[0] + timer.time[1] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6])); - printf(" throughput_upmem_wxr_MBps=%f throughput_upmem_lwxr_MBps=%f throughput_upmem_alwxr_MBps=%f\n", + printf(" throughput_upmem_wxr_MOpps=%f throughput_upmem_lwxr_MOpps=%f throughput_upmem_alwxr_MOpps=%f\n", input_size / (timer.time[3] + timer.time[4] + timer.time[5]), input_size / (timer.time[1] + timer.time[3] + timer.time[4] + timer.time[5]), input_size / (timer.time[0] + timer.time[1] + timer.time[3] + timer.time[4] + timer.time[5])); -- cgit v1.2.3