#! /bin/bash set -u # Files and directories binDir="bin" calcDir="calculation" PHLDir="../papihighlevel" PHLLibDir="lib" PAPIDir="${PHLDir}/papi" PAPILibDir="src" PAPIPFMDir="libpfm-3.y/lib" # Param binList="asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm" # Type de communication nbProdList="1" # Nombre de cores producteurs typeProdList="none matrice useless_loop" # 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-argTypeProd_\$argTypeProd-nbIter_\$nbIter-\$bin.log" expDirName="logs" perfDirName="$expDirName/perfCommMulti-`date +'%F-%Hh%Mm%S'`" LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}${LD_LIBRARY_PATH:+:}${PHLDir}/${PHLLibDir}:${PAPIDir}/${PAPILibDir}:${PAPIDir}/${PAPILibDir}/${PAPIPFMDir}" PAPILibPresent="" PFMLibPresent="" papiHighLevelLibPresent="" LD_LIBRARY_PATH_LEFT="${LD_LIBRARY_PATH}:" while [ -n "${LD_LIBRARY_PATH_LEFT}" ] do aLibDir="${LD_LIBRARY_PATH_LEFT%%:*}" if [ -x ${aLibDir}/libpapi.so.3 ] then PAPILibPresent="1"; fi if [ -x ${aLibDir}/libpfm.so.3 ] then PHLLibPresent="1"; fi if [ -x ${aLibDir}/libpapihighlevel.so ] then PHLLibPresent="1"; fi if [ -n "${PAPILibPresent}" -a -n "${PHLLibPresent}" -a -n "${PFMLibPresent}" ] then break fi LD_LIBRARY_PATH_LEFT="${LD_LIBRARY_PATH_LEFT#*:}" done if [ -z "${PAPILibPresent}" -o -z "${PHLLibPresent}" ] 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 unset PAPILibPresent unset PHLLibPresent unset LD_LIBRARY_PATH_LEFT export LD_LIBRARY_PATH [ -d "$expDirName" ] || mkdir "$expDirName" [ -d "$perfDirName" ] || mkdir "$perfDirName" function_run () { case $typeProd in "none" ) optTypeProd="" ;; "matrice" ) optTypeProd="-c lib/${calcDir}/libcalc_mat.so 16" ;; "useless_loop" ) optTypeProd="-c lib/${calcDir}/libcalc_useless_loop.so ${nb_useless_loop}" ;; * ) exit 1 ;; esac case $typeCache in "mem" ) optTypeCache="" ;; "L2" ) optTypeCache="-s" ;; * ) 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 case $typeProd in "useless_loop" ) case $bin in "jikes_barrier_comm" | "asm_cache_comm" | "c_cache_comm" ) for argTypeProd in `seq 1 50 5` ; do function_run ; done ;; * ) argTypeProd=1 ; function_run ;; esac ;; "matrice" ) argTypeProd=16 ; function_run ;; * ) argTypeProd=1 ; function_run ;; esac 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"