/usr/bin/tauex is in tau 2.16.4-1.5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | #!/bin/sh
TAUROOT=/usr/lib/tau
TAUARCH=amd64
usage()
{
echo ""
echo "Usage: tauex [options] -- <exe> <exe options>"
echo ""
echo "Options:"
echo " -u: User mode counts"
echo " -k: Kernel mode counts"
echo " -S: Supervisor mode counts"
echo " -I: Interrupt mode counts"
echo " -e <event> : Specify PAPI preset or native event"
echo " -T <MPI,OPENMP,TRACE,PROFILE,CALLPATH> : specify TAU option"
echo " -XrunTAU-<options> : specify TAU library directly"
echo ""
echo "Example:"
echo " mpirun -np 2 tauex -e PAPI_TOT_CYC -e PAPI_FP_OPS -T MPI,PROFILE -- ./ring"
echo ""
exit
}
if [ $# = 0 ] ; then
usage
fi
ProfileSpecified="false"
TraceSpecified="false"
processT="false"
processE="false"
TauOptions=""
TauOptionsExclude=""
Counters="GET_TIME_OF_DAY"
NumCounters=1
verbose=false
binding_specified=""
unset TAU_PAPI_DOMAIN
export TAU_PAPI_DOMAIN
for arg in "$@" ; do
# Thanks to Bernd Mohr for the following that handles quotes and spaces (see configure for explanation)
modarg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e s,\',%@%\',g -e 's/%@%/\\\/g' -e 's/ /\\\ /g'`
if [ "$processT" = "true" ] ; then
options=`echo $arg | sed -e 's/,/ /g' | tr [A-Z] [a-z]`
for i in $options ; do
if [ "$i" = "profile" ] ; then
ProfileSpecified="true"
elif [ "$i" = "trace" ] ; then
TraceSpecified="true"
else
TauOptions="$TauOptions $i"
fi
done
processT="false"
shift
elif [ "$processE" = "true" ] ; then
options=`echo $arg | sed -e 's/,/ /g'`
for i in $options ; do
Counters="$Counters $i"
NumCounters=$(( $NumCounters + 1 ))
done
processE="false"
shift
else
case $arg in
-v)
verbose=true
shift
;;
-e)
processE=true
shift
;;
-T)
processT=true
shift
;;
-u)
TAU_PAPI_DOMAIN=$TAU_PAPI_DOMAIN:PAPI_DOM_USER
shift
;;
-k)
TAU_PAPI_DOMAIN=$TAU_PAPI_DOMAIN:PAPI_DOM_KERNEL
shift
;;
-S)
TAU_PAPI_DOMAIN=$TAU_PAPI_DOMAIN:PAPI_DOM_SUPERVISOR
shift
;;
-I)
TAU_PAPI_DOMAIN=$TAU_PAPI_DOMAIN:PAPI_DOM_OTHER
shift
;;
-XrunTAU-*)
myarg=`echo $arg | sed 's/-XrunTAU-//'`
binding_specified="shared-$myarg"
shift
;;
-help)
usage
;;
--help)
usage
;;
--)
shift
break
;;
*)
echo "Unknown option: $arg"
exit
esac
fi
done
if [ $verbose = "true" ] ; then
echo ""
echo "Program to run : $@"
echo ""
fi
if [ "x$binding_specified" = "x" ] ; then
if [ "$ProfileSpecified" = "false" -a "$TraceSpecified" = "false" ] ; then
ProfileSpecified="true"
fi
if [ "$ProfileSpecified" = "true" -a "$TraceSpecified" = "false" ] ; then
TauOptionsExclude="trace"
elif [ "$ProfileSpecified" = "true" -a "$TraceSpecified" = "true" ] ; then
TauOptions="$TauOptions profile trace"
elif [ "$ProfileSpecified" = "false" -a "$TraceSpecified" = "true" ] ; then
TauOptionsExclude="profile"
TauOptions="$TauOptions trace"
fi
if [ $NumCounters -gt 1 ] ; then
TauOptions="$TauOptions multiplecounters papi"
fi
bindings=`ls $TAUROOT/$TAUARCH/lib | grep shared`
for opt in $TauOptions; do
newbindings=""
for b in $bindings ; do
add=`echo $b | grep -i $opt`
newbindings="$newbindings $add"
done
bindings=$newbindings
done
for opt in $TauOptionsExclude; do
newbindings=""
for b in $bindings ; do
add=`echo $b | grep -v -i $opt`
newbindings="$newbindings $add"
done
bindings=$newbindings
done
theBinding=""
for b in $bindings ; do
theBinding=$b
done
if [ "x$theBinding" = "x" ] ; then
echo "Error: Couldn't find a matching TAU binding"
exit
fi
else
theBinding=$binding_specified
fi
# unset any counters that may be active
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ; do
unset COUNTER$i
done
counter=1
for c in $Counters ; do
#echo export COUNTER$counter=$c
export COUNTER$counter=$c
counter=$(( $counter + 1 ))
done
export LD_LIBRARY_PATH=$TAUROOT/$TAUARCH/lib/$theBinding:$LD_LIBRARY_PATH
if [ $verbose = "true" ] ; then
echo "Matching bindings: $bindings"
echo "Using $theBinding"
echo "Setting LD_LIBRARY_PATH to $LD_LIBRARY_PATH"
fi
# execute the program
"$@"
|