Skip to content

Simplify FE assembly of IncompressibleNSVec to be easier to read and … #2333

Simplify FE assembly of IncompressibleNSVec to be easier to read and …

Simplify FE assembly of IncompressibleNSVec to be easier to read and … #2333

name: build-macos-homebrew
on:
workflow_dispatch:
push:
paths-ignore:
- '**.nix'
- 'flake.lock'
pull_request:
paths-ignore:
- '**.nix'
- 'flake.lock'
concurrency: ci-macos-homebrew-${{ github.ref }}
jobs:
macos-homebrew:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.openmp }} OpenMP)
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
os: [macos-14]
openmp: [with]
# OpenMP was disabled here (2025-01 to 2026-07) because of
# intermittent H1BasisEvaluation/SD_H1BasisEvaluation failures on
# Apple Silicon. Root cause found on the no-threadprivate branch:
# GaussPointsAdapt (fem/src/SolverBasics.F90) kept its p-element
# reference-element flag/order in unsynchronized SAVEd module state,
# read and mutated by concurrent OMP threads calling
# GaussPoints(...,PReferenceElement=.TRUE.). Fixed by
# edcf46029/8cd4edb9b/b7b0d8a14. Re-enabling; watch this leg.
include:
- os: macos-15-intel
openmp: with
steps:
- name: get CPU information
run: |
sysctl hw
sysctl machdep
- name: checkout repository
uses: actions/checkout@v7
- name: install dependencies
# Homebrew's Python conflicts with the Python that comes pre-installed
# on the GitHub runners. Some of the dependencies depend on different
# versions of Homebrew's Python. Enforce using the ones from Homebrew
# to avoid errors on updates.
# See: https://github.com/orgs/Homebrew/discussions/3928
# It looks like "gfortran" isn't working correctly unless "gcc" is
# re-installed.
run: |
brew update
brew install --overwrite python@3.12 python@3.13
brew reinstall gcc
brew install \
cmake openblas open-mpi \
${{ matrix.openmp == 'with' && 'libomp suitesparse' || '' }} \
qwt vtk opencascade expat
echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV
- name: configure
env:
LDFLAGS: ${{ matrix.openmp == 'with' && format('-L{0}/opt/libomp/lib -lomp', env.HOMEBREW_PREFIX) || '' }}
# SD_H1BasisEvaluation and SD_LinearFormsAssembly used to fail on
# macos-15-intel (Intel CPU) at `-O3` (passed at `-O2`): the same
# GaussPointsAdapt SAVE-state race noted above (LinearFormsAssembly
# calls GaussPoints(...,PReferenceElement=.TRUE.) from every OMP
# thread), with -O3 inlining/scheduling changing the odds of hitting
# the race window. Fixed; back to Release/-O3.
run: |
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/usr" \
-DBLA_VENDOR="OpenBLAS" \
-DUSE_MACOS_PACKAGE_MANAGER=OFF \
-DCMAKE_PREFIX_PATH="$( [ "${{ matrix.openmp }}" == "with" ] && echo "${HOMEBREW_PREFIX}/opt/libomp;")${HOMEBREW_PREFIX}/opt/openblas;${HOMEBREW_PREFIX}/opt/qt;${HOMEBREW_PREFIX}/opt/qwt" \
${{ matrix.openmp == 'with'
&& '-DWITH_OpenMP=ON \
-DOpenMP_C_FLAGS="-Xclang -fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include" \
-DOpenMP_CXX_FLAGS="-Xclang -fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include" \
-DOpenMP_Fortran_FLAGS="-fopenmp -I${HOMEBREW_PREFIX}/opt/libomp/include"'
|| '-DWITH_OpenMP=OFF' }} \
-DWITH_LUA=ON \
-DWITH_MPI=ON \
-DMPI_TEST_MAXPROC=2 \
-DWITH_Zoltan=OFF \
-DWITH_Mumps=OFF \
-DWITH_CHOLMOD=${{ matrix.openmp == 'with' && 'ON' || 'OFF' }} \
-DWITH_ElmerIce=ON \
-DWITH_ELMERGUI=ON \
-DWITH_QT6=ON \
-DQWT_INCLUDE_DIR="${HOMEBREW_PREFIX}/opt/qwt/lib/qwt.framework/Headers" \
-DWITH_VTK=ON \
-DEXPAT_INCLUDE_DIR="${HOMEBREW_PREFIX}/opt/expat/include" \
-DWITH_OCC=ON \
-DWITH_MATC=ON \
-DWITH_PARAVIEW=ON \
-DCREATE_PKGCONFIG_FILE=ON \
..
- name: build
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build . -j$(sysctl -n hw.logicalcpu)
- name: install
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --install .
- name: check
id: run-ctest
timeout-minutes: 150
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd ${GITHUB_WORKSPACE}/build
export OMP_NUM_THREADS=1; ctest . \
-LE slow \
--timeout 600
# -j$(sysctl -n hw.logicalcpu) \
- name: re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
timeout-minutes: 60
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd ${GITHUB_WORKSPACE}/build
# get names of failed tests and strip potential "_np*" suffix
failed_tests=($(ctest . -N --rerun-failed | grep -E "Test\s+#.*" | awk '{print $3}' | sed -e 's/_np[0-9]*$//g'))
# remove duplicate test names
unique_failed_tests=($(echo "${failed_tests[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
for test in "${unique_failed_tests[@]}"; do
# check if test is from fem or ElmerIce
if [ -d fem/tests/${test} ]; then
test_root=fem/tests
else
test_root=elmerice/Tests
fi
echo "::group::Content of ${test_root}/${test}"
echo ---- Files ----
ls -Rl ${test_root}/${test}
err_logs=($(ls ${test_root}/${test}/test-stderr*.log 2>/dev/null))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
out_logs=($(ls ${test_root}/${test}/test-stdout*.log 2>/dev/null))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
echo "::endgroup::"
done
echo "::group::Re-run failing tests"
ctest --rerun-failed --output-on-failure --timeout 180 || true
echo "::endgroup::"
echo "::group::Log from these tests"
[ ! -f Testing/Temporary/LastTest.log ] || cat Testing/Temporary/LastTest.log
echo "::endgroup::"