Write debug_printf to avoid warnings and fix latency/cfd script

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2022-12-14 16:17:28 +01:00
parent 0e952964f7
commit 292138b270
3 changed files with 21 additions and 12 deletions

View File

@ -19,11 +19,7 @@
# define ABS(a) ((a) >= 0 ? (a) : -(a)) # define ABS(a) ((a) >= 0 ? (a) : -(a))
#endif #endif
#ifdef DEBUG #define DEBUG_MESSAGE debug_printf
# define DEBUG_MESSAGE printf
#else
# define DEBUG_MESSAGE
#endif
#ifndef MAXLINE #ifndef MAXLINE
# define MAXLINE 4096 # define MAXLINE 4096
@ -45,5 +41,6 @@ extern int str2ff(const char *string);
extern const char* ff2str(int ff); extern const char* ff2str(int ff);
extern int get_num_threads(); extern int get_num_threads();
extern void readline(char *line, FILE *fp); extern void readline(char *line, FILE *fp);
extern void debug_printf(const char *format, ...);
#endif #endif

View File

@ -5,6 +5,7 @@
* license that can be found in the LICENSE file. * license that can be found in the LICENSE file.
*/ */
#include <errno.h> #include <errno.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -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
}

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
MDBENCH_BIN="MDBench-ICX-lammps" MDBENCH_BIN=./MDBench-ICX-lammps
FREQ=2.1 FREQ=2.1
NRUNS=3 NRUNS=3
FIXED_PARAMS="--freq $FREQ" FIXED_PARAMS=--freq $FREQ
function run_benchmark() { function run_benchmark() {
for i in $(seq $NRUNS); do for i in $(seq $NRUNS); do
@ -19,12 +19,12 @@ echo "Fixing frequencies..."
likwid-setFrequencies -f $FREQ -t 0 likwid-setFrequencies -f $FREQ -t 0
echo "Standard" echo "Standard"
run_benchmark ./MDBench-ICC-lammps run_benchmark $MDBENCH_BIN
echo "Melt" 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" 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" echo "Stub-76"
run_benchmark ./MDBench-ICC-lammps-stub -nn 76 run_benchmark $MDBENCH_BIN-stub -nn 76
echo "Stub-1024" echo "Stub-1024"
run_benchmark ./MDBench-ICC-lammps-stub -nn 1024 run_benchmark $MDBENCH_BIN-stub -nn 1024