From d41ec55b9847d16f32ca47155f2cd7e4ea72386a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 25 May 2023 12:47:50 +0200 Subject: re-add (and, in some cases, fix) -x support --- Microbenchmarks/STREAM/host/app.c | 2 +- Microbenchmarks/STREAM/support/params.h | 5 ++++- RED/baselines/cpu/app_baseline.cpp | 8 ++++++-- SCAN-RSS/baselines/cpu/app_baseline.cpp | 8 ++++++-- SCAN-RSS/support/params.h | 3 +++ SCAN-SSA/Makefile | 4 ++-- SCAN-SSA/host/app.c | 2 +- SCAN-SSA/support/params.h | 6 +++++- VA/host/app.c | 2 +- VA/support/params.h | 6 +++++- 10 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Microbenchmarks/STREAM/host/app.c b/Microbenchmarks/STREAM/host/app.c index e99d631..c75d71b 100644 --- a/Microbenchmarks/STREAM/host/app.c +++ b/Microbenchmarks/STREAM/host/app.c @@ -102,7 +102,7 @@ int main(int argc, char **argv) { unsigned int i = 0; double cc = 0; double cc_min = 0; - const unsigned int input_size = p.input_size * nr_of_dpus; + const unsigned int input_size = p.exp == 0 ? p.input_size * nr_of_dpus : p.input_size; #if defined(add) || defined(triad) const unsigned int n_arrays = 3; diff --git a/Microbenchmarks/STREAM/support/params.h b/Microbenchmarks/STREAM/support/params.h index d28ba65..ad47c39 100644 --- a/Microbenchmarks/STREAM/support/params.h +++ b/Microbenchmarks/STREAM/support/params.h @@ -7,6 +7,7 @@ typedef struct Params { unsigned int input_size; int n_warmup; int n_reps; + int exp; }Params; static void usage() { @@ -29,9 +30,10 @@ struct Params input_params(int argc, char **argv) { p.input_size = 8 << 10; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; int opt; - while((opt = getopt(argc, argv, "hi:w:e:")) >= 0) { + while((opt = getopt(argc, argv, "hi:w:e:x:")) >= 0) { switch(opt) { case 'h': usage(); @@ -40,6 +42,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); usage(); diff --git a/RED/baselines/cpu/app_baseline.cpp b/RED/baselines/cpu/app_baseline.cpp index 11c1cd8..db4b060 100644 --- a/RED/baselines/cpu/app_baseline.cpp +++ b/RED/baselines/cpu/app_baseline.cpp @@ -75,6 +75,7 @@ typedef struct Params { unsigned int input_size; int n_warmup; int n_reps; + int exp; int n_threads; }Params; @@ -86,6 +87,7 @@ void usage() { "\n -h help" "\n -w # of untimed warmup iterations (default=1)" "\n -e # of timed repetition iterations (default=3)" + "\n -x Weak (0) or strong (1) scaling (default=0)" "\n -t # of threads (default=8)" "\n" "\nBenchmark-specific options:" @@ -98,10 +100,11 @@ struct Params input_params(int argc, char **argv) { p.input_size = 2 << 20; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; p.n_threads = 1; int opt; - while((opt = getopt(argc, argv, "hi:w:e:t:")) >= 0) { + while((opt = getopt(argc, argv, "hi:w:e:x:t:")) >= 0) { switch(opt) { case 'h': usage(); @@ -110,6 +113,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; case 't': p.n_threads = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); @@ -132,7 +136,7 @@ int main(int argc, char **argv) { unsigned int nr_of_dpus = 1; unsigned int i = 0; - const unsigned int input_size = p.input_size; + const unsigned int input_size = p.exp == 0 ? p.input_size * p.n_threads : p.input_size; assert(input_size % (p.n_threads) == 0 && "Input size!"); // Input/output allocation diff --git a/SCAN-RSS/baselines/cpu/app_baseline.cpp b/SCAN-RSS/baselines/cpu/app_baseline.cpp index 5fb619e..ba9b31f 100644 --- a/SCAN-RSS/baselines/cpu/app_baseline.cpp +++ b/SCAN-RSS/baselines/cpu/app_baseline.cpp @@ -75,6 +75,7 @@ typedef struct Params { int n_warmup; int n_reps; int n_threads; + int exp; }Params; void usage() { @@ -85,6 +86,7 @@ void usage() { "\n -h help" "\n -w # of untimed warmup iterations (default=1)" "\n -e # of timed repetition iterations (default=3)" + "\n -x Weak (0) or strong (1) scaling (default=0)" "\n -t # of threads (default=8)" "\n" "\nBenchmark-specific options:" @@ -97,10 +99,11 @@ struct Params input_params(int argc, char **argv) { p.input_size = 2 << 20; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; p.n_threads = 8; int opt; - while((opt = getopt(argc, argv, "hi:w:e:t:")) >= 0) { + while((opt = getopt(argc, argv, "hi:w:e:x:t:")) >= 0) { switch(opt) { case 'h': usage(); @@ -109,6 +112,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; case 't': p.n_threads = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); @@ -131,7 +135,7 @@ int main(int argc, char **argv) { unsigned int nr_of_dpus = 1; unsigned int i = 0; - const unsigned int input_size = p.input_size; + const unsigned int input_size = p.exp == 0 ? p.input_size * p.n_threads : p.input_size; assert(input_size % (p.n_threads) == 0 && "Input size!"); // Input/output allocation diff --git a/SCAN-RSS/support/params.h b/SCAN-RSS/support/params.h index ebf3301..9f6aacc 100644 --- a/SCAN-RSS/support/params.h +++ b/SCAN-RSS/support/params.h @@ -7,6 +7,7 @@ typedef struct Params { unsigned int input_size; int n_warmup; int n_reps; + int exp; }Params; static void usage() { @@ -29,6 +30,7 @@ struct Params input_params(int argc, char **argv) { p.input_size = 3932160; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; int opt; while((opt = getopt(argc, argv, "hi:w:e:x:")) >= 0) { @@ -40,6 +42,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); usage(); diff --git a/SCAN-SSA/Makefile b/SCAN-SSA/Makefile index 1ac9ecc..319f2da 100644 --- a/SCAN-SSA/Makefile +++ b/SCAN-SSA/Makefile @@ -25,10 +25,10 @@ all: bin/dpu_code bin/host_code bin: ${QUIET}mkdir -p bin -bin/dpu_code: ${DPU_SOURCES} +bin/dpu_code: ${DPU_SOURCES} bin ${QUIET}dpu-upmem-dpurte-clang ${DPU_FLAGS} ${DPU_SOURCES} -o $@ -bin/host_code: ${HOST_SOURCES} +bin/host_code: ${HOST_SOURCES} bin ${QUIET}${CC} ${HOST_FLAGS} ${HOST_SOURCES} -o $@ bin/omp_code: ${OMP_SOURCES} diff --git a/SCAN-SSA/host/app.c b/SCAN-SSA/host/app.c index 8354245..ba6b5e9 100644 --- a/SCAN-SSA/host/app.c +++ b/SCAN-SSA/host/app.c @@ -89,7 +89,7 @@ int main(int argc, char **argv) { unsigned int i = 0; T accum = 0; - const unsigned int input_size = p.input_size * nr_of_dpus; // Total input size (weak or strong scaling) + const unsigned int input_size = p.exp == 0 ? p.input_size * nr_of_dpus : p.input_size; // Total input size (weak or strong scaling) const unsigned int input_size_dpu_ = divceil(input_size, nr_of_dpus); // Input size per DPU (max.) const unsigned int input_size_dpu_round = (input_size_dpu_ % (NR_TASKLETS * REGS) != 0) ? roundup(input_size_dpu_, (NR_TASKLETS * REGS)) : input_size_dpu_; // Input size per DPU (max.), 8-byte aligned diff --git a/SCAN-SSA/support/params.h b/SCAN-SSA/support/params.h index 8d51c98..9f6aacc 100644 --- a/SCAN-SSA/support/params.h +++ b/SCAN-SSA/support/params.h @@ -7,6 +7,7 @@ typedef struct Params { unsigned int input_size; int n_warmup; int n_reps; + int exp; }Params; static void usage() { @@ -17,6 +18,7 @@ static void usage() { "\n -h help" "\n -w # of untimed warmup iterations (default=1)" "\n -e # of timed repetition iterations (default=3)" + "\n -x Weak (0) or strong (1) scaling (default=0)" "\n" "\nBenchmark-specific options:" "\n -i input size (default=3932160 elements)" @@ -28,9 +30,10 @@ struct Params input_params(int argc, char **argv) { p.input_size = 3932160; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; int opt; - while((opt = getopt(argc, argv, "hi:w:e:")) >= 0) { + while((opt = getopt(argc, argv, "hi:w:e:x:")) >= 0) { switch(opt) { case 'h': usage(); @@ -39,6 +42,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); usage(); diff --git a/VA/host/app.c b/VA/host/app.c index 8fe9e1c..bfa6806 100644 --- a/VA/host/app.c +++ b/VA/host/app.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) { printf("Allocated %d DPU(s)\n", nr_of_dpus); unsigned int i = 0; - const unsigned int input_size = p.input_size; + const unsigned int input_size = p.exp == 0 ? p.input_size * nr_of_dpus : p.input_size; const unsigned int input_size_8bytes = ((input_size * sizeof(T)) % 8) != 0 ? roundup(input_size, 8) : input_size; // Input size per DPU (max.), 8-byte aligned const unsigned int input_size_dpu = divceil(input_size, nr_of_dpus); // Input size per DPU (max.) diff --git a/VA/support/params.h b/VA/support/params.h index e797393..8bd71a6 100644 --- a/VA/support/params.h +++ b/VA/support/params.h @@ -7,6 +7,7 @@ typedef struct Params { unsigned int input_size; int n_warmup; int n_reps; + int exp; }Params; static void usage() { @@ -17,6 +18,7 @@ static void usage() { "\n -h help" "\n -w # of untimed warmup iterations (default=1)" "\n -e # of timed repetition iterations (default=3)" + "\n -x Weak (0) or strong (1) scaling (default=0)" "\n" "\nBenchmark-specific options:" "\n -i input size (default=2621440 elements)" @@ -28,9 +30,10 @@ struct Params input_params(int argc, char **argv) { p.input_size = 2621440; p.n_warmup = 1; p.n_reps = 3; + p.exp = 0; int opt; - while((opt = getopt(argc, argv, "hi:w:e:")) >= 0) { + while((opt = getopt(argc, argv, "hi:w:e:x:")) >= 0) { switch(opt) { case 'h': usage(); @@ -39,6 +42,7 @@ struct Params input_params(int argc, char **argv) { case 'i': p.input_size = atoi(optarg); break; case 'w': p.n_warmup = atoi(optarg); break; case 'e': p.n_reps = atoi(optarg); break; + case 'x': p.exp = atoi(optarg); break; default: fprintf(stderr, "\nUnrecognized option!\n"); usage(); -- cgit v1.2.3