The following instructions show how to install SpECTRE and its dependencies on Apple Silicon Macs. Apple Silicon is an arm64 architecture, in contrast to the x86-64 architecture that SpECTRE usually targets. These instructions will result in an Apple Silicon native build of SpECTRE.
Note
Floating-point exception trapping is not currently supported on Apple Silicon.
0. Install the xcode command-line tools.
Install the xcode command-line tools, which include the clang compiler, etc. Run the following command in the terminal:
xcode-select --install
1. Clone spectre
Clone the SpECTRE repository in a directory of your choice:
Spectre depends on python and some python packages. There are different ways to install an arm64-native python stack. The following instructions show how to do this using the Python 3 interpreter bundled with macOS.
cd $SPECTRE_HOME
# Create a Python environment
python3 -m venv ./env --upgrade-deps
# Activate the Python environment
. ./env/bin/activate
# Install Python packages
pip install -r support/Python/requirements.txt \
-r support/Python/dev_requirements.txt
# Optionally install additional packages you might want, like Jupyter
pip install jupyterlab
3. Install dependencies with Homebrew
Most of spectre's dependencies can be installed using the Homebrew package manager. First, if you haven't already, install Homebrew by following the instructions on the Homebrew homepage. Then, run the following to install a Fortran compiler and other dependencies:
We use OpenBLAS instead of Apple's Accelerate framework here because Accelerate fails to reach the same floating point accuracy as OpenBLAS in some of our tests (specifically partial derivatives).
4. Install remaining dependencies
Here, install the remaining dependencies that cannot be installed with Homebrew. You can install them from source manually, or use the Spack package manager (see below).
Create a build directory in a location of your choice, e.g.
cd $SPECTRE_HOME
mkdir build
cd build
Next, configure SpECTRE using the following CMake command. If you installed dependencies with Spack, you can use spack find -p to retrieve the root directories of the packages and replace them in the command below. You only need to specify LIBXSMM_ROOT and BLAZE_ROOT if you installed those packages yourself above. The option SPECTRE_FETCH_MISSING_DEPS will take care of downloading these if you haven't installed them above.