-
Notifications
You must be signed in to change notification settings - Fork 8
291 lines (250 loc) · 11.5 KB
/
ci.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
---
name: CI
on:
push:
branches-ignore:
- classic*
schedule:
- cron: 0 13 * * 1
workflow_dispatch:
# pull_request:
# branches-ignore:
# - classic*
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:detect_leaks=0
jobs:
testmodels:
strategy:
matrix:
os: [ubuntu-24.04]
testmode: [OFF, ON]
testname:
[
classicmode_1d_3dgrid,
classicmode_3d,
kilonova_1d_1dgrid,
kilonova_1d_3dgrid,
kilonova_2d_2dgrid,
kilonova_2d_2dgrid_barnesthermalisation,
kilonova_2d_2dgrid_expansionopac,
kilonova_2d_2dgrid_xcomgammaphotoion,
kilonova_2d_3dgrid,
nebular_1d_3dgrid,
nebular_1d_3dgrid_limitbfest,
]
exclude:
- os: self-hosted
testmode: ON
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 120
name: ${{ matrix.testname }}${{ matrix.testmode == 'ON' && ' testmode ON' || ''}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gcc-14
if: always()
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 14
- name: install gsl and openmpi
run: |
sudo apt-get update
sudo apt install -y libgsl-dev
sudo apt install -y openmpi-bin libopenmpi-dev
- name: CPU type and core count
id: cpu-count
run: |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3
#python3 -m pip install psutil
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")'
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")'
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT
# cache this for classic options because the super low integration tolerance makes generation of the file very slow
- name: Cache ratecoeff.dat
if: ${{ startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
with:
path: tests/${{ matrix.testname }}_testrun/ratecoeff.dat
key: tests/${{ matrix.testname }}_testrun/ratecoeff.dat-${{ github.run_id }}
restore-keys: |
tests/${{ matrix.testname }}_testrun/ratecoeff.dat-
- name: Cache test atomic data
if: ${{ !startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
id: cache-testatomicdata
with:
path: tests/atomicdata_feconi.tar.xz
key: tests/atomicdata_feconi.tar.xz
- name: Cache test atomic data classic
if: ${{ startsWith(matrix.testname, 'classicmode') }}
uses: actions/cache@v4
id: cache-testatomicdata-classic
with:
path: tests/atomicdata_classic.tar.xz
key: tests/atomicdata_classic.tar.xz
- name: Download/extract test data
working-directory: tests/
run: |
source ./setup_${{ matrix.testname }}.sh
- name: cat artisoptions.h
run: |
cp tests/${{ matrix.testname }}_testrun/artisoptions.h .
cat artisoptions.h
- name: Compile
run: |
make REPRODUCIBLE=ON TESTMODE=${{ matrix.testmode }} MPI=ON MAX_NODE_SIZE=2 FASTMATH=OFF -j${{ steps.cpu-count.outputs.count }} sn3d exspec
cp sn3d tests/${{ matrix.testname }}_testrun/
cp exspec tests/${{ matrix.testname }}_testrun/
- name: Run test job0 start
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
cp input-newrun.txt input.txt
touch output_0-0.txt
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d
- name: Move job0 files
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
mkdir job0
../../scripts/movefiles.sh job0
- name: cat job0 estimators
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job0/estimators*.out
- name: cat job0 output log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job0/output_0-0.txt
- name: Checksum job0 output files
#if: always()
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun
run: |
md5sum *.out job0/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_job0.txt
if [ -f results_md5_job0.txt ]; then md5sum -c results_md5_job0.txt; else echo "results_md5_job0.txt not found"; fi
- name: Run test job1 resume
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
cp input-resume.txt input.txt
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d
- name: Move job1 files
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
rm *.tmp
mkdir job1
../../scripts/movefiles.sh job1
- name: cat job1 estimators
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job1/estimators*.out
- name: cat job1 output log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: cat job1/output_0-0.txt
- name: Set up Python
if: always() && matrix.testmode == 'OFF'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install artistools
if: always() && matrix.testmode == 'OFF'
run: |
python3 -m pip install --upgrade pip uv
uv pip install --system -U artistools
- name: show deposition.out
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
echo -e "import artistools as at; import polars as pl;\nwith pl.Config(tbl_rows=-1,tbl_cols=-1,tbl_width_chars=300,tbl_formatting='NOTHING'):\n df = at.get_deposition('.')\n print(df.select(['timestep', 'tmid_days'] + [c for c in sorted(df.columns, key=lambda x: x.lower().lstrip('eps_')) if c not in ['timestep', 'tmid_days', 'tmid_s']]))" | python3 -
cat deposition.out
- name: Run exspec
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
time mpirun -np 1 ./exspec
python3 ../../scripts/mergeangleres.py
rm -f light_curve_res_*.out spec_res_*.out specpol_res_*.out
- name: cat exspec log
if: always()
working-directory: tests/${{ matrix.testname }}_testrun/
run: |
mkdir output
cat exspec.txt
- name: Checksum job1 output files
#if: always()
if: always() && matrix.testmode == 'OFF'
working-directory: tests/${{ matrix.testname }}_testrun
run: |
md5sum *.out job1/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_final.txt
if [ -f results_md5_final.txt ]; then md5sum -c results_md5_final.txt; else echo "results_md5_final.txt not found"; fi
- name: Prepare for next steps
if: always()
working-directory: tests/${{ matrix.testname }}_testrun
run: |
touch requirements.txt
find . -name "*_res_*.out" -exec zstd -v -T0 --rm -f {} \;
- name: Upload output files
uses: actions/upload-artifact@v4
if: always() && matrix.testmode == 'OFF'
with:
name: test-${{ matrix.testname }}-output
path: tests/${{ matrix.testname }}_testrun
- name: Upload checksum files
uses: actions/upload-artifact@v4
if: always() && matrix.testmode == 'OFF'
with:
name: ${{ matrix.testname }}_inputfiles
path: tests/${{ matrix.testname }}_inputfiles/results_md5*
- name: Plot light curve
if: always() && matrix.testmode == 'OFF'
working-directory: tests/
run: |
at plotlightcurves ${{ matrix.testname }}_testrun
at plotlightcurves --frompackets ${{ matrix.testname }}_testrun
- name: Plot spectrum nebular
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'nebular')
working-directory: tests/
run: |
at plotspectra --frompackets -ts 8 ${{ matrix.testname }}_testrun
- name: Plot spectrum classicmode
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_')
working-directory: tests/
run: |
at plotspectra --frompackets -t 4-6 ${{ matrix.testname }}_testrun
- name: Plot virtual packet spectrum classicmode_1d
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_1d')
working-directory: tests/
run: |
at plotspectra -t 4-6 -plotvspecpol 0 1 2 3 12 13 14 --frompackets ${{ matrix.testname }}_testrun
- name: Plot spectrum kilonova
if: always() && matrix.testmode == 'OFF' && startsWith(matrix.testname, 'kilonova')
working-directory: tests/
run: |
at plotspectra --frompackets -t 2 ${{ matrix.testname }}_testrun
- name: Upload plot files
if: always() && matrix.testmode == 'OFF'
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.testname }}-output-pdf
path: tests/*.pdf
combine_checksums:
needs: testmodels
if: always()
runs-on: ubuntu-24.04
steps:
- name: Download test output
uses: actions/download-artifact@v4
- name: List all files
if: always()
run: find .
- name: Upload bundled checksum files
uses: actions/upload-artifact@v4
with:
name: checksums
path: '*_inputfiles/results_md5*.txt'