start of new file
[IRC.git] / Robust / src / Benchmarks / Prefetch / run.sh
index efccc3329a3cd56a2404299e922e9c37a17b9410..f0bf7635c40e1f16d734a73e11b2d4f6e43a00c4 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh 
 
-MACHINES2='dw-8.eecs.uci.edu'
-MACHINES4='dw-8.eecs.uci.edu dw-5.eecs.uci.edu dw-7.eecs.uci.edu'
+MACHINES2='dw-9.eecs.uci.edu'
+MACHINES3='dw-9.eecs.uci.edu dw-5.eecs.uci.edu'
+MACHINES4='dw-9.eecs.uci.edu dw-5.eecs.uci.edu dw-7.eecs.uci.edu'
 LOGDIR=/home/adash/research/Robust/src/Benchmarks/Prefetch/runlog
 TOPDIR=`pwd`
 
@@ -11,14 +12,14 @@ function run {
   while [ $i -lt $1 ]; do
     echo "$DIR" > ~/.tmpdir
     echo "bin=$3" > ~/.tmpvars
-    if [ $2 -eq 1 ]; then
-      arg=$ARGS1
-      MACHINES=$MACHINES2
-    fi
     if [ $2 -eq 2 ]; then 
       arg=$ARGS2
       MACHINES=$MACHINES2
     fi
+    if [ $2 -eq 3 ]; then 
+      arg=$ARGS3
+      MACHINES=$MACHINES3
+    fi
     if [ $2 -eq 4 ]; then 
       arg=$ARGS4
       MACHINES=$MACHINES4
@@ -29,13 +30,32 @@ function run {
       ssh ${machine} 'cd `cat ~/.tmpdir`; source ~/.tmpvars; ./$bin' &
       echo ""
     done
-    sleep 1
-    /usr/bin/time -f "%e" ./$3 master $arg 2>> ${LOGDIR}/${3}.txt
+    sleep 5
+    /usr/bin/time -f "%e" ./$3 master $arg 2>> ${LOGDIR}/${3}_${EXTENSION}.txt
     echo "Terminating ... "
     for machine in `echo $MACHINES`
     do
       ssh ${machine} 'source ~/.tmpvars; killall $bin'
     done
+    sleep 2
+    i=`expr $i + 1`
+  done
+}
+
+function oneremote {
+  i=0;
+  DIR=`pwd` 
+  while [ $i -lt $1 ]; do
+    echo "$DIR" > ~/.tmpdir
+    echo "bin=$3" > ~/.tmpvars
+    echo "arg='$ARGS1'" > ~/.tmpargs
+    echo "logd=$LOGDIR" > ~/.tmplogdir
+    echo "ext=$EXTENSION" > ~/.tmpext
+    ./$3 &
+    ssh $MACHINES2 'cd `cat ~/.tmpdir`; source ~/.tmpvars; source ~/.tmpargs; source ~/.tmplogdir; source ~/.tmpext; /usr/bin/time -f "%e" ./$bin master $arg 2>> ${logd}/${bin}_remote_${ext}.txt'
+    echo "Terminating ... "
+    killall $3
+    sleep 2
     i=`expr $i + 1`
   done
 }
@@ -43,12 +63,8 @@ function run {
 function localrun {
   i=0;
   while [ $i -lt $1 ]; do
-     #echo $ARGS1
-    /usr/bin/time -f "%e" ./${NONPREFETCH} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH}.txt
-    sleep 1
-    #avg=`cat ${LOGDIR}/${NONPREFETCH}.txt | awk '{sum+=$1} END {print sum/NR}'`
-    #sort -nr ${LOGDIR}/${NONPREFETCH}.txt | tail -1
-    #sort -nr ${LOGDIR}/${NONPREFETCH}.txt | tail -1
+    /usr/bin/time -f "%e" ./${NONPREFETCH} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH}_local_${EXTENSION}.txt
+    sleep 4
     i=`expr $i + 1`
   done
 }
@@ -58,32 +74,52 @@ function callrun {
   NONPREFETCH=${BENCHMARK}1NP.bin
   PREFETCH2=${BENCHMARK}2.bin
   NONPREFETCH2=${BENCHMARK}2NP.bin
+  PREFETCH3=${BENCHMARK}3.bin
+  NONPREFETCH3=${BENCHMARK}3NP.bin
   PREFETCH4=${BENCHMARK}4.bin
   NONPREFETCH4=${BENCHMARK}4NP.bin
   cd $BMDIR 
 
+  echo "---------- Running local $BMDIR non-prefetch on 1 machine ---------- "
+  localrun 10
+
+  echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- "
+  oneremote 10 1 $NONPREFETCH
+  echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- "
+  oneremote 10 1 $PREFETCH
 
-  echo "---------- Running local $BMDIR non-prefetch ---------- "
-  localrun 1 
+  echo "---------- Running two threads $BMDIR non-prefetch on 2 machines ---------- "
+  run 10 2 $NONPREFETCH2 
+  echo "---------- Running two threads $BMDIR prefetch on 2 machines ---------- "
+  run 10 2 $PREFETCH2 
 
-  echo "---------- Running remote $BMDIR non-prefetch 1 thread 2 machines ---------- "
-  run 1 1 $NONPREFETCH
-  echo "---------- Running remote $BMDIR prefetch 1 thread 2 machines ---------- "
-  run 1 1 $PREFETCH
+  echo "---------- Running three threads $BMDIR non-prefetch on 3 machines ---------- "
+  run 10 3 $NONPREFETCH3 
+  echo "---------- Running three threads $BMDIR prefetch on 3 machines ---------- "
+  run 10 3 $PREFETCH3 
 
-  echo "---------- Running remote $BMDIR non-prefetch 2 machines ---------- "
-  run 1 2 $NONPREFETCH2 
-  echo "---------- Running remote $BMDIR prefetch 2 machines ---------- "
-  run 1 2 $PREFETCH2 
+  echo "---------- Running four threads $BMDIR non-prefetch on 4 machines ---------- "
+  run 10 4 $NONPREFETCH4 
+  echo "---------- Running four threads $BMDIR prefetch on 4 machines ---------- "
+  run 10 4 $PREFETCH4 
 
-  echo "---------- Running remote $BMDIR non-prefetch 4 machines ---------- "
-  run 1 4 $NONPREFETCH4 
-  echo "---------- Running remote $BMDIR prefetch 4 machines ---------- "
-  run 1 4 $PREFETCH4 
   cd $TOPDIR
 }
 
-benchmarks='MatrixMultiply JGFSORBenchSizeA Em3d'
+function callmicrorun {
+  PREFETCH=${BENCHMARK}1.bin
+  NONPREFETCH=${BENCHMARK}1NP.bin
+  cd $BMDIR 
+  echo "---------- Running local $BMDIR non-prefetch on 1 machine ---------- "
+  localrun 10
+  echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- "
+  oneremote 10 1 $NONPREFETCH
+  echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- "
+  oneremote 10 1 $PREFETCH
+  cd $TOPDIR
+}
+
+benchmarks='array chase mmver200 mmver600 em3dver40001303 sorverA'
 
 echo "---------- Clean old files ---------- "
 rm runlog/*
@@ -94,8 +130,25 @@ do
   BMDIR=`echo $bm | cut -f2 -d":"`
   ARGS1=`echo $bm | cut -f3 -d":"`
   ARGS2=`echo $bm | cut -f4 -d":"`
-  ARGS4=`echo $bm | cut -f5 -d":"`
+  ARGS3=`echo $bm | cut -f5 -d":"`
+  ARGS4=`echo $bm | cut -f6 -d":"`
+  EXTENSION=`echo $bm | cut -f7 -d":"`
+  name1='array'
+  name2='chase'
+  if [ $b == $name1 ] || [ $b == $name2 ]; then
+  callmicrorun
+  else
   callrun
+  fi
+done
+
+#----------Calulates  the averages ----------- 
+for file in `ls runlog/*.txt`
+do
+  echo -n $file >> average.txt
+  cat $file | awk '{sum += $1} END {print " "sum/NR}' >> average.txt
 done
+echo "===========" >> average.txt
+echo "" >> average.txt
 
 echo "done"