Skip to content

Commit

Permalink
Upgrade macOS CI to Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsvu committed Jun 21, 2024
1 parent 2f3b7a5 commit e806e81
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
62 changes: 40 additions & 22 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ jobs:
run: |
apt-get install -y libopenmpi-dev
cd /work/charm_7_0_0 && ./build charm++ mpi-linux-x86_64-smp clang \
-j4 -g0 -O1 --build-shared --with-production
-j ${NUMBER_OF_CORES} -g0 -O1 --build-shared --with-production
# Assign a unique cache key for every run.
# - We will save the cache using this unique key, but only on the develop
Expand Down Expand Up @@ -867,17 +867,25 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
# Build all test executables and run unit tests on macOS
unit_tests_macos:
name: Unit tests on macOS
runs-on: macos-13
strategy:
fail-fast: false
matrix:
include:
# The number of cores is given at:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
- macos-version: 13 # Intel
NUM_CORES: 4
- macos-version: 14 # Apple Silicon
NUM_CORES: 3
runs-on: macos-${{ matrix.macos-version }}
env:
# We install some low-level dependencies with Homebrew. They get picked up
# by `spack external find`.
SPECTRE_BREW_DEPS: >- # Line breaks are spaces, no trailing newline
autoconf automake catch2 ccache cmake pkg-config boost
autoconf automake boost catch2 ccache cmake gsl hdf5 openblas yaml-cpp
# We install these packages with Spack and cache them. The full specs are
# listed in support/DevEnvironments/spack.yaml. This list is only needed
# to create the cache.
SPECTRE_SPACK_DEPS: >-
blaze charmpp gsl hdf5 libxsmm openblas yaml-cpp
# listed below. This list is only needed to create the cache.
SPECTRE_SPACK_DEPS: blaze charmpp libxsmm
CCACHE_DIR: $HOME/ccache
CCACHE_TEMPDIR: $HOME/ccache-tmp
CCACHE_MAXSIZE: "2G"
Expand All @@ -886,6 +894,7 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
CCACHE_COMPILERCHECK: content
SPACK_SKIP_MODULES: true
SPACK_COLOR: always
NUM_CORES: ${{ matrix.NUM_CORES }}
steps:
- name: Record start time
id: start
Expand All @@ -895,7 +904,7 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
- name: Install Homebrew dependencies
run: |
brew install $SPECTRE_BREW_DEPS
Expand All @@ -904,17 +913,22 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
- name: Restore dependency cache
uses: actions/cache/restore@v4
id: restore-dependencies
env:
CACHE_KEY_PREFIX: "dependencies-macos-${{ matrix.macos-version }}"
with:
path: ~/dependencies
key: "dependencies-macos-${{ github.run_id }}"
key: "${{ env.CACHE_KEY_PREFIX }}-${{ github.run_id }}"
restore-keys: |
dependencies-macos-
${{ env.CACHE_KEY_PREFIX }}-
- name: Install Spack
# Pin a specific version of Spack to avoid breaking CI builds when
# Spack changes.
run: |
cd $HOME
git clone -c feature.manyFiles=true --depth=1 \
--branch releases/v0.18 --single-branch \
git clone -c feature.manyFiles=true \
https://github.com/spack/spack.git
cd spack
git checkout 7d1de58378fa210b7db887964fcc17187a504ad8
- name: Configure Spack
# - To avoid re-building packages that are already installed by Homebrew
# we let Spack find them.
Expand All @@ -923,7 +937,7 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
source $HOME/spack/share/spack/setup-env.sh
spack debug report
spack compiler find && spack compiler list
spack external find && spack external find perl python
spack external find
spack config get packages
spack mirror add dependencies file://$HOME/dependencies/spack
# Install the remaining dependencies from source with Spack. We install
Expand All @@ -932,9 +946,12 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
- name: Install Spack dependencies
run: |
source $HOME/spack/share/spack/setup-env.sh
spack env create spectre support/DevEnvironments/spack.yaml
spack env create spectre
spack env activate spectre
spack remove catch2 doxygen jemalloc boost
spack add blaze@3.8.2 ~blas ~lapack smp=none
spack add charmpp@7.0.0 +shared backend=multicore build-target=charm++
# Use main branch until spack has 2.0 release
spack add libxsmm@main
spack concretize --reuse
spack install --no-check-signature
spack find -v
Expand Down Expand Up @@ -972,11 +989,13 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
- name: Restore ccache
uses: actions/cache/restore@v4
id: restore-ccache
env:
CACHE_KEY_PREFIX: "ccache-macos-${{ matrix.macos-version }}"
with:
path: ~/ccache
key: "ccache-macos-${{ github.run_id }}"
key: "${{ env.CACHE_KEY_PREFIX }}-${{ github.run_id }}"
restore-keys: |
ccache-macos-
${{ env.CACHE_KEY_PREFIX }}-
- name: Configure ccache
run: |
ccache -pz
Expand All @@ -1001,11 +1020,12 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
-D CMAKE_CXX_COMPILER=clang++ \
-D CMAKE_Fortran_COMPILER=gfortran-11 \
-D CMAKE_CXX_FLAGS="-Werror" \
-D OVERRIDE_ARCH=x86-64 \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_PYTHON_BINDINGS=ON \
-D MEMORY_ALLOCATOR=SYSTEM \
-D CHARM_ROOT=$(spack location --install-dir charmpp) \
-D BLAS_ROOT=$(brew --prefix openblas) \
-D LAPACK_ROOT=$(brew --prefix openblas) \
-D CMAKE_BUILD_TYPE=Debug \
-D DEBUG_SYMBOLS=OFF \
-D UNIT_TESTS_IN_TEST_EXECUTABLES=OFF \
Expand All @@ -1020,10 +1040,8 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
$GITHUB_WORKSPACE
- name: Build unit tests
working-directory: build
# Build on 4 threads because GitHub's macOS VMs have 4 cores:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
run: |
make -j4 unit-tests
make -j${NUM_CORES} unit-tests
- name: Build executables
working-directory: build
run: |
Expand Down Expand Up @@ -1051,7 +1069,7 @@ ${{ matrix.build_type }}-pch-${{ matrix.use_pch || 'ON' }}"
- name: Run unit tests
working-directory: build
run: |
ctest -j4 --repeat after-timeout:3 --output-on-failure
ctest -j${NUM_CORES} --repeat after-timeout:3 --output-on-failure
- name: Install
working-directory: build
run: |
Expand Down
3 changes: 1 addition & 2 deletions src/Utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ target_link_libraries(
# As of Sep 1, 2023 libxsmm has an issue with lldb on ARM Macs (detecting
# the CPU architecture raises SIGILL signals when loading the libxsmm dynamic
# library). Just not linking libxsmm in Debug mode works around that.
if (NOT SPECTRE_DEBUG
OR NOT (APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64"))
if (NOT (SPECTRE_DEBUG AND APPLE))
target_link_libraries(
${LIBRARY}
PUBLIC
Expand Down
4 changes: 2 additions & 2 deletions support/DevEnvironments/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

spack:
specs:
- blaze@3.8
- 'blaze@3.8:3.8'
- 'boost@1.60:+math+program_options'
- 'catch2@3.4.0:3'
# Charm++:
Expand All @@ -57,7 +57,7 @@ spack:
- 'libxsmm@1.16.1:'
- openblas
- 'python@3.8:'
- yaml-cpp@0.6.3
- 'yaml-cpp@0.6.3:'
concretizer:
unify: true
view: true

0 comments on commit e806e81

Please sign in to comment.