From 292138b2702f54418448506d97ae720a2a5c76f0 Mon Sep 17 00:00:00 2001 From: Rafael Ravedutti Date: Wed, 14 Dec 2022 16:17:28 +0100 Subject: [PATCH] Write debug_printf to avoid warnings and fix latency/cfd script Signed-off-by: Rafael Ravedutti --- common/includes/util.h | 7 ++----- common/util.c | 12 ++++++++++++ util/evaluate_latency_and_cfd.sh | 14 +++++++------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/common/includes/util.h b/common/includes/util.h index 7efd000..5ff9c2b 100644 --- a/common/includes/util.h +++ b/common/includes/util.h @@ -19,11 +19,7 @@ # define ABS(a) ((a) >= 0 ? (a) : -(a)) #endif -#ifdef DEBUG -# define DEBUG_MESSAGE printf -#else -# define DEBUG_MESSAGE -#endif +#define DEBUG_MESSAGE debug_printf #ifndef MAXLINE # define MAXLINE 4096 @@ -45,5 +41,6 @@ extern int str2ff(const char *string); extern const char* ff2str(int ff); extern int get_num_threads(); extern void readline(char *line, FILE *fp); +extern void debug_printf(const char *format, ...); #endif diff --git a/common/util.c b/common/util.c index b0f0c76..2508b7d 100644 --- a/common/util.c +++ b/common/util.c @@ -5,6 +5,7 @@ * license that can be found in the LICENSE file. */ #include +#include #include #include #include @@ -91,3 +92,14 @@ void readline(char *line, FILE *fp) { } } } + +void debug_printf(const char *format, ...) { + #ifdef DEBUG + va_list arg; + int ret; + + va_start(arg, format); + if((vfprintf(stdout, format, arg)) < 0) { perror("debug_printf()"); } + va_end(arg); + #endif +} diff --git a/util/evaluate_latency_and_cfd.sh b/util/evaluate_latency_and_cfd.sh index 6847f3b..3a3c3d5 100644 --- a/util/evaluate_latency_and_cfd.sh +++ b/util/evaluate_latency_and_cfd.sh @@ -1,9 +1,9 @@ #!/bin/bash -MDBENCH_BIN="MDBench-ICX-lammps" +MDBENCH_BIN=./MDBench-ICX-lammps FREQ=2.1 NRUNS=3 -FIXED_PARAMS="--freq $FREQ" +FIXED_PARAMS=--freq $FREQ function run_benchmark() { for i in $(seq $NRUNS); do @@ -19,12 +19,12 @@ echo "Fixing frequencies..." likwid-setFrequencies -f $FREQ -t 0 echo "Standard" -run_benchmark ./MDBench-ICC-lammps +run_benchmark $MDBENCH_BIN echo "Melt" -run_benchmark ./MDBench-ICC-lammps -i data/copper_melting/input_lj_cu_one_atomtype_20x20x20.dmp +run_benchmark $MDBENCH_BIN -i data/copper_melting/input_lj_cu_one_atomtype_20x20x20.dmp echo "Argon" -run_benchmark ./MDBench-ICC-lammps -p data/argon_1000/mdbench_params.conf -i data/argon_1000/tprout.gro +run_benchmark $MDBENCH_BIN -p data/argon_1000/mdbench_params.conf -i data/argon_1000/tprout.gro echo "Stub-76" -run_benchmark ./MDBench-ICC-lammps-stub -nn 76 +run_benchmark $MDBENCH_BIN-stub -nn 76 echo "Stub-1024" -run_benchmark ./MDBench-ICC-lammps-stub -nn 1024 +run_benchmark $MDBENCH_BIN-stub -nn 1024