diff options
Diffstat (limited to 'TRNS')
-rw-r--r-- | TRNS/Makefile | 31 | ||||
-rw-r--r-- | TRNS/baselines/cpu/Makefile | 28 | ||||
-rw-r--r-- | TRNS/baselines/cpu/main.cpp | 16 | ||||
-rwxr-xr-x | TRNS/baselines/cpu/run-perf.sh | 6 | ||||
-rwxr-xr-x | TRNS/benchmark-scripts/ccmcc25-sim.sh | 53 | ||||
-rwxr-xr-x | TRNS/benchmark-scripts/ccmcc25.sh | 32 | ||||
-rwxr-xr-x | TRNS/dimes-hetsim-hbm.sh | 7 | ||||
-rwxr-xr-x | TRNS/dimes-hetsim-nmc.sh | 4 | ||||
-rw-r--r-- | TRNS/dpu/task.c | 2 | ||||
-rw-r--r-- | TRNS/host/app.c | 62 | ||||
-rw-r--r--[-rwxr-xr-x] | TRNS/include/common.h (renamed from TRNS/support/common.h) | 12 | ||||
-rw-r--r-- | TRNS/include/dfatool_host.ah | 36 | ||||
-rw-r--r-- | TRNS/include/params.h (renamed from TRNS/support/params.h) | 4 | ||||
-rw-r--r-- | TRNS/include/timer.h | 5 | ||||
-rwxr-xr-x | TRNS/run-fgbs24a.sh | 29 | ||||
-rwxr-xr-x | TRNS/run-paper-strong-full.sh | 30 | ||||
-rwxr-xr-x | TRNS/run-paper-strong-rank.sh | 29 | ||||
-rwxr-xr-x | TRNS/run-paper-weak.sh | 28 | ||||
-rwxr-xr-x | TRNS/run-rank.sh | 32 | ||||
-rwxr-xr-x | TRNS/run.sh | 32 | ||||
-rwxr-xr-x | TRNS/support/timer.h | 66 |
21 files changed, 242 insertions, 302 deletions
diff --git a/TRNS/Makefile b/TRNS/Makefile index fd3f493..302fcd6 100644 --- a/TRNS/Makefile +++ b/TRNS/Makefile @@ -1,18 +1,32 @@ NR_DPUS ?= 1 NR_TASKLETS ?= 16 ENERGY ?= 0 -WITH_ALLOC_OVERHEAD ?= 0 -WITH_LOAD_OVERHEAD ?= 0 -WITH_FREE_OVERHEAD ?= 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} -DENERGY=${ENERGY} -DWITH_ALLOC_OVERHEAD=${WITH_ALLOC_OVERHEAD} -DWITH_LOAD_OVERHEAD=${WITH_LOAD_OVERHEAD} -DWITH_FREE_OVERHEAD=${WITH_FREE_OVERHEAD} +aspectc ?= 0 +aspectc_timing ?= * +dfatool_timing ?= 1 + +HOST_CC := ${CC} + +COMMON_FLAGS := -Wall -Wextra -g -Iinclude +HOST_FLAGS := ${COMMON_FLAGS} -O3 -march=native `dpu-pkg-config --cflags --libs dpu` -DNR_TASKLETS=${NR_TASKLETS} -DNR_DPUS=${NR_DPUS} -DENERGY=${ENERGY} -DDFATOOL_TIMING=${dfatool_timing} -DASPECTC=${aspectc} DPU_FLAGS := ${COMMON_FLAGS} -O2 -DNR_TASKLETS=${NR_TASKLETS} +ifeq (${aspectc_timing}, 1) + ASPECTC_HOST_FLAGS += -ainclude/dfatool_host_dpu.ah -ainclude/dfatool_host.ah +endif + +ASPECTC_HOST_FLAGS ?= -a0 + +ifeq (${aspectc}, 1) + HOST_CC = ag++ -r repo.acp -v 0 ${ASPECTC_HOST_FLAGS} --c_compiler ${UPMEM_HOME}/bin/clang++ -p . --Xcompiler +else + HOST_FLAGS += -std=c11 +endif + QUIET = @ ifdef verbose @@ -24,8 +38,11 @@ all: bin/host_code bin/dpu_code bin: ${QUIET}mkdir -p bin +# cp/rm are needed to work around AspectC++ not liking symlinks bin/host_code: ${HOST_SOURCES} ${COMMON_INCLUDES} bin - ${QUIET}${CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS} + ${QUIET}cp ../include/dfatool_host_dpu.ah include + ${QUIET}${HOST_CC} -o $@ ${HOST_SOURCES} ${HOST_FLAGS} + ${QUIET}rm -f include/dfatool_host_dpu.ah bin/dpu_code: ${DPU_SOURCES} ${COMMON_INCLUDES} bin ${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} -o $@ ${DPU_SOURCES} diff --git a/TRNS/baselines/cpu/Makefile b/TRNS/baselines/cpu/Makefile index 236f7bb..2f28738 100644 --- a/TRNS/baselines/cpu/Makefile +++ b/TRNS/baselines/cpu/Makefile @@ -32,16 +32,30 @@ # THE SOFTWARE. # -NUMA ?= 0 -NUMA_MEMCPY ?= 0 -FLAGS = +benchmark ?= 1 +debug ?= 0 +native ?= 1 +nop_sync ?= 0 +numa ?= 0 +numa_memcpy ?= 0 -ifeq (${NUMA}, 1) - FLAGS += -lnuma +CFLAGS = +LDFLAGS = + +ifeq (${debug}, 1) + CFLAGS += -g +endif + +ifeq (${native}, 1) + CFLAGS += -march=native +endif + +ifeq (${numa}, 1) + LDFLAGS += -lnuma endif CXX=g++ -CXX_FLAGS=-std=c++11 -Wall -Wextra -pedantic -DNUMA=${NUMA} -DNUMA_MEMCPY=${NUMA_MEMCPY} +CXX_FLAGS=-std=c++11 -Wall -Wextra -pedantic -DNUMA=${numa} -DNUMA_MEMCPY=${numa_memcpy} -DNOP_SYNC=${nop_sync} -DWITH_BENCHMARK=${benchmark} LIB=-L/usr/lib/ -lm -pthread @@ -52,7 +66,7 @@ EXE=trns all: trns trns: ${SRC} - $(CXX) -O2 $(CXX_FLAGS) $(SRC) $(LIB) -o $(EXE) $(FLAGS) + $(CXX) -O3 $(CXX_FLAGS) ${CFLAGS} $(SRC) $(LIB) -o $(EXE) ${LDFLAGS} trns_O0: ${SRC} $(CXX) $(CXX_FLAGS) $(SRC) $(LIB) -o $(EXE)_O0 diff --git a/TRNS/baselines/cpu/main.cpp b/TRNS/baselines/cpu/main.cpp index c8cccaf..b4cd149 100644 --- a/TRNS/baselines/cpu/main.cpp +++ b/TRNS/baselines/cpu/main.cpp @@ -36,9 +36,18 @@ #include "support/setup.h" #include "kernel.h" #include "support/common.h" -#include "support/timer.h" #include "support/verify.h" +#if WITH_BENCHMARK +#include "support/timer.h" +#else +#include <string> +struct Timer { + inline void start(std::string name) {(void)name;} + inline void stop(std::string name) {(void)name;} +}; +#endif + #include <unistd.h> #include <thread> #include <string.h> @@ -362,6 +371,7 @@ int main(int argc, char **argv) { timer.stop("free"); #endif +#if WITH_BENCHMARK if (rep >= p.n_warmup) { #if NUMA_MEMCPY printf("[::] TRNS-CPU-MEMCPY | n_threads=%d e_type=%s n_elements=%d" @@ -396,10 +406,8 @@ int main(int argc, char **argv) { timer.get("Step 1") + timer.get("Step 2") + timer.get("Step 3")); #endif // NUMA_MEMCPY } +#endif // WITH_BENCHMARK } - //timer.print("Step 1", p.n_reps); - //timer.print("Step 2", p.n_reps); - //timer.print("Step 3", p.n_reps); // Verify answer //verify(h_local, h_in_backup, M_ * m, N_ * n, 1); diff --git a/TRNS/baselines/cpu/run-perf.sh b/TRNS/baselines/cpu/run-perf.sh new file mode 100755 index 0000000..f16a3b1 --- /dev/null +++ b/TRNS/baselines/cpu/run-perf.sh @@ -0,0 +1,6 @@ +#!/bin/zsh + +make -B numa=1 + +perf stat record -o t1.perf -e ${(j:,:):-$(grep -v '^#' ../../../perf-events.txt | cut -d ' ' -f 1)} ./trns -w 0 -r 20 -p 2048 -o 2048 -m 16 -n 8 -t 1 -a 4 -c 4 +perf stat record -o t4.perf -e ${(j:,:):-$(grep -v '^#' ../../../perf-events.txt | cut -d ' ' -f 1)} ./trns -w 0 -r 20 -p 2048 -o 2048 -m 16 -n 8 -t 4 -a 4 -c 4 diff --git a/TRNS/benchmark-scripts/ccmcc25-sim.sh b/TRNS/benchmark-scripts/ccmcc25-sim.sh new file mode 100755 index 0000000..a7aa79c --- /dev/null +++ b/TRNS/benchmark-scripts/ccmcc25-sim.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +mkdir -p log/$(hostname) + +# Args: -m m -n n -o M_ -p N_ +# +# Input: (M_ * m) × (N_ * n) matrix +# Output: (N_* n) × (M_ * m) matrix +# Step 1: transpose (M_ * m) × N_ matrix that consists of tiles of size n +# CPU version: explicit +# DPU version: implicit (M_ * m write operations of #DPUs * n elements to DPUs) +# Step 2: transpose m × n matrix; this happens N_ * M_ times. +# DPU version: Each tasklet transposes a single m × n matrix / tile. +# (16 × 8 tile takes up 1 KiB WRAM) +# Step 3: Transpose M_ × n matrix that consists of tiles of size m. +# +# Note for DPU version: if M_ > #DPUs, steps 1 through 3 are repeated. +# Number of repetitions == ceil(M_ / #DPUS) +# For Hetsim benchmarks, we set M_ == #DPUs to simplify the task graph (no repetitions that depend on the number of available DPUs). +# Just in case, there is also a configuration with M_ == 2048 independent of #DPUs +# +# input size: uint64(DPU)/double(CPU) * M_ * m * N_ * n +# output size: uint64(DPU)/double(CPU) * M_ * m * N_ * n -- on DPU only; CPU version operates in-place +# Upstream DPU version uses int64_t, -p 2048 -o 12288 -x 1 [implicit -m 16 -n 8] +# Upstream CPU version uses double, -p 2556 -o 4096 -m 16 -n 8 and fails with -o 12288 (allocation error) +# +# -p 2048 -o 2048 -m 16 -n 8 -> matrix size: 4 GiB +# -p [64 .. 2304] -o 2048 -m 16 -n 8 -> matrix size: 128 MiB .. 4.5 GiB + +run_benchmark_nmc() { + local "$@" + set -e + make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} \ + aspectc=1 aspectc_timing=1 dfatool_timing=0 + bin/host_code -w 0 -e 2 -p ${cols} -o ${rows} -m ${tile_rows} -n ${tile_cols} +} + +export -f run_benchmark_nmc + +fn=log/$(hostname)/ccmcc25-sdk${sdk}-sim + +source ~/lib/local/upmem/upmem-2025.1.0-Linux-x86_64/upmem_env.sh simulator + +echo "prim-benchmarks TRNS $(git describe --all --long) $(git rev-parse HEAD) $(date -R)" >> ${fn}.txt + +parallel -j1 --eta --joblog ${fn}.joblog --resume --header : \ + run_benchmark_nmc nr_dpus={nr_dpus} nr_tasklets=16 cols={cols} rows={rows} tile_cols={tile_cols} tile_rows={tile_rows} \ + ::: nr_dpus 1 4 16 32 64 \ + ::: rows 64 128 256 512 \ + ::: cols 64 128 256 512 \ + ::: tile_rows 16 \ + ::: tile_cols 8 \ +>> ${fn}.txt diff --git a/TRNS/benchmark-scripts/ccmcc25.sh b/TRNS/benchmark-scripts/ccmcc25.sh new file mode 100755 index 0000000..7c66306 --- /dev/null +++ b/TRNS/benchmark-scripts/ccmcc25.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +mkdir -p log/$(hostname) + +run_benchmark_nmc() { + local "$@" + set -e + sudo limit_ranks_to_numa_node ${numa_rank} + make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets} dfatool_timing=0 aspectc=1 aspectc_timing=1 + bin/host_code -w 0 -e 4 -p ${cols} -o ${rows} -m ${tile_rows} -n ${tile_cols} +} + +export -f run_benchmark_nmc + +for sdk in 2023.2.0 2024.1.0 2024.2.0 2025.1.0; do + + fn=log/$(hostname)/ccmcc25-sdk${sdk} + + source /opt/upmem/upmem-${sdk}-Linux-x86_64/upmem_env.sh + + echo "prim-benchmarks TRNS $(git describe --all --long) $(git rev-parse HEAD) $(date -R)" >> ${fn}.txt + + parallel -j1 --eta --joblog ${fn}.joblog --resume --header : \ + run_benchmark_nmc nr_dpus={nr_dpus} nr_tasklets=16 numa_rank=any cols={cols} rows={rows} tile_cols={tile_cols} tile_rows={tile_rows} \ + ::: nr_dpus 64 128 256 512 768 1024 1536 2048 2304 \ + ::: rows 1024 2048 4096 \ + ::: cols 64 128 256 512 768 1024 1536 2048 2304 \ + ::: tile_rows 16 \ + ::: tile_cols 8 \ + >> ${fn}.txt + +done diff --git a/TRNS/dimes-hetsim-hbm.sh b/TRNS/dimes-hetsim-hbm.sh index e2efaee..cc5dc68 100755 --- a/TRNS/dimes-hetsim-hbm.sh +++ b/TRNS/dimes-hetsim-hbm.sh @@ -32,7 +32,7 @@ fn=log/$(hostname)/dimes-hetsim-hbm ( -make -B NUMA=1 NUMA_MEMCPY=1 +make -B numa=1 numa_memcpy=1 echo "CPU single-node operation with setup cost, memcpy node == input node, cpu node == output node (1/3)" >&2 @@ -43,10 +43,9 @@ parallel -j1 --eta --joblog ${fn}.1.joblog --resume --header : \ ::: ram_in $(seq 0 15) \ :::+ cpu_memcpy $(seq 0 7) $(seq 0 7) \ ::: ram_local $(seq 0 15) \ - :::+ cpu $(seq 0 7) $(seq 0 7) \ - ::: input_size 167772160 + :::+ cpu $(seq 0 7) $(seq 0 7) -make -B NUMA=1 +make -B numa=1 echo "CPU single-node operation (2/3)" >&2 diff --git a/TRNS/dimes-hetsim-nmc.sh b/TRNS/dimes-hetsim-nmc.sh index b5f6f13..80987e7 100755 --- a/TRNS/dimes-hetsim-nmc.sh +++ b/TRNS/dimes-hetsim-nmc.sh @@ -73,7 +73,7 @@ parallel -j1 --eta --joblog ${fn}.4.joblog --resume --header : \ ) >> ${fn}.txt cd baselines/cpu -make -B NUMA=1 +make -B numa=1 ( @@ -97,7 +97,7 @@ parallel -j1 --eta --joblog ${fn}.2.joblog --resume --header : \ ) >> ${fn}.txt -make -B NUMA=1 NUMA_MEMCPY=1 +make -B numa=1 numa_memcpy=1 ( diff --git a/TRNS/dpu/task.c b/TRNS/dpu/task.c index 0f5e4be..9c0e0a8 100644 --- a/TRNS/dpu/task.c +++ b/TRNS/dpu/task.c @@ -12,7 +12,7 @@ #include <mutex.h> #include <barrier.h> -#include "../support/common.h" +#include "common.h" __host dpu_arguments_t DPU_INPUT_ARGUMENTS; diff --git a/TRNS/host/app.c b/TRNS/host/app.c index 452b894..c178a19 100644 --- a/TRNS/host/app.c +++ b/TRNS/host/app.c @@ -7,16 +7,32 @@ #include <stdlib.h> #include <stdbool.h> #include <string.h> + +#if ASPECTC +extern "C" { +#endif + #include <dpu.h> #include <dpu_log.h> +#include <dpu_management.h> +#include <dpu_target_macros.h> + +#if ENERGY +#include <dpu_probe.h> +#endif + +#if ASPECTC +} +#endif + #include <unistd.h> #include <getopt.h> #include <assert.h> #include <math.h> -#include "../support/common.h" -#include "../support/timer.h" -#include "../support/params.h" +#include "common.h" +#include "timer.h" +#include "params.h" #define XSTR(x) STR(x) #define STR(x) #x @@ -26,18 +42,13 @@ #define DPU_BINARY "./bin/dpu_code" #endif -#if ENERGY -#include <dpu_probe.h> -#endif - -#include <dpu_management.h> -#include <dpu_target_macros.h> - // Pointer declaration static T* A_host; static T* A_backup; static T* A_result; +unsigned int kernel = 0; + // Create input arrays static void read_input(T* A, unsigned int nr_elements) { srand(0); @@ -84,10 +95,10 @@ int main(int argc, char **argv) { N_ = p.exp == 0 ? N_ * NR_DPUS : N_; // Input/output allocation - A_host = malloc(M_ * m * N_ * n * sizeof(T)); - A_backup = malloc(M_ * m * N_ * n * sizeof(T)); - A_result = malloc(M_ * m * N_ * n * sizeof(T)); - T* done_host = malloc(M_ * n); // Host array to reset done array of step 3 + A_host = (T*)malloc(M_ * m * N_ * n * sizeof(T)); + A_backup = (T*)malloc(M_ * m * N_ * n * sizeof(T)); + A_result = (T*)malloc(M_ * m * N_ * n * sizeof(T)); + T* done_host = (T*)malloc(M_ * n); // Host array to reset done array of step 3 memset(done_host, 0, M_ * n); // Create an input file with arbitrary data @@ -131,6 +142,7 @@ int main(int argc, char **argv) { DPU_ASSERT(dpu_load(dpu_set, DPU_BINARY, NULL)); stop(&timer, 2); DPU_ASSERT(dpu_get_nr_dpus(dpu_set, &nr_of_dpus)); + DPU_ASSERT(dpu_get_nr_ranks(dpu_set, &nr_of_ranks)); } else if (first_round){ start(&timer, 1, 0); DPU_ASSERT(dpu_alloc(active_dpus, NULL, &dpu_set)); @@ -174,8 +186,8 @@ int main(int argc, char **argv) { start(&timer, 5, !first_round); } - unsigned int kernel = 0; - dpu_arguments_t input_arguments = {m, n, M_, kernel}; + kernel = 0; + dpu_arguments_t input_arguments = {m, n, M_, (enum kernels)kernel}; // transfer control instructions to DPUs (run first program part) DPU_FOREACH(dpu_set, dpu, i) { DPU_ASSERT(dpu_prepare_xfer(dpu, &input_arguments)); @@ -215,7 +227,7 @@ int main(int argc, char **argv) { start(&timer, 7, !first_round); } kernel = 1; - dpu_arguments_t input_arguments2 = {m, n, M_, kernel}; + dpu_arguments_t input_arguments2 = {m, n, M_, (enum kernels)kernel}; DPU_FOREACH(dpu_set, dpu, i) { DPU_ASSERT(dpu_prepare_xfer(dpu, &input_arguments2)); } @@ -299,7 +311,9 @@ int main(int argc, char **argv) { } if (status) { printf("[" ANSI_COLOR_GREEN "OK" ANSI_COLOR_RESET "] Outputs are equal\n"); +#if DFATOOL_TIMING unsigned long input_size = M_ * m * N_ * n; +#endif if (rep >= p.n_warmup) { /* * timer 0: CPU version @@ -313,35 +327,35 @@ int main(int argc, char **argv) { * timer 8: run DPU program (second kernel) * timer 9: read transposed matrix */ - printf("[::] TRNS-UPMEM | n_dpus=%d n_ranks=%d n_tasklets=%d e_type=%s n_elements=%lu numa_node_rank=%d ", + dfatool_printf("[::] TRNS-UPMEM | n_dpus=%d n_ranks=%d n_tasklets=%d e_type=%s n_elements=%lu numa_node_rank=%d ", NR_DPUS, nr_of_ranks, NR_TASKLETS, XSTR(T), input_size, numa_node_rank); - printf("| latency_cpu_us=%f latency_realloc_us=%f latency_load_us=%f latency_write_us=%f latency_kernel_us=%f latency_read_us=%f", + dfatool_printf("| latency_cpu_us=%f latency_realloc_us=%f latency_load_us=%f latency_write_us=%f latency_kernel_us=%f latency_read_us=%f", timer.time[0], // CPU timer.time[1], // free + alloc timer.time[2], // load timer.time[3] + timer.time[4] + timer.time[5] + timer.time[7], // write timer.time[6] + timer.time[8], // kernel timer.time[9]); // read - printf(" latency_write1_us=%f latency_write2_us=%f latency_write3_us=%f latency_write4_us=%f latency_kernel1_us=%f latency_kernel2_us=%f", + dfatool_printf(" latency_write1_us=%f latency_write2_us=%f latency_write3_us=%f latency_write4_us=%f latency_kernel1_us=%f latency_kernel2_us=%f", timer.time[3], timer.time[4], timer.time[5], timer.time[7], timer.time[6], timer.time[8]); - printf(" throughput_cpu_MBps=%f throughput_upmem_kernel_MBps=%f throughput_upmem_total_MBps=%f", + dfatool_printf(" throughput_cpu_MBps=%f throughput_upmem_kernel_MBps=%f throughput_upmem_total_MBps=%f", input_size * sizeof(T) / timer.time[0], input_size * sizeof(T) / (timer.time[6] + timer.time[8]), input_size * sizeof(T) / (timer.time[1] + timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9])); - printf(" throughput_upmem_wxr_MBps=%f throughput_upmem_lwxr_MBps=%f throughput_upmem_alwxr_MBps=%f", + dfatool_printf(" throughput_upmem_wxr_MBps=%f throughput_upmem_lwxr_MBps=%f throughput_upmem_alwxr_MBps=%f", input_size * sizeof(T) / (timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9]), input_size * sizeof(T) / (timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9]), input_size * sizeof(T) / (timer.time[1] + timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9])); - printf(" throughput_cpu_MOpps=%f throughput_upmem_kernel_MOpps=%f throughput_upmem_total_MOpps=%f", + dfatool_printf(" throughput_cpu_MOpps=%f throughput_upmem_kernel_MOpps=%f throughput_upmem_total_MOpps=%f", input_size / timer.time[0], input_size / (timer.time[6] + timer.time[8]), input_size / (timer.time[1] + timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9])); - printf(" throughput_upmem_wxr_MOpps=%f throughput_upmem_lwxr_MOpps=%f throughput_upmem_alwxr_MOpps=%f\n", + dfatool_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] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9]), input_size / (timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9]), input_size / (timer.time[1] + timer.time[2] + timer.time[3] + timer.time[4] + timer.time[5] + timer.time[6] + timer.time[7] + timer.time[8] + timer.time[9])); diff --git a/TRNS/support/common.h b/TRNS/include/common.h index 2ba56c5..6a94c62 100755..100644 --- a/TRNS/support/common.h +++ b/TRNS/include/common.h @@ -14,16 +14,18 @@ // Data type #define T int64_t +enum kernels { + kernel1 = 0, + kernel2 = 1, + nr_kernels = 2, +}; + // Structures used by both the host and the dpu to communicate information typedef struct { uint32_t m; uint32_t n; uint32_t M_; - enum kernels { - kernel1 = 0, - kernel2 = 1, - nr_kernels = 2, - } kernel; + enum kernels kernel; } dpu_arguments_t; #ifndef ENERGY diff --git a/TRNS/include/dfatool_host.ah b/TRNS/include/dfatool_host.ah new file mode 100644 index 0000000..72978cc --- /dev/null +++ b/TRNS/include/dfatool_host.ah @@ -0,0 +1,36 @@ +#pragma once + +#include <sys/time.h> +#include "dfatool_host_dpu.ah" + +aspect DfatoolHostTiming : public DfatoolHostDPUTiming { + + unsigned int n_rows_outer, n_rows_tile, n_cols_outer, n_cols_tile; + unsigned int element_size; + + virtual int getKernel() { return kernel; } + + DfatoolHostTiming() { + element_size = sizeof(T); + } + + advice call("% input_params(...)") : after() { + Params* p = tjp->result(); + /* + * Input: (M_ * m) × (N_ * n) matrix + */ + n_rows_outer = p->M_; + n_rows_tile = p->m; + n_cols_outer = p->N_; + n_cols_tile = p->n; + printf("[>>] TRNS | n_dpus=%u n_rows_outer=%u n_rows_tile=%u n_cols_outer=%u n_cols_tile=%u\n", NR_DPUS, n_rows_outer, n_rows_tile, n_cols_outer, n_cols_tile); + } + + advice call("% trns_host(...)") : after() { + printf("[--] TRNS | n_dpus=%u n_rows_outer=%u n_rows_tile=%u n_cols_outer=%u n_cols_tile=%u\n", NR_DPUS, n_rows_outer, n_rows_tile, n_cols_outer, n_cols_tile); + } + + advice execution("% main(...)") : after() { + printf("[<<] TRNS | n_dpus=%u n_rows_outer=%u n_rows_tile=%u n_cols_outer=%u n_cols_tile=%u\n", NR_DPUS, n_rows_outer, n_rows_tile, n_cols_outer, n_cols_tile); + } +}; diff --git a/TRNS/support/params.h b/TRNS/include/params.h index 6b7e6f2..385490e 100644 --- a/TRNS/support/params.h +++ b/TRNS/include/params.h @@ -21,7 +21,7 @@ static void usage() { "\n -h help" "\n -w <W> # of untimed warmup iterations (default=1)" "\n -e <E> # of timed repetition iterations (default=3)" - "\n -x <X> Weak (0) or strong (1) scaling (default=0)" + "\n -x <X> Weak (0) or strong (1) scaling (default=1)" "\n" "\nBenchmark-specific options:" "\n -m <I> m (default=16 elements)" @@ -39,7 +39,7 @@ struct Params input_params(int argc, char **argv) { p.n = 8; p.n_warmup = 1; p.n_reps = 3; - p.exp = 0; + p.exp = 1; int opt; while((opt = getopt(argc, argv, "hw:e:x:m:n:o:p:")) >= 0) { diff --git a/TRNS/include/timer.h b/TRNS/include/timer.h new file mode 100644 index 0000000..8d5c3d5 --- /dev/null +++ b/TRNS/include/timer.h @@ -0,0 +1,5 @@ +#pragma once + +#define N_TIMERS 10 +#include "../../include/timer_base.h" +#undef N_TIMERS diff --git a/TRNS/run-fgbs24a.sh b/TRNS/run-fgbs24a.sh deleted file mode 100755 index 6ba8993..0000000 --- a/TRNS/run-fgbs24a.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e - -mkdir -p $(hostname) - -# 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 -# -i; ignored, always uses 262144 elements - -( - -echo "prim-benchmarks TRNS strong-full (dfatool fgbs24a edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -for nr_dpus in 2304 2048 2543; do - for nr_tasklets in 16; do - echo - if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets}; then - # upstream uses -p 2048, but then the number of DPUs is always constant... - timeout --foreground -k 1m 180m bin/host_code -w 0 -e 100 -p $nr_dpus -o 12288 -x 1 || true - fi - done -done -echo "Completed at $(date)" -) | tee "$(hostname)/fgbs24a.txt" diff --git a/TRNS/run-paper-strong-full.sh b/TRNS/run-paper-strong-full.sh deleted file mode 100755 index 9d3792c..0000000 --- a/TRNS/run-paper-strong-full.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 -# -i; ignored, always uses 262144 elements - -( - -echo "prim-benchmarks TRNS strong-full (dfatool edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -# >2048 is not in 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}; then - # upstream uses -p 2048, but then the number of DPUs is always constant... - timeout --foreground -k 1m 90m bin/host_code -w 0 -e 40 -p $nr_dpus -o 12288 -x 1 || true - fi - done -done - -echo "Completed at $(date)" - -) | tee "log-$(hostname)-prim-strong-full.txt" diff --git a/TRNS/run-paper-strong-rank.sh b/TRNS/run-paper-strong-rank.sh deleted file mode 100755 index f5f00cb..0000000 --- a/TRNS/run-paper-strong-rank.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 -# -i; ignored, always uses 262144 elements - -( - -echo "prim-benchmarks TRNS strong-rank (dfatool edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -for nr_dpus in 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}; then - # upstream uses -p 64, but then the number of DPUs is always constant... - timeout --foreground -k 1m 60m bin/host_code -w 0 -e 40 -p $nr_dpus -o 12288 -x 1 || true - fi - done -done - -echo "Completed at $(date)" - -) | tee "log-$(hostname)-prim-strong-rank.txt" diff --git a/TRNS/run-paper-weak.sh b/TRNS/run-paper-weak.sh deleted file mode 100755 index f02d7d6..0000000 --- a/TRNS/run-paper-weak.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 -# -i; ignored, always uses 262144 elements - -( - -echo "prim-benchmarks TRNS weak (dfatool edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -for nr_dpus in 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}; then - timeout --foreground -k 1m 60m bin/host_code -w 0 -e 40 -p 1 -o 12288 -x 0 || true - fi - done -done | tee log-paper-weak.txt - -echo "Completed at $(date)" - -) | tee "log-$(hostname)-prim-weak.txt" diff --git a/TRNS/run-rank.sh b/TRNS/run-rank.sh deleted file mode 100755 index 00f6898..0000000 --- a/TRNS/run-rank.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 -# -i: input size (number of elements, not number of bytes!) - -( - -echo "prim-benchmarks TRNS (dfatool edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -for nr_dpus in 1 4 8 16 32 48 64; do - for nr_tasklets in 8 12 16; do - # 12288 run-paper-weak, run-paper-strong-full - for i in 12288; do - echo - if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets}; then - # upstream uses -p 2048 in strong-full, but then the number of DPUs is always constant... - timeout --foreground -k 1m 90m bin/host_code -w 0 -e 40 -p 1 -o 12288 -x 0 || true - fi - done - done -done - -echo "Completed at $(date)" - -) | tee "log-$(hostname)-rank.txt" diff --git a/TRNS/run.sh b/TRNS/run.sh deleted file mode 100755 index 8d574a9..0000000 --- a/TRNS/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 -# -i: input size (number of elements, not number of bytes!) - -( - -echo "prim-benchmarks TRNS (dfatool edition)" -echo "Started at $(date)" -echo "Revision $(git describe --always)" - -for nr_dpus in 2542 2304 1 4 8 16 32 64 128 256 512 768 1024 1536 2048; do - for nr_tasklets in 8 12 16; do - # 12288 run-paper-weak, run-paper-strong-full - for i in 12288; do - echo - if make -B NR_DPUS=${nr_dpus} NR_TASKLETS=${nr_tasklets}; then - # upstream uses -p 2048 in strong-full, but then the number of DPUs is always constant... - timeout --foreground -k 1m 90m bin/host_code -w 0 -e 40 -p $nr_dpus -o 12288 -x 1 || true - fi - done - done -done - -echo "Completed at $(date)" - -) | tee "log-$(hostname).txt" diff --git a/TRNS/support/timer.h b/TRNS/support/timer.h deleted file mode 100755 index 786c687..0000000 --- a/TRNS/support/timer.h +++ /dev/null @@ -1,66 +0,0 @@ -/*
- * Copyright (c) 2016 University of Cordoba and University of Illinois
- * All rights reserved.
- *
- * Developed by: IMPACT Research Group
- * University of Cordoba and University of Illinois
- * http://impact.crhc.illinois.edu/
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * > Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimers.
- * > Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimers in the
- * documentation and/or other materials provided with the distribution.
- * > Neither the names of IMPACT Research Group, University of Cordoba,
- * University of Illinois nor the names of its contributors may be used
- * to endorse or promote products derived from this Software without
- * specific prior written permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
- * THE SOFTWARE.
- *
- */
-
-#include <sys/time.h>
-
-typedef struct Timer{
-
- struct timeval startTime[10];
- struct timeval stopTime[10];
- double time[10];
-
-}Timer;
-
-void start(Timer *timer, int i, int rep) {
- if(rep == 0) {
- timer->time[i] = 0.0;
- }
- gettimeofday(&timer->startTime[i], NULL);
-}
-
-void stop(Timer *timer, int i) {
- gettimeofday(&timer->stopTime[i], NULL);
- timer->time[i] += (timer->stopTime[i].tv_sec - timer->startTime[i].tv_sec) * 1000000.0 +
- (timer->stopTime[i].tv_usec - timer->startTime[i].tv_usec);
-}
-
-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");
-}
|