Debian Codegraph @

bin/jube-autorun

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/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 [scip-shell system . . `[`. -f $OUTPUT_FILE ]
27 then
28 rmscip-shell system . . rm. $OUTPUT_FILE
29 fi
30
31 function print_usagescip-shell shell shell-project 0.0.0 print_usage(). () {
32 echoscip-shell system . . echo. "usage: ${0##*/} [OPTIONS] BENCHMARK_CONFIG_FILE"
33 echoscip-shell system . . echo. "This script automates full benchmark execution, including"
34 echoscip-shell system . . echo. "steps the run asynchronously, e.g. in a batch system."
35 echoscip-shell system . . echo. ""
36 echoscip-shell system . . echo. "Options:"
37 echoscip-shell system . . echo. " -r ARG additional run args"
38 echoscip-shell system . . echo. " -c ARG additional continue args"
39 echoscip-shell system . . echo. " -a ARG additional analyse args"
40 echoscip-shell system . . echo. " -s ARG additional result args"
41 echoscip-shell system . . echo. " -p ARG progress check interval in seconds (default:30)"
42 echoscip-shell system . . echo. " -o only show result output"
43 echoscip-shell system . . 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_usagescip-shell shell shell-project 0.0.0 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 [scip-shell system . . `[`. $# -lt 1 ]
65 then
66 echoscip-shell system . . echo. "$0: missing argument"
67 print_usagescip-shell shell shell-project 0.0.0 print_usage().
68 exit 1
69 fi
70
71 # start benchmark execution
72 if [scip-shell system . . `[`. $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 | teescip-shell system . . tee. -a $OUTPUT_FILE
77 fi
78
79 # extract benchmark dir
80 BENCHMARK_DIR=`egrepscip-shell system . . egrep. -o 'handle: .+$' jube_job_output.txt | cutscip-shell system . . cut. -c9-`
81
82 # BENCHMARK_DIR must exist
83 if [scip-shell system . . `[`. ! -d "$BENCHMARK_DIR" ]
84 then
85 exit 1
86 fi
87
88 # continue benchmark execution
89 while [scip-shell system . . `[`. `jube status $BENCHMARK_DIR` = "RUNNING" ]
90 do
91 sleepscip-shell system . . sleep. $PROGRESS_INTERVAL
92 if [scip-shell system . . `[`. $ONLY_RESULT_OUTPUT -eq 1 ]
93 then
94 jube --force continue $BENCHMARK_DIR --hide-animation $CONTINUE_ARG 2>&1 >> $OUTPUT_FILE
95 else
96 echoscip-shell system . . echo. "Update benchmark information (`datescip-shell system . . date.`)"
97 jube --force continue $BENCHMARK_DIR --hide-animation --id last $CONTINUE_ARG | teescip-shell system . . tee. -a $OUTPUT_FILE
98 fi
99 done
100
101 # benchmark analyse
102 if [scip-shell system . . `[`. $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 | teescip-shell system . . tee. -a $OUTPUT_FILE
107 fi
108
109 # create benchmark result
110 jube --force result $BENCHMARK_DIR --id last $RESULT_ARG 2>&1 | teescip-shell system . . tee. -a $OUTPUT_FILE