-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprodtest.sh
More file actions
executable file
·77 lines (64 loc) · 2.73 KB
/
prodtest.sh
File metadata and controls
executable file
·77 lines (64 loc) · 2.73 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
# test squaring for a set of matrices already in k2 format
# comparing results with precomputed sha1sum values
# exit immediately on error
set -e
if [ $# -lt 2 ]
then
echo "Usage:"
echo " $0 dir file1 [file2 ...]"
echo
echo "Test squaring with subtinfo, backpointers, and dynamic subtrees"
echo "for file1.k2 file2.k2 ... all from directory dir"
echo "Also compute sha1sums and compare with those in prod.sha1sum"
echo
echo "Sample usage (better with nohup):"
echo " $0 web cnr80k eu80k goo120k"
exit
fi
# get directory
dir=$1
shift 1
echo "Experiment run by $(whoami) at $(date) on $(hostname)"
# compile if necessary
if [ -f Makefile ] || [ -f makefile ]; then
make
fi
# timing command
# timecmd='/usr/bin/time -f"Command: %C\nS:%S U:%U E:%e Mem(kb):%M\n"'
timecmd=/usr/bin/time
tf="Command: %C\nS:%S U:%U E:%e Mem(kb):%M\n"
# compute sa
for f in "$@"
do
echo "====== squaring with dynamic subtrees: $f"
$timecmd -f"$tf" ./k2mult.x -e -q $dir/$f.k2 $dir/$f.k2
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "==== adding subtree information to $f ==="
./k2subtinfo.x $dir/$f.k2
echo "====== squaring with subtree info: $f"
$timecmd -f"$tf" ./k2mult.x -q $dir/$f.k2 $dir/$f.k2 -i $dir/$f.k2.sinfo
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "====== squaring with subtree info + dynamic subtrees: $f"
$timecmd -f"$tf" ./k2mult.x -q $dir/$f.k2 $dir/$f.k2 -i $dir/$f.k2.sinfo
sha1sum --ignore-missing -c $dir/prod.sha1sum
rm -f $dir/$f.k2.sinfo
echo "==== compressing subtrees on $f"
$timecmd -f"$tf" ./k2cpdf.x $dir/$f.k2
echo "====== squaring with compressed subtrees: $f"
$timecmd -f"$tf" ./k2mult.x -q $dir/$f.ck2 $dir/$f.ck2 -I $dir/$f.ck2.p -o $dir/$f.k2.prod
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "====== squaring with compressed subtrees: $f -x option"
$timecmd -f"$tf" ./k2mult.x -qx $dir/$f.ck2 $dir/$f.ck2 -I $dir/$f.ck2.p -o $dir/$f.k2.prodx
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "==== adding subtree information to $f.ck2"
$timecmd -f"$tf" ./k2subtinfo.x $dir/$f.ck2
echo "====== squaring with compressed subtrees + subtree info: $f"
$timecmd -f"$tf" ./k2mult.x -q $dir/$f.ck2 $dir/$f.ck2 -I $dir/$f.ck2.p -i $dir/$f.ck2.sinfo -o $dir/$f.k2.prod
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "====== squaring with compressed subtrees + subtree info + dynamic subtrees:$f"
$timecmd -f"$tf" ./k2mult.x -e -q $dir/$f.ck2 $dir/$f.ck2 -I $dir/$f.ck2.p -i $dir/$f.ck2.sinfo -o $dir/$f.k2.prod
sha1sum --ignore-missing -c $dir/prod.sha1sum
echo "==== deleting $f.k2.prod(x)"
rm -f $dir/$f.k2.prod $dir/$f.k2.prodx $dir/$f.k2.prod $dir/$f.k2.sinfo $dir/$f.ck2 $dir/$f.ck2.p $dir/$f.ck2.sinfo
done