From d64645109101aadadc2cfc8b9a6e269dccb2b0f6 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 25 Jun 2009 17:29:44 +0200 Subject: [PATCH] commtechs: We can launch without LD_LIBRARY_PATH --- communication_techniques/lancement.sh | 71 ++++++++++++++++----------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/communication_techniques/lancement.sh b/communication_techniques/lancement.sh index 3263a8a..70e8f26 100755 --- a/communication_techniques/lancement.sh +++ b/communication_techniques/lancement.sh @@ -1,10 +1,13 @@ #! /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 @@ -21,38 +24,50 @@ logFileName="\$perfDirName/cache_\$typeCache-nbProd_\$nbProd-typeProd_\$typeProd expDirName="logs" perfDirName="$expDirName/perfCommMulti-`date +'%F-%Hh%Mm%S'`" -if [ -n $LD_LIBRARY_PATH ] +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 + LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PHLDir}/${PHLLibDir}:${PAPIDir}/${PAPILibDir}:${PAPIDir}/${PAPILibDir}/${PAPIPFMDir}" else + LD_LIBRARY_PATH="${PHLDir}/${PHLLibDir}:${PAPIDir}/${PAPILibDir}:${PAPIDir}/${PAPILibDir}/${PAPIPFMDir}" +fi + +set -u + +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 papiHighLevelLibPresent + +unset PAPILibPresent +unset PHLLibPresent unset LD_LIBRARY_PATH_LEFT +export LD_LIBRARY_PATH [ -d "$expDirName" ] || mkdir "$expDirName" [ -d "$perfDirName" ] || mkdir "$perfDirName"