Skip to content
Snippets Groups Projects
build-and-getbest-run.sh 880 B
Newer Older
gkusoglu's avatar
gkusoglu committed
#!/bin/bash
gkusoglu's avatar
gkusoglu committed
rm $1 > /dev/null 2>&1
gkusoglu's avatar
gkusoglu committed
if [[ $4 == "yes" ]] ; then
    echo "---------------------------------"
    echo "parallel ? : $3"
fi
gkusoglu's avatar
gkusoglu committed

gkusoglu's avatar
gkusoglu committed
if [[ $3 == "yes" ]] ; then
    gcc -O3 -march=native -fopenmp -I ../utilities  ../utilities/polybench.c $1.c -DPOLYBENCH_TIME -D$2_DATASET -o $1 -lm
else
    gcc -O3 -march=native -I ../utilities  ../utilities/polybench.c $1.c -DPOLYBENCH_TIME -D$2_DATASET -o $1 -lm
fi
gkusoglu's avatar
gkusoglu committed
MIN=9999
gkusoglu's avatar
gkusoglu committed
for i in {0..999}
gkusoglu's avatar
gkusoglu committed
do
    if [[ $3 == "yes" ]] ; then
gkusoglu's avatar
gkusoglu committed
        time_exec=`OMP_PROC_BIND=true OMP_NUM_THREADS=12 ./$1 2>&1`
gkusoglu's avatar
gkusoglu committed
    else
gkusoglu's avatar
gkusoglu committed
        time_exec=`./$1 2>&1`
    fi
    var=$(awk 'BEGIN{ print "'${time_exec}'"<"'${MIN}'" }')
    if [ "$var" -eq 1 ];then
gkusoglu's avatar
gkusoglu committed
        if [[ $4 == "yes" ]] ; then
            echo "current $2 : $time_exec"
        fi
gkusoglu's avatar
gkusoglu committed
        MIN="$time_exec"
gkusoglu's avatar
gkusoglu committed
    fi
done
gkusoglu's avatar
gkusoglu committed

gkusoglu's avatar
gkusoglu committed
if [[ $4 == "yes" ]] ; then
    echo "real $2 : $MIN"
else
gkusoglu's avatar
gkusoglu committed
    echo "$MIN"
gkusoglu's avatar
gkusoglu committed
fi