1#! @SHELL@ 2 3# The script is designed to be invoked from a "Makefile", 4# notice the command "$MAKE $pgm" below. 5 6MAKE="@MAKE@" 7ECHO_N="@ECHO_N@" 8ECHO_C="@ECHO_C@" 9ECHO_T="@ECHO_T@" 10RM="@RM@" 11MV="@MV@" 12 13MPE_BINDIR=@binbuild_dir@ 14 15execbasename=`basename $0` 16MPE_OUTFILE="mpe2_$execbasename.txt" 17# If MPERUN is set by configure, it should have been doubly quoted. 18MPERUN_DEF=@MPERUN@ 19MPERUN_DEF=${MPERUN_DEF:-"$MPE_BINDIR/mpiexec -n 4"} 20MPERUN=${MPERUN:-${MPERUN_DEF}} 21CLOG2TOSLOG2=${CLOG2TOSLOG2:-"$MPE_BINDIR/clog2TOslog2"} 22 23# Assume user's PATH does not have ".", prefix it with "." 24PATH=".:$PATH" 25export PATH 26 27pgm=$1 28message=$2 29 30# Define clog2 and slog2 filenames based on executable prefix filename. 31clog2file="`echo $pgm | sed -e 's/\.exe$//g'`.clog2" 32slog2file="`echo $pgm | sed -e 's/\.exe$//g'`.slog2" 33 34echo 35echo ${ECHO_N} "$message ${ECHO_C}" 36$RM -f $pgm 37$MAKE $pgm > $MPE_OUTFILE 2>&1 38if test -x $pgm ; then 39 $RM -f $MPE_OUTFILE 40# remove the possible clog2 files generated by the subsequent mpiexec run. 41 $RM -f Unknown.clog2 $clog2file 42 $RM -f Unknown.clog2.pnm ${clog2file}.pnm 43 echo "$MPERUN $pgm" > $MPE_OUTFILE 44 $MPERUN $pgm >> $MPE_OUTFILE 2>&1 45 mperun_rc=$? 46 if [ $mperun_rc != 0 ] ; then 47 echo "${ECHO_T}No." 48 echo " The failed command is :" 49 cat $MPE_OUTFILE 50 else 51 if [ -f Unknown.clog2 -a ! -f $clog2file ] ; then 52 $MV Unknown.clog2 $clog2file 53 fi 54 if [ -f $clog2file ] ; then 55 echo "${ECHO_T}Yes." 56 echo ${ECHO_N} " Convert $clog2file to slog2 file .............. ${ECHO_C}" 57 if [ -x $CLOG2TOSLOG2 ] ; then 58 $RM -f $MPE_OUTFILE 59 echo "$CLOG2TOSLOG2 $clog2file" > $MPE_OUTFILE 60 $CLOG2TOSLOG2 $clog2file >> $MPE_OUTFILE 2>&1 61 logconv_rc=$? 62 if [ $logconv_rc = 0 -a -s $slog2file ] ; then 63 echo "${ECHO_T}Yes." 64 else 65 echo "${ECHO_T}No." 66 echo " `basename $CLOG2TOSLOG2` conversion fails!" 67 cat $MPE_OUTFILE 68 fi 69 else 70 echo "${ECHO_T}No." 71 echo " Missing file or unset execution bit in $CLOG2TOSLOG2!" 72 fi 73 else 74 echo "${ECHO_T}No." 75 echo " $clog2file is not generated." 76 fi 77 fi 78 $RM -f $pgm 79else 80 echo "${ECHO_T}No." 81 echo " The failed command is :" 82 cat $MPE_OUTFILE 83fi 84$RM -f $MPE_OUTFILE 85