-
Notifications
You must be signed in to change notification settings - Fork 35
113 lines (93 loc) · 4.53 KB
/
burn_cell_metal_chem_new.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: burn_cell_metal_chem
on: [pull_request]
jobs:
burn_cell_metal_chem_1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get AMReX
run: |
mkdir external
cd external
git clone https://github.com/AMReX-Codes/amrex.git
cd amrex
git checkout development
echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV
echo $AMREX_HOME
if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi
cd ../..
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0
- name: Compile and run for Z = 1
run: |
cd unit_test/burn_cell_metal_chem
make -j 2
./main1d.gnu.DEBUG.ex inputs_metal_chem_1 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out
- name: Print backtrace
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }}
run: cat unit_test/burn_cell_metal_chem/Backtrace.0
- name: Compare to stored output at Z = 1
run: |
set -e
cd unit_test/burn_cell_metal_chem
line_numbers=(4461 4463 4465 4467 4468 4471 4472 4475 4481 4486)
threshold=0.01
error_found=false
for line_number in "${line_numbers[@]}"; do
value1=$(awk 'NR=='"$line_number"' {print $0}' test.out)
echo "Line $line_number in test.out: $value1"
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out)
# Adjust the line number for reference_solution_1.0.out
reference_line_number=$((line_number - 24))
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1.out)
difference=$(awk -v val1="$value1" -v val2="$value2" 'BEGIN { printf "%.2f", (val1 - val2) / val2 }')
if (( $(echo "$difference > $threshold" | bc -l) )); then
echo "Line number: $line_number"
echo "Value in test.out: $value1"
echo "Value in reference_solution_1.0.out: $value2"
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold"
echo
error_found=true
fi
done
if [[ $error_found == true ]]; then
exit 1
fi
- name: Compile and run for Z = 1e-6
run: |
cd unit_test/burn_cell_metal_chem
./main1d.gnu.DEBUG.ex inputs_metal_chem_1e-6 amrex.fpe_trap_{invalid,zero,overflow}=1 > test.out
- name: Print backtrace
if: ${{ failure() && hashFiles('unit_test/burn_cell_metal_chem/Backtrace.0') != '' }}
run: cat unit_test/burn_cell_metal_chem/Backtrace.0
- name: Compare to stored output at Z = 1e-6
run: |
set -e
cd unit_test/burn_cell_metal_chem
line_numbers=(4461 4463 4465 4467 4468 4471 4472 4475 4481 4486)
threshold=0.01
error_found=false
for line_number in "${line_numbers[@]}"; do
value1=$(awk 'NR=='"$line_number"' {print $0}' test.out)
echo "Line $line_number in test.out: $value1"
value1=$(awk 'NR=='"$line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH); else print 0}' test.out)
# Adjust the line number for reference_solution_1.0.out
reference_line_number=$((line_number - 24))
value2=$(awk 'NR=='"$reference_line_number"' {match($0, /[+-]?[0-9]+([.][0-9]+)?[eE]?[+-]?[0-9]+/); if (RSTART) print substr($0, RSTART, RLENGTH)}' reference_solution_1e-6.out)
difference=$(awk -v val1="$value1" -v val2="$value2" 'BEGIN { printf "%.2f", (val1 - val2) / val2 }')
if (( $(echo "$difference > $threshold" | bc -l) )); then
echo "Line number: $line_number"
echo "Value in test.out: $value1"
echo "Value in reference_solution_1.0.out: $value2"
echo "Difference between test and reference value is $difference, more than allowed threshold of $threshold"
echo
error_found=true
fi
done
if [[ $error_found == true ]]; then
exit 1
fi