commtechs: We can launch without LD_LIBRARY_PATH

This commit is contained in:
Thomas Preud'homme 2009-06-25 17:29:44 +02:00 committed by Thomas Preud'homme
parent a29aafe25e
commit d646451091
1 changed files with 43 additions and 28 deletions

View File

@ -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"