#! /bin/bash set -u # Files and directories binDir="bin" thisScript="$0" # Param binList="asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm" # Type de communication nbProdList="1" # Nombre de cores producteurs typeProdList="none matrice" # Methode pour produire les valeurs typeCacheList="L2 mem" # Niveau de cache partage # Const nbIter="5000000" # Nb de lignes produites sizeBuf="1" # En nombre de lignes de cache # Nom generique des fichiers de log logFileName="\$perfDirName/cache_\$typeCache-nbProd_\$nbProd-typeProd_\$typeProd-nbIter_\$nbIter-\$bin" expDirName="logs" perfDirName="$expDirName/perfCommMulti-`date +'%F-%Hh%Mm%S'`" if [ -n $LD_LIBRARY_PATH ] then LD_LIBRARY_PATH_LEFT="${LD_LIBRARY_PATH}" while [ -n "${LD_LIBRARY_PATH_LEFT}" ] do aLibDir="${LD_LIBRARY_PATH_LEFT%%:*}" if [ -x ${aLibDir}/libpapi.so ] then papiLibPresent="1"; fi if [ -x ${aLibDir}/libpapihighlevel.so ] then papiHighLevelLibPresent="1"; fi if [ -n "${papiLibPresent}" -a -n "${papiHighLevelLibPresent}" ] then break fi LD_LIBRARY_PATH_LEFT="${LD_LIBRARY_PATH#*:}" done if [ -z "${papiLibPresent}" -o -z "${papiHighLevelLibPresent}" ] then echo "Libraries needed for this bench not accessible by \$LD_LIBRARY_PATH" > /dev/stderr # Is there a better way to display something on stderr ? exit 1 fi else echo "Libraries needed for this bench not accessible by \$LD_LIBRARY_PATH" > /dev/stderr # Is there a better way to display something on stderr ? exit 1 fi unset papiLibPresent unset papiHighLevelLibPresent unset LD_LIBRARY_PATH_LEFT [ -d "$expDirName" ] || mkdir "$expDirName" [ -d "$perfDirName" ] || mkdir "$perfDirName" function_run () { case $typeProd in "none" ) optTypeProd="" ;; "matrice" ) optTypeProd="-c $thisScript" ;; * ) exit 1 ;; esac case $typeCache in "mem" ) optTypeCache="-s 0" ;; "L2" ) optTypeCache="-s 2" ;; * ) exit 1 ;; esac make $binDir/$bin echo "On lance : \"${bin##*/} $optTypeCache $optTypeProd -p $nbProd -n $nbIter\"" beginingDate=`date +%s` ( $binDir/$bin $optTypeCache $optTypeProd -p $nbProd -n $nbIter || echo "echec experience" ) | eval tee $logFileName 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 "" } echo -e "On commence les perfs\n" globalBeginingDate=`date +%s` for nbProd in $nbProdList ; do for typeProd in $typeProdList; do for typeCache in $typeCacheList ; do for bin in $binList ; do function_run 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"