-
Notifications
You must be signed in to change notification settings - Fork 3
/
benchmark.sh
executable file
·72 lines (55 loc) · 1.73 KB
/
benchmark.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# This files runs mimd for all the benchmark files
# specified by the input directory
# ./benchmark.sh benchDir qc_graph window_size
# get target directory
if [ "$1" == "" ]; then
echo "Benchmark directory not specified"
echo "usage: ./benchmark.sh benchDir qc_graph window_size "
exit 1
fi
targetDir=$1
echo "Benchmark directory : $targetDir " >>$benchLog
if [ "$2" == "" ]; then
echo "Quantum computer graph not specified"
echo "usage: ./benchmark.sh benchDir qc_graph window_size "
exit 1
fi
if [ "$3" == "" ]; then
echo "window size not specified"
echo "usage: ./benchmark.sh benchDir qc_graph window_size "
exit 1
fi
benchLog="mapper$3.log"
dash="======================================================="
dashSmall="------------------------------------------------------"
# header of benchmark.log
echo "$dash" > $benchLog
echo "Quantum-Chain ToolSuite v1.0" >> $benchLog
echo "Author : Debjyoti Bhattacharjee" >> $benchLog
echo "$dash" >> $benchLog
echo "Benchmarking started at `date`" >> $benchLog
echo "$dashSmall" >> $benchLog
workDir="gen_files"
mkdir -p $workDir
# get list of .real files in target directory
i=0
benchfiles="`ls -Sr ${targetDir}*.real`"
echo $benchfiles
for file1 in $benchfiles
do
echo "Mapping $file1 $2" >> $benchLog
echo "Starting at `date`" >> $benchLog
python3 qchain.py $file1 $2 $3
echo "Completed at `date`" >> $benchLog
i=$((i+1))
done
if [ "$i" == "0" ]; then
echo "Error : .real files not found in target directory" >> $benchLog
echo "Exiting... " >> $benchLog
exit 1
fi
echo "" >> $benchLog
echo "$dash" >> $benchLog
echo "Benchmarking completed at `date`" >> $benchLog
echo "$dash" >> $benchLog