ALPS Installation on Mac/Linux from Sources
For most cases, it is preferred to install ALPS from Binaries. However, for more user control and configuration, installing from Sources could be a better approach.
Install Required Dependencies
ALPS relies on a handful of external libraries. Choose one MPI and one BLAS provider that fit your system:
Dependency | Minimum version | Packages |
---|---|---|
HDF5 | 1.10.0 | libhdf5-dev |
CMake | 2.8 | cmake |
C++ Compiler | GCC 10.5.0 & Clang 13.0.1 | build-essential |
Boost | 1.76 (1.87 if NumPy >= 2.0 / Python >= 3.13) | see below |
MPI | OpenMPI 4.0 or MPICH 4.0 | libopenmpi-dev / libmpich-dev |
BLAS | 0.3 | libopenblas-dev |
Python | 3.9 | python.org |
Ubuntu / Debian / WSL
$ sudo apt update
$ sudo apt install build-essential cmake \
libhdf5-dev \
libopenblas-dev \
libopenmpi-dev openmpi-bin # or: libpich-dev mpich
# download and install Boost v1.81.0:
$ wget https://archives.boost.io/release/1.81.0/source/boost_1_81_0.tar.gz
$ tar -xzf boost_1_81_0.tar.gz
# install Python libs:
$ pip install numpy scipy # python libraries
# or
$ python3 -m pip install numpy scipy
macOS (via Homebrew)
$ brew update
$ brew install cmake hdf5 \
openblas open-mpi # or: mpich
# download and install Boost:
$ brew install boost
# install Python libs:
$ pip3 install numpy scipy
Verify Dependencies
$ gcc -v # must be >= 10.5.0
$ cmake --version # must be >= 3.18
$ mpirun --version # OpenMPI 4.0 or MPICH 4
Download and Build
We can now proceed to download and build the ALPS
library.
In the snippet below, please replace /path/to/install/directory
with the actual directory on your system you want ALPS to be installed.
$ git clone https://github.com/alpsim/ALPS alps-src
$ cmake -S alps-src -B alps-build \
-DCMAKE_INSTALL_PREFIX=</path/to/install/dir> \
-DBoost_SRC_DIR=</directory/with/boost/sources>/boost_1_81_0 \
-DCMAKE_CXX_FLAGS="-DBOOST_NO_AUTO_PTR \
-DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF"
$ cmake --build alps-build -j 8
$ cmake --build alps-build -t test
Video Walkthrough
Troubleshooting
- Need a different MPI or BLAS?
Substitute the package names above with your cluster’s module (e.g. Intel MKL/OneAPI, AMD AOCL, IBM ESSL, etc). Cmake is a build system that will find the locations of the above packages and generate compilation instructions in Makefiles. - Python errors
Ensure you are using Python 3.9 at a minimum. Note: some installations (e.g. macOS) usepip3
instead of pip. Refer to the python website for support in installing the correct version. - MPI mismatch?
Ensure that CMake is using the same MPI version asmpirun --version
- Boost errors
We have tested buildingALPS
withBoost
versions1.76.0
through1.81.0
(please refere to the build notes for the combination of supportedboost
versions with different compilers and Python version)
Build notes
If you have a non-standard installation location of the dependent packages installed in step 1, cmake will fail to find the package. ALPS uses the standard cmake mechanism (FindXXX.cmake) to find packages. The following pointers may help:
- For MPI: Follow the instructions on cmake with mpi
- For BLAS: Follow the instructions on cmake with BLAS
- For HDF5: Follow the instructions on cmake with HDF5
After successfully building the code, you will need to install it. The install location is specified with -DCMAKE_INSTALL_PREFIX=/path/to/install/directory
as a cmake command during configuration. Alternatively, it can be changed by explicitly providing a new installation path to the --prefix
parameter during the installation phase (see cmake manual).
To install the code run:
$ cmake --install alps-build
Your install directory will be created; if everything was successful you can find ALPS executables such as mc
or fulldiag
under the bin directory of your installation path.