From 608008c89ef4e65d86e46a1b568a69c364442f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 27 Jan 2025 09:17:19 +0100 Subject: [PATCH] CI: Disable building with OpenMP on Apple Silicon Building with OpenMP causes some test failures for macOS on Apple Silicon, see: https://github.com/ElmerCSC/elmerfem/pull/634#issuecomment-2613840076 The affected tests currently are: `H1BasisEvaluation` and `SD_H1BasisEvaluation`. For the time being, disable building with OpenMP on Apple Silicon in CI. OpenMP is needed as a transitional build dependency of the SuiteSparse package from Homebrew. So, also disable building with CHOLMOD. Note that the tests with OpenMP fail for optimization level `-O3` but succeed with `-O2`. --- .github/workflows/build-macos-homebrew.yaml | 37 ++++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-macos-homebrew.yaml b/.github/workflows/build-macos-homebrew.yaml index 0f0b2d3058..0282aff3f8 100644 --- a/.github/workflows/build-macos-homebrew.yaml +++ b/.github/workflows/build-macos-homebrew.yaml @@ -18,12 +18,28 @@ jobs: 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, macos-13] + os: [macos-14] + openmp: [without] + # Building with OpenMP causes some test failures on macOS on Apple + # Silicon. + # The affected tests currently are: H1BasisEvaluation and + # SD_H1BasisEvaluation. + # For the time being, disable building with OpenMP in CI on Apple + # Silicon. + # OpenMP is also needed as a transitional build dependency of the + # SuiteSparse package from Homebrew. + # FIXME: Consider building with OpenMP again when this (potentially + # upstream) issue has been fixed. + include: + - os: macos-13 + openmp: with steps: - name: get CPU information @@ -49,13 +65,14 @@ jobs: brew install --overwrite python@3.12 python@3.13 brew reinstall gcc brew install \ - cmake libomp openblas open-mpi suitesparse \ + cmake openblas open-mpi \ + ${{ matrix.openmp == 'with' && 'libomp suitesparse' || '' }} \ qwt vtk opencascade echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV - name: configure env: - LDFLAGS: -L${{ env.HOMEBREW_PREFIX }}/opt/libomp/lib -lomp + LDFLAGS: ${{ matrix.openmp == 'with' && '-L${{ env.HOMEBREW_PREFIX }}/opt/libomp/lib -lomp' || '' }} run: | mkdir ${GITHUB_WORKSPACE}/build cd ${GITHUB_WORKSPACE}/build @@ -66,17 +83,19 @@ jobs: -DCMAKE_Fortran_COMPILER=gfortran \ -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/usr" \ -DBLA_VENDOR="OpenBLAS" \ - -DCMAKE_PREFIX_PATH="${HOMEBREW_PREFIX}/opt/libomp;${HOMEBREW_PREFIX}/opt/openblas;${HOMEBREW_PREFIX}/opt/qt;${HOMEBREW_PREFIX}/opt/qwt" \ - -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" \ + -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=ON \ + $([ "${{ matrix.openmp }}" == "with" ] && echo "-DWITH_CHOLMOD=ON" || echo "-DWITH_CHOLMOD=OFF") \ -DWITH_ElmerIce=ON \ -DWITH_ELMERGUI=ON \ -DWITH_QT6=ON \