-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalizeGrOptics
More file actions
executable file
·97 lines (78 loc) · 2.41 KB
/
analizeGrOptics
File metadata and controls
executable file
·97 lines (78 loc) · 2.41 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
set -o errexit # abort on nonzero exitstatus
set -o pipefail # don't hide errors within pipes
# shellcheck disable=SC1091
source "util.sh"
atm="winter"
zenith="20"
wobble="0.25"
n_min=0 # min run
n_max=100000 # max run (100000)
# shellcheck disable=SC2068
collect_arguments 4 atm zenith wobble n_max $@
all_n=$(seq "${n_min}" "${n_max}")
atm=$(validate_atm "${atm}")
zenith=$(validate_zenith "${zenith}")
wobble=$(validate_wobble "${wobble}")
bad_runs="lists/gro_runs_Zd${zenith}_${atm}_wobble${wobble}_bad.lis"
true > "${bad_runs}"
bad_files="lists/corsika_bad_files_Zd${zenith}_${atm}_wobble${wobble}.lis"
true > "${bad_files}"
sec_list=""
size_list=""
sec_file="time.lis"
true > "${sec_file}"
size_file="size.lis"
true > "${size_file}"
for i in ${all_n}; do
run=$(compute_run "${zenith}" "${i}")
gro_file=$(groptics_file "${run}" "${zenith}" "${atm}" "${wobble}")
if [ ! -f "${gro_file}" ]; then
printf "Not found file: %s\n" "${run}"
echo "${run}" >> "${bad_runs}"
fi
log_out=$(groptics_log "${run}" "${zenith}" "${atm}" "${wobble}" "out")
if [ -f "${log_out}" ]; then
prob_runs=$(grep "Problem to unzip file run:" "${log_out}" | awk '{print $NF}' || true)
if [ "${prob_runs}" != "" ]; then
for r in ${prob_runs}; do
echo "Bad unzipping " "${r}"
echo "${prob_runs}" >> "${bad_files}"
done
fi
sec=$(grep "Seconds:" "${log_out}" | awk '{print $NF}' || true)
size=$(grep "CORSIKA size:" "${log_out}" | awk '{print $NF}' || true)
total_size="0"
for s in $size; do
total_size=$(( total_size + s ))
done
if [ "${sec}" != "" ]; then
sec_list="$sec_list $sec"
echo "${sec}" >> "${sec_file}"
size_list="$size_list $total_size"
echo "${total_size}" >> "${size_file}"
else
echo "Aborted ${run}"
fi
fi
done
sum=0
n=0
smax=0
smin=10000000000000
for s in ${sec_list}; do
sum=$(( sum + s ))
n=$(( n + 1 ))
smax=$(( smax > s ? smax : s ))
smin=$(( smin > s ? s : smin ))
done
mean=$(( sum / n ))
echo "==========="
printf "Runtime for %s jobs \n" "$n"
printf "Average: "
TZ=UTC0 printf '%(%H:%M:%S)T\n' "$mean"
printf "Min: "
TZ=UTC0 printf '%(%H:%M:%S)T\n' "$smin"
printf "Max: "
TZ=UTC0 printf '%(%H:%M:%S)T\n' "$smax"
echo "==========="