Run script with different prefetcher settings and provide better output

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2022-12-20 18:51:54 +01:00
parent b20e8c6986
commit 56ff0d19af

View File

@ -1,46 +1,79 @@
#!/bin/bash #!/bin/bash
TAG=ICX TAG=ICC
OPT_SCHEME=gromacs OPT_SCHEME=lammps
MDBENCH_BIN=./MDBench-$TAG-$OPT_SCHEME MDBENCH_BIN=./MDBench-$TAG-$OPT_SCHEME
CORE=0
FREQ=2.4 FREQ=2.4
NRUNS=3 NRUNS=3
FIXED_PARAMS=--freq $FREQ FIXED_PARAMS="--freq $FREQ"
CPU_VENDOR=$(lscpu | grep "Vendor ID" | tr -s ' ' | cut -d ' ' -f3)
LOG=latencies_and_cfds.log
if [ "$OPT_SCHEME" = "gromacs" ]; then if [ "$CPU_VENDOR" == "GenuineIntel" ]; then
STUB1_NAME=Stub-33 ALL_PREFETCHERS="HW_PREFETCHER,CL_PREFETCHER,DCU_PREFETCHER,IP_PREFETCHER"
STUB1_PARAMS=-na 4 -nn 33 PREFETCHERS=("ALL HW_PREFETCHER CL_PREFETCHER DCU_PREFETCHER IP_PREFETCHER NONE")
STUB2_NAME=Stub-128
STUB2_PARAMS=-na 4 -nn 128
else else
STUB1_NAME=Stub-76 ALL_PREFETCHERS=""
STUB1_PARAMS=-nn 76 PREFETCHERS=("IGNORE")
STUB2_NAME=Stub-1024 fi
STUB2_PARAMS=-nn 1024
if [ "$OPT_SCHEME" == "gromacs" ]; then
STUB1_NAME=stub-33
STUB1_PARAMS="-na 4 -nn 33"
STUB2_NAME=stub-128
STUB2_PARAMS="-na 4 -nn 128"
else
STUB1_NAME=stub-76
STUB1_PARAMS="-nn 76"
STUB2_NAME=stub-1024
STUB2_PARAMS="-nn 1024"
fi fi
function run_benchmark() { function run_benchmark() {
BEST=10000000
for i in $(seq $NRUNS); do for i in $(seq $NRUNS); do
likwid-pin -c 0 "$* $FIXED_PARAMS" 2>&1 | grep "Cycles/SIMD iteration" | cut -d ' ' -f3 RES=$(likwid-pin -c $CORE "$* $FIXED_PARAMS" 2>&1 | grep "Cycles/SIMD iteration" | cut -d ' ' -f3)
if (( $(echo "$BEST > $RES" | bc -l ) )); then
BEST=$RES
fi
done done
} }
echo "Tag: $TAG" echo "Tag: $TAG" | tee -a $LOG
echo "Optimization scheme: $OPT_SCHEME" echo "Optimization scheme: $OPT_SCHEME" | tee -a $LOG
echo "Binary: $MDBENCH_BIN(-stub)" echo "Binary: $MDBENCH_BIN(-stub)" | tee -a $LOG
echo "Frequency: $FREQ" echo "Frequency: $FREQ" | tee -a $LOG
echo "Number of runs: $NRUNS" echo "Number of runs: $NRUNS" | tee -a $LOG
echo "Fixing frequencies..." echo "Fixing frequencies..."
likwid-setFrequencies -f $FREQ -t 0 likwid-setFrequencies -f $FREQ -t 0
echo "Standard" for p in $PREFETCHERS; do
run_benchmark $MDBENCH_BIN if [ "$p" != "IGNORE" ]; then
echo "Melt" if [ "$p" == "ALL" ]; then
run_benchmark $MDBENCH_BIN -i data/copper_melting/input_lj_cu_one_atomtype_20x20x20.dmp likwid-features -c $CORE -e $ALL_PREFETCHERS
echo "Argon" elif [ "$p" == "NONE" ]; then
run_benchmark $MDBENCH_BIN -p data/argon_1000/mdbench_params.conf -i data/argon_1000/tprout.gro likwid-features -c $CORE -d $ALL_PREFETCHERS
echo "$STUB1_NAME" else
run_benchmark $MDBENCH_BIN-stub $STUB1_PARAMS likwid-features -c $CORE -d $ALL_PREFETCHERS
echo "$STUB2_NAME" likwid-features -c $CORE -e $p
run_benchmark $MDBENCH_BIN-stub $STUB2_PARAMS fi
echo "Prefetcher settings: $p"
likwid-features -c $CORE -l
fi
MSG="$p: "
run_benchmark $MDBENCH_BIN
MSG+="standard=$BEST, "
run_benchmark $MDBENCH_BIN -i data/copper_melting/input_lj_cu_one_atomtype_20x20x20.dmp
MSG+="melt=$BEST, "
run_benchmark $MDBENCH_BIN -p data/argon_1000/mdbench_params.conf -i data/argon_1000/tprout.gro
MSG+="argon=$BEST, "
run_benchmark $MDBENCH_BIN-stub $STUB1_PARAMS
MSG+="$STUB1_NAME=$BEST, "
run_benchmark $MDBENCH_BIN-stub $STUB2_PARAMS
MSG+="$STUB2_NAME=$BEST"
echo $MSG | tee -a $LOG
done