Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
attach time-independent traces to processes when the executable is
authorsuter <frederic.suter@cc.in2p3.fr>
Thu, 6 Sep 2012 14:16:14 +0000 (16:16 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Mon, 10 Sep 2012 09:04:43 +0000 (11:04 +0200)
called replay. It takes only one argument that is a file listing the
traces to attach. If there is only one trace in this file, all the
processes try to find their own actions in it. Otherwise, they have
their own trace to read.

src/smpi/smpirun.in

index aa962e2..673d0cc 100755 (executable)
@@ -212,6 +212,14 @@ if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then
       NUMHOSTS=`cat ${HOSTFILE} | wc -l`
 fi
 
+if [ ${EXEC} = "./replay" ]; then 
+  APP_TRACES=$1;
+  if [ -n "${APP_TRACES}" ] && [ -f ${APP_TRACES} ]; then
+     hosttraces=(`cat ${APP_TRACES} | tr \\\n " "`)
+     NUMTRACES=`cat ${APP_TRACES} | wc -l`
+  fi
+fi
+
 ##----------------------------------------------------------
 ##  generate application.xml with hostnames from hostfile:
 ##  the name of host_i (1<=i<=p, where -np p) is the line i
@@ -250,9 +258,17 @@ do
   fi
   echo "  <process host=\"${host}\" function=\"$i\"> <!-- function name used only for logging -->" >> ${APPLICATIONTMP}
   echo "    <argument value=\"$i\"/> <!-- rank -->" >> ${APPLICATIONTMP}
-  for ARG in $*; do
-    echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
-  done
+  if [ ${EXEC} = "./replay" ]; then
+    if  [ ${NUMTRACES} -gt 1 ]; then
+      echo "    <argument value=\"${hosttraces[$j]}\"/>" >> ${APPLICATIONTMP}
+    else
+      echo "    <argument value=\"${hosttraces[0]}\"/>" >> ${APPLICATIONTMP}
+    fi
+  else 
+    for ARG in $*; do
+       echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
+    done
+  fi
   echo "  </process>" >> ${APPLICATIONTMP}
 done