2009-06-18 22:16:29 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
2009-06-25 17:40:42 +02:00
|
|
|
set -u
|
|
|
|
|
2011-02-24 20:58:37 +01:00
|
|
|
LC_ALL=C
|
|
|
|
|
2009-06-18 22:16:29 +02:00
|
|
|
# Files and directories
|
|
|
|
binDir="bin"
|
2009-06-23 12:25:36 +02:00
|
|
|
calcDir="calculation"
|
2009-06-18 22:16:29 +02:00
|
|
|
|
|
|
|
# Param
|
2010-09-22 18:15:57 +02:00
|
|
|
binList="$(ls -1 "${binDir}"| sed '$!s/$/ /' | tr -d '\n')"
|
2011-04-11 16:18:49 +02:00
|
|
|
nbNodesList="2" # Nombre de noeuds chainés dans le pipeline
|
2011-01-25 17:21:39 +01:00
|
|
|
typeProdList="none useless_loop line matrice" # Methode pour produire les valeurs
|
2009-07-08 18:33:32 +02:00
|
|
|
typeCacheList="L2 Memory" # Niveau de cache partage
|
2011-05-25 15:40:51 +02:00
|
|
|
perfOpt="stat -B -r 10 -e cycles -e L1-dcache-loads -e L1-dcache-stores -e L1-dcache-load-misses -e L1-dcache-store-misses -e L1-dcache-prefetch-misses"
|
2009-06-18 22:16:29 +02:00
|
|
|
|
|
|
|
# Const
|
2011-05-10 11:14:28 +02:00
|
|
|
nbIter="500000768" # Nb de lignes produites (doit être un multiple de BUF_SIZE)
|
2009-06-18 22:16:29 +02:00
|
|
|
sizeBuf="1" # En nombre de lignes de cache
|
|
|
|
|
|
|
|
# Nom generique des fichiers de log
|
2011-04-11 16:18:49 +02:00
|
|
|
logFileName="\$perfDirName/cache_\$typeCache-nbNodes_\$nbNodes-typeProd_\$typeProd-argTypeProd_\$argTypeProd-nbIter_\$nbIter-\$bin.log"
|
2009-06-18 22:16:29 +02:00
|
|
|
expDirName="logs"
|
|
|
|
perfDirName="$expDirName/perfCommMulti-`date +'%F-%Hh%Mm%S'`"
|
|
|
|
|
2012-02-21 18:05:59 +01:00
|
|
|
perfOpt="$perfOpt -o $logFileName.perf"
|
|
|
|
|
2009-06-25 17:29:44 +02:00
|
|
|
export LD_LIBRARY_PATH
|
2009-06-18 22:16:29 +02:00
|
|
|
|
|
|
|
[ -d "$expDirName" ] || mkdir "$expDirName"
|
|
|
|
[ -d "$perfDirName" ] || mkdir "$perfDirName"
|
|
|
|
|
|
|
|
function_run () {
|
|
|
|
case $typeProd in
|
|
|
|
"none" ) optTypeProd="" ;;
|
2011-01-25 17:21:39 +01:00
|
|
|
"line" ) optTypeProd="-c lib/${calcDir}/libcalc_line.so ${argTypeProd}" ;;
|
2011-01-25 17:27:07 +01:00
|
|
|
"matrice" ) optTypeProd="-c lib/${calcDir}/libcalc_mat.so ${argTypeProd}" ;;
|
2009-07-06 17:12:57 +02:00
|
|
|
"useless_loop" ) optTypeProd="-c lib/${calcDir}/libcalc_useless_loop.so ${argTypeProd}" ;;
|
2009-06-18 22:16:29 +02:00
|
|
|
* ) exit 1 ;;
|
|
|
|
esac
|
|
|
|
case $typeCache in
|
2009-07-08 18:33:32 +02:00
|
|
|
"Memory" ) optTypeCache="" ;;
|
2009-06-23 12:31:48 +02:00
|
|
|
"L2" ) optTypeCache="-s" ;;
|
2009-06-18 22:16:29 +02:00
|
|
|
* ) exit 1 ;;
|
|
|
|
esac
|
2011-04-11 16:18:49 +02:00
|
|
|
nbNodes=$((nbNodes))
|
|
|
|
case $nbNodes in
|
|
|
|
"") exit 1 ;;
|
|
|
|
0|1 ) exit 1 ;;
|
|
|
|
2 ) optNbNodes="" ;;
|
2011-05-09 15:01:06 +02:00
|
|
|
[0-9]* ) optNbNodes="-l $nbNodes" ;;
|
2011-04-11 16:18:49 +02:00
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
2009-06-18 22:16:29 +02:00
|
|
|
|
|
|
|
make $binDir/$bin
|
2012-02-21 18:06:47 +01:00
|
|
|
cmdLineRun="eval perf $perfOpt $binDir/$bin $optTypeCache $optTypeProd $optNbNodes -n $nbIter"
|
2011-05-25 15:40:51 +02:00
|
|
|
echo "On lance : \"$cmdLineRun\""
|
2009-06-18 22:16:29 +02:00
|
|
|
beginingDate=`date +%s`
|
|
|
|
|
2011-05-25 15:40:51 +02:00
|
|
|
( $cmdLineRun 2>&1 || echo "echec experience" ) | eval tee $logFileName
|
2012-02-21 18:05:59 +01:00
|
|
|
eval cat $logFileName.perf >> $logFileName
|
|
|
|
eval rm $logFileName.perf
|
2009-06-18 22:16:29 +02:00
|
|
|
endDate=`date +%s`
|
|
|
|
duration_sec=`expr \( $endDate - $beginingDate \) % 60`
|
|
|
|
duration_min=`expr \( $endDate - $beginingDate \) / 60`
|
|
|
|
duration_hrs=`expr $duration_min / 60`
|
|
|
|
duration_min=`expr $duration_min % 60`
|
|
|
|
|
|
|
|
echo "Fin de l'experience : `date +'%H:%M:%S (%d/%m/%y)'`"
|
|
|
|
echo "La duree est de : ${duration_hrs}hrs ${duration_min}min ${duration_sec}sec"
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
2011-04-11 16:18:49 +02:00
|
|
|
eval echo \"# Describe what this experiment is about: \\\"what are the parameters evaluated?\\\"\" > "$perfDirName/description"
|
|
|
|
eval vim "$perfDirName/description"
|
2009-06-18 22:16:29 +02:00
|
|
|
|
|
|
|
echo -e "On commence les perfs\n"
|
|
|
|
globalBeginingDate=`date +%s`
|
|
|
|
|
2011-04-11 16:18:49 +02:00
|
|
|
for nbNodes in $nbNodesList ; do
|
2009-06-18 22:16:29 +02:00
|
|
|
for typeProd in $typeProdList; do
|
|
|
|
for typeCache in $typeCacheList ; do
|
|
|
|
for bin in $binList ; do
|
2009-07-01 16:25:36 +02:00
|
|
|
case $typeProd in
|
|
|
|
"useless_loop" )
|
2011-01-25 17:21:39 +01:00
|
|
|
for argTypeProd in 1 `seq 5 5 50` ; do
|
|
|
|
function_run ;
|
|
|
|
done ;;
|
|
|
|
"line" )
|
|
|
|
for argTypeProd in 1 2 4 8 16 32 64 ; do
|
|
|
|
function_run ;
|
|
|
|
done ;;
|
2009-07-01 16:25:36 +02:00
|
|
|
"matrice" )
|
|
|
|
argTypeProd=16 ;
|
|
|
|
function_run ;;
|
|
|
|
* )
|
|
|
|
argTypeProd=1 ;
|
|
|
|
function_run ;;
|
|
|
|
esac
|
2009-06-18 22:16:29 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
globalEndDate=`date +%s`
|
|
|
|
globalDuration_sec=`expr \( $globalEndDate - $globalBeginingDate \) % 60`
|
|
|
|
globalDuration_min=`expr \( $globalEndDate - $globalBeginingDate \) / 60`
|
|
|
|
globalDuration_hrs=`expr $globalDuration_min / 60`
|
|
|
|
globalDuration_min=`expr $globalDuration_min % 60`
|
|
|
|
|
|
|
|
echo "Fin de la serie d'experience : `date +'%H:%M:%S (%d/%m/%y)'`"
|
|
|
|
echo "La duree totale est de : ${globalDuration_hrs}hrs ${globalDuration_min}min ${globalDuration_sec}sec"
|
|
|
|
|