+#!/bin/bash
+# run as the following:
+# ./runbench.sh [hexiom] [timeout] [tuner.conf]
+# ./runbench.sh [nqueens] [timeout] [tuner.conf]
+# ./runbench.sh [sudoku-csolver] [timeout] [tuner.conf]
+# ./runbench.sh [killerSudoku] [timeout] [tuner.conf]
+
+if [ "$#" -lt 1 ]; then
+ echo "Illegal number of argument"
+ echo "./runbench.sh [tuner.conf] [benchmark]"
+ exit 1
+fi
+
+SATUNE=/scratch/hamed/constraint_compiler/src
+BIN=$SATUNE/bin
+export CLASSPATH=$BIN/original.jar:$SATUNE:$CLASSPATH
+export LD_LIBRARY_PATH=$BIN
+# For Mac OSX
+export DYLD_LIBRARY_PATH=$BIN
+# For sat_solver
+export PATH=$SATUNE:$PATH
+
+
+maxtime=1800
+DUMPDIR=/scratch/hamed/end-to-end/dirk-new/dumps/
+cd $DUMPDIR
+
+DUMP=$(find . -name "*.dump")
+cd ..
+for d in $DUMP; do
+ if [[ $d = *$2* ]]; then
+ echo "Running: ./run.sh tunerrun "$DUMPDIR"$d $maxtime $1 out.out"
+ timeout $maxtime $BIN/tunerrun "$DUMPDIR"$d $maxtime $1 out.out
+ RETCODE=$?
+ echo "Return code: $RETCODE"
+ if [ $RETCODE -eq 141 ]; then #Dump info when SAT Solver gets killed by OS ....
+ echo "Satune got out of memory"
+ echo "deserializing $d ..."
+ echo "SAT Solving time: 400000000.0"
+ echo "CSOLVER solve time: 400000000.0"
+ fi
+ echo "Best tuner"
+ fi
+done