Skip to content

Commit 343b8ef

Browse files
authored
CI Updates - Include reference comparison (#917)
1 parent 8345ebd commit 343b8ef

File tree

2 files changed

+68
-33
lines changed

2 files changed

+68
-33
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,20 @@ jobs:
205205
matrix:
206206
os: [ubuntu-24.04, macos-latest]
207207
build_type: [Release, Debug]
208+
dim: [2, 3]
208209
include:
209210
- os: macos-latest
210211
install_deps: brew install open-mpi libtool automake ccache
211212
comp: llvm
212213
procs: $(sysctl -n hw.ncpu)
213214
ccache_cache: /Users/runner/Library/Caches/ccache
215+
reference_comparison: ON
214216
- os: ubuntu-24.04
215217
install_deps: sudo apt-get install -y libopenmpi-dev openmpi-bin libtool-bin
216218
comp: gnu
217219
procs: $(nproc)
218220
ccache_cache: ~/.cache/ccache
221+
reference_comparison: OFF
219222
- build_type: Release
220223
ctest_args: -LE no-ci
221224
ccache_size: 250M
@@ -225,6 +228,8 @@ jobs:
225228
exclude:
226229
- os: macos-latest
227230
build_type: Debug
231+
env:
232+
DO_REF_COMPARE: ${{matrix.reference_comparison == 'ON' && github.event_name != 'push'}}
228233
steps:
229234
- name: Clone
230235
uses: actions/checkout@v4
@@ -263,9 +268,9 @@ jobs:
263268
uses: actions/cache@v4
264269
with:
265270
path: ${{matrix.ccache_cache}}
266-
key: ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-${{github.sha}}
271+
key: ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.dim}}-${{matrix.build_type}}-git-${{github.sha}}
267272
restore-keys: |
268-
ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-
273+
ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.dim}}-${{matrix.build_type}}-git-
269274
- name: MASA
270275
run: |
271276
# Install MetaPhysicL
@@ -288,32 +293,27 @@ jobs:
288293
make install
289294
- name: Configure
290295
run: |
291-
(for DIM in 2 3; do \
292-
printf "\n-------- Configuring ${DIM}D --------\n"; \
293-
cmake -B${{runner.workspace}}/build-${DIM}d-${{matrix.os}}-${{matrix.build_type}} \
294-
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${DIM}d-${{matrix.os}}-${{matrix.build_type}} \
295-
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
296-
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
297-
-DPELE_DIM:STRING=${DIM} \
298-
-DPELE_ENABLE_MPI:BOOL=ON \
299-
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
300-
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
301-
-DPELE_ENABLE_MASA:BOOL=ON \
302-
-DPELE_EXCLUDE_BUILD_IN_CI:BOOL=ON \
303-
-DMASA_ROOT:PATH=${{runner.workspace}}/deps/install/MASA \
304-
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
305-
${{github.workspace}}; \
306-
if [ $? -ne 0 ]; then exit 1; fi \
307-
done)
296+
cmake -B${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}} \
297+
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}} \
298+
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
299+
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
300+
-DPELE_DIM:STRING=${{matrix.dim}} \
301+
-DPELE_ENABLE_MPI:BOOL=ON \
302+
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
303+
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
304+
-DPELE_ENABLE_MASA:BOOL=ON \
305+
-DPELE_SAVE_GOLDS:BOOL=${{matrix.reference_comparison}} \
306+
-DPELE_SAVED_GOLDS_DIRECTORY=${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}} \
307+
-DPELE_EXCLUDE_BUILD_IN_CI:BOOL=ON \
308+
-DMASA_ROOT:PATH=${{runner.workspace}}/deps/install/MASA \
309+
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
310+
${{github.workspace}}
308311
- name: Build
309312
run: |
310313
ccache -z
311-
(for DIM in 2 3; do \
312-
printf "\n-------- Building ${DIM}D --------\n"; \
313-
cmake --build ${{runner.workspace}}/build-${DIM}d-${{matrix.os}}-${{matrix.build_type}} \
314-
--parallel ${{env.NPROCS}} 2>&1 | tee -a ${{runner.workspace}}/build-output.txt; \
315-
if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi \
316-
done)
314+
cmake --build ${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}} \
315+
--parallel ${{env.NPROCS}} 2>&1 | tee -a ${{runner.workspace}}/build-output.txt; \
316+
if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi \
317317
- name: Ccache Report
318318
run: |
319319
ccache -s
@@ -329,13 +329,48 @@ jobs:
329329
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings.txt | awk '{print $2}')
330330
exit ${return}
331331
- name: Test
332-
run: |
333-
(for DIM in 2 3; do \
334-
printf "\n-------- Testing ${DIM}D --------\n"; \
335-
cd ${{runner.workspace}}/build-${DIM}d-${{matrix.os}}-${{matrix.build_type}}; \
336-
ctest ${{matrix.ctest_args}} -VV --output-on-failure; \
337-
if [ $? -ne 0 ]; then exit 1; fi \
338-
done)
332+
working-directory: ${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}}
333+
run: |
334+
ctest ${{matrix.ctest_args}} -VV --output-on-failure
335+
- name: Checkout Reference Version
336+
if: env.DO_REF_COMPARE == 'true'
337+
run : |
338+
git remote add amrexcomb https://github.com/AMReX-Combustion/PeleC.git
339+
git fetch amrexcomb development --depth=1
340+
git checkout amrexcomb/development
341+
git submodule update --recursive --depth=1
342+
- name: Configure Reference Version
343+
if: env.DO_REF_COMPARE == 'true'
344+
run : |
345+
cmake -B${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}}-reference \
346+
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}}-reference \
347+
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
348+
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
349+
-DPELE_DIM:STRING=${{matrix.dim}} \
350+
-DPELE_ENABLE_MPI:BOOL=ON \
351+
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
352+
-DPELE_ENABLE_FCOMPARE:BOOL=ON \
353+
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=ON \
354+
-DPELE_REFERENCE_GOLDS_DIRECTORY:STRING=${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}} \
355+
-DPELE_ENABLE_MASA:BOOL=ON \
356+
-DPELE_EXCLUDE_BUILD_IN_CI:BOOL=ON \
357+
-DMASA_ROOT:PATH=${{runner.workspace}}/deps/install/MASA \
358+
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
359+
${{github.workspace}}
360+
- name: Build Reference Version
361+
if: env.DO_REF_COMPARE == 'true'
362+
run : |
363+
ccache -z
364+
cmake --build ${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}}-reference \
365+
--parallel ${{env.NPROCS}}
366+
ccache -s
367+
du -hs ${{matrix.ccache_cache}}
368+
- name: Test Reference and Compare
369+
if: env.DO_REF_COMPARE == 'true'
370+
working-directory: ${{runner.workspace}}/build-${{matrix.dim}}d-${{matrix.os}}-${{matrix.build_type}}-reference
371+
run : |
372+
ctest ${{matrix.ctest_args}} -VV --output-on-failure
373+
339374
GPU-Nvidia:
340375
name: GPU-CUDA
341376
needs: [Formatting, CPU-GNUmake]

Tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ macro(setup_test)
5757

5858
# Set some default runtime options for all tests
5959
set(RUNTIME_OPTIONS "amr.checkpoint_files_output=0 amrex.the_arena_is_managed=0")
60-
if(PELE_ENABLE_FCOMPARE_FOR_TESTS)
60+
if(PELE_ENABLE_FCOMPARE_FOR_TESTS OR PELE_SAVE_GOLDS)
6161
set(RUNTIME_OPTIONS "${RUNTIME_OPTIONS} amr.plot_files_output=1 amr.plot_int=10 amr.plot_file=plt")
6262
else()
6363
set(RUNTIME_OPTIONS "${RUNTIME_OPTIONS} amr.plot_files_output=0")

0 commit comments

Comments
 (0)