Someone asked about compilation of deal.ii and aspect on M-series apple hardware at the ASPECT splinter meeting at EGU. There are instructions here using Homebrew, but I thought that it might be useful to others to have a recipe using Macports.
Step 1 - install openmpi, gcc (for gfortran) and blas/lapack
Using macports, install:
sudo port install openmpi-gcc
sudo port install cmake
sudo port install OpenBLAS +native
sudo port install lapack numdiff
Step 2 - set environment variables for OpenMPI. Note that we are using Apple’s clang and gfortran provided by macports.
export CC=mpicc; export CXX=mpicxx; export FC=mpif77; export FF=mpif77; OMPI_CC=/usr/bin/clang; export OMPI_CXX=/usr/bin/clang++; export OMPI_FC=gfortran-mp-14
Step 3 - install candi and use it to install deal.ii
(download and unpack candi)
cd candi
- Edit candi.cfg to enable native optimizations in candi.cfg
- Set the trilinos major version to 16
- Note: there is as of 5/5/2025 a bug in kokkos that produces compile errors on Mac. You need to manually select trilinos 16.1.0 and insert the checksum:
-
- VERSION=16-1-0;CHECKSUM=d58ba4bcbcde701ee3a3e2e7cc27b6ca
Run candi:
./candi.sh --prefix=[path to installation] --packages=“p4est sundials trilinos dealii” -j 8
- VERSION=16-1-0;CHECKSUM=d58ba4bcbcde701ee3a3e2e7cc27b6ca
Step 4 - install aspect
git clone git@github.com:geodynamics/aspect.git
mkdir build
cd build
cmake -D DEAL_II_DIR=/path/to/dealii ..
make -j 8
Step 5 - Running aspect
Sometimes there are issues at runtime finding shared libraries. Aspect could not locate libgfortran. This was likely due to Macports putting libgfortran in a version-specific subdirectory. I resolved it by doing:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib/libgcc