-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_exp.sh
executable file
·52 lines (43 loc) · 1.28 KB
/
run_exp.sh
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
#!/bin/bash
set -e
mem=10g
sleep=5s
version=1.0.0
date=`date +%Y-%m-%d-%H-%M`
SCRIPT_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
DIR=$SCRIPT_DIR/$1
DIRNAME=`basename $DIR`
basepath=$SCRIPT_DIR/results/$DIRNAME/$date-$mem-v$version
mkdir -p $basepath
if [[ -e $SCRIPT_DIR/config.properties ]]; then
cp $SCRIPT_DIR/config.properties $basepath
else
echo "config.properties file is missing"
exit 1
fi
# copy the Jar file in the local directory
cp $SCRIPT_DIR/../gsat-core/target/guarded-saturation-$version-jar-with-dependencies.jar .
for filename in $DIR/*.dlgp
do
cd $basepath
basenameF=$(basename "$filename" .dlgp)
echo "Testing $basenameF - $mem"
rm -f "$basenameF.log"
{ # try
CMD="java -Xmx$mem -jar $SCRIPT_DIR/guarded-saturation-$version-jar-with-dependencies.jar dlgp $filename"
echo $CMD
time $CMD &> "$basenameF.log"
} || {
# catch
if [[ $? == 124 ]]; then
echo "\n\n!!! TIME OUT !!!" >> "$basepath/$basenameF.log"
echo "TIME OUT"
else
echo "\n\n!!! ERROR !!!" >> "$basepath/$basenameF.log"
echo "ERROR"
fi
}
echo "Sleeping for $sleep..."
sleep $sleep
done
echo "\nFind the results in "$basepath