Debian Codegraph @

bin/jube-autorun

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # JUBE Benchmarking Environment
4 # Copyright (C) 2008-2024
5 # Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre
6 # http://www.fz-juelich.de/jsc/jube
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 OUTPUT_FILE=jube_job_output.txt
22 ONLY_RESULT_OUTPUT=0
23 PROGRESS_INTERVAL=30
24
25 # Remove existing output file
26 if [ -f $OUTPUT_FILE ]
27 then
28 rm $OUTPUT_FILE
29 fi
30
31 function print_usage () {
32 echo "usage: ${0##*/} [OPTIONS] BENCHMARK_CONFIG_FILE"
33 echo "This script automates full benchmark execution, including"
34 echo "steps the run asynchronously, e.g. in a batch system."
35 echo ""
36 echo "Options:"
37 echo " -r ARG additional run args"
38 echo " -c ARG additional continue args"
39 echo " -a ARG additional analyse args"
40 echo " -s ARG additional result args"
41 echo " -p ARG progress check interval in seconds (default:30)"
42 echo " -o only show result output"
43 echo "Example: ${0##*/} input_file.xml"
44 }
45
46 # Parse optional arguments
47 while getopts r:c:a:s:p:o OPT; do
48 case $OPT in
49 r) RUN_ARG="$OPTARG";;
50 c) CONTINUE_ARG="$OPTARG";;
51 a) ANALYSE_ARG="$OPTARG";;
52 s) RESULT_ARG="$OPTARG";;
53 p) PROGRESS_INTERVAL="$OPTARG";;
54 o) ONLY_RESULT_OUTPUT=1;;
55 *)
56 print_usage
57 exit 2
58 esac
59 done
60 shift $(( OPTIND - 1 ))
61 OPTIND=1
62
63 # check if input file exists
64 if [ $# -lt 1 ]
65 then
66 echo "$0: missing argument"
67 print_usage
68 exit 1
69 fi
70
71 # start benchmark execution
72 if [ $ONLY_RESULT_OUTPUT -eq 1 ]
73 then
74 jube --force run $1 --hide-animation $RUN_ARG 2>&1 >> $OUTPUT_FILE
75 else
76 jube --force run $1 --hide-animation $RUN_ARG 2>&1 | tee -a $OUTPUT_FILE
77 fi
78
79 # extract benchmark dir
80 BENCHMARK_DIR=`egrep -o 'handle: .+$' jube_job_output.txt | cut -c9-`
81
82 # BENCHMARK_DIR must exist
83 if [ ! -d "$BENCHMARK_DIR" ]
84 then
85 exit 1
86 fi
87
88 # continue benchmark execution
89 while [ `jube status $BENCHMARK_DIR` = "RUNNING" ]
90 do
91 sleep $PROGRESS_INTERVAL
92 if [ $ONLY_RESULT_OUTPUT -eq 1 ]
93 then
94 jube --force continue $BENCHMARK_DIR --hide-animation $CONTINUE_ARG 2>&1 >> $OUTPUT_FILE
95 else
96 echo "Update benchmark information (`date`)"
97 jube --force continue $BENCHMARK_DIR --hide-animation --id last $CONTINUE_ARG | tee -a $OUTPUT_FILE
98 fi
99 done
100
101 # benchmark analyse
102 if [ $ONLY_RESULT_OUTPUT -eq 1 ]
103 then
104 jube --force analyse $BENCHMARK_DIR --id last $ANALYSE_ARG 2>&1 >> $OUTPUT_FILE
105 else
106 jube --force analyse $BENCHMARK_DIR --id last $ANALYSE_ARG | tee -a $OUTPUT_FILE
107 fi
108
109 # create benchmark result
110 jube --force result $BENCHMARK_DIR --id last $RESULT_ARG 2>&1 | tee -a $OUTPUT_FILE