Install Yambo on MacOS (ARM)
In order to install YAMBO on a Mac computer with ARM architecture, it is first necessary to set up a development environment on the target computer. At a minimum, this requires Fortran and C/C++ compilers suitable for compiling code on ARM architectures, such as the GNU Compiler Collection (GCC). HomeBrew, a package manager for macOS (or Linux), can be used to install the compilers and some of the libraries needed. For libraries not available in the HomeBrew repository or those that did not meet the necessary requirements, the installation can be handled by the automated procedure developed within YAMBO itself.
Preparing of the development environment
The software HomeBrew needs to be installed first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
And to install the compiler and the libraries is possible to use these commands:
brew install gcc brew install open-mpi brew install openblas fftw libxc brew install hdf5 netcdf netcdf-fortran
In a first test machine (MacBook Air M1, macOS Sonoma v14.6.1) this is a partial list of the installed packages and versions:
% brew list --versions [...] cmake 3.26.4 fftw 3.3.10_1 gcc 14.2.0_1 hdf5 1.14.4.3 libxc 6.2.0 netcdf 4.9.2_2 netcdf-fortran 4.6.1_1 open-mpi 5.0.5 openblas 0.3.28 scalapack 2.2.0_1 gcc-aarch64-embedded 12.2.rel1
Installing YAMBO
The features required to compile YAMBO on ARM architectures will be publicly released in the next version, 5.3. Nevertheless, you can already experiment with the installation using the tech-master development branch of the official GitHub code repository:
git clone https://github.com/yambo-code/yambo.git cd yambo git checkout tech-master
Finally YAMBO can be successfully compiled with the following configuration:
export OMPI_CC=/opt/homebrew/bin/gcc-14 OPT=/opt/homebrew/opt ./configure \ CC=gcc-14 \ CPP="gcc-14 -E -P" \ MPICC=mpicc \ FC=gfortran-14 \ F77=gfortran-14 \ FPP="gfortran-14 -E -P" \ MPIFC=mpifort \ --enable-mpi \ --enable-open-mp \ --disable-hdf5-par-io \ --enable-time-profile \ --enable-memory-profile \ --enable-msgs-comps \ --with-blas-libs="-L$OPT/openblas/lib -lopenblas" \ --with-lapack-libs="-L$OPT/openblas/lib -lopenblas" \ --with-libxc-path=$OPT/libxc \ --with-fft-path=$OPT/fftw \ --with-hdf5-path=$OPT/hdf5 \ --with-netcdf-path=$OPT/netcdf \ --with-netcdff-path=$OPT/netcdf-fortran \ --enable-par-linalg \ --with-scalapack-libs="-L$OPT/scalapack/lib -lscalapack" \ --with-blacs-libs="-L$OPT/scalapack/lib -lscalapack" \ --enable-slepc-linalg \ --with-extlibs-path=$HOME/opt/ext-libs make -j4 all
gcc-14 and gfortran-14 can be substituted with the compiler version used, see below how to check the version of the packages installed with HomeBrew.
Troubleshooting:
An issue was identified with the mpicc wrapper. It was expected to use the gcc-14 C compiler internally; however, it was found to be using the Apple Clang compiler instead:
mpicc -show clang -I/opt/homebrew/Cellar/open-mpi/5.0.5/include -L/opt/homebrew/Cellar/open-mpi/5.0.5/lib -lmpi
The issue was solved using the OMPI_CC environment variable to specify the C compiler:
export OMPI_CC=/opt/homebrew/bin/gcc-14 mpicc --show /opt/homebrew/bin/gcc-14 -I/opt/homebrew/Cellar/open-mpi/5.0.5/include -L/opt/homebrew/Cellar/open-mpi/5.0.5/lib -lmpi