Building ALPS from source

Revision as of 01:08, 2 June 2012 by Troelsfr (talk | contribs) (Get dependent libraries and tools on Ubuntu 10.04 Lucid (and higher))

Jump to: navigation, search

Libraries and tools needed to build ALPS

ALPS will need the following libraries and tools in addition to the ALPS sources:

Many of the applications will also need

  • BLAS and LAPACK libraries

To use the evaluation tools you will need Python and some Python packages

All these packages and tools can be installed from source or using the packages provided by the package manager of the operating system. In the following we will give more instructions for packaged installations on various platforms.

The tebd code requires a fortran compiler and that HDF5 be built with the --enable-fortran configure option.

Get dependent libraries and tools on MacOS X using Mac Ports

$ sudo port install cmake
  • Install HDF5 1.8.2 or higher
$ sudo port install hdf5-18
  • If you want Python support without Vistrails install Python and scientific Python packages:
$ sudo port install py27-numpy py27-scipy py27-matplotlib python27
$ sudo port select --set python python27

Alternatively you can also just install the ALPS Vistrails extensions

  • Download and unpack the Boost C++ Libraries library sources 1.47.0 or higher if you have not downloaded them with the ALPS sources. NOTE: just download and unpack but do not build Boost
  • Note that Xcode 4 does not provide a MPI implementation. To use ALPS with MPI you have to install it.
$ sudo port install openmpi

Get dependent libraries and tools on Ubuntu 10.04 Lucid (and higher)

1. Install required packages using Synaptic package manager.

build-essential cmake-curses-gui libhdf5-serial-dev libfftw3-dev
gfortran python-matplotlib python-scipy liblapack-dev xsltproc

You can use apt-get to install them. Issue the commmands

apt-get install build-essential cmake-curses-gui libhdf5-serial-dev \
libfftw3-dev gfortran python-matplotlib python-scipy liblapack-dev \
xsltproc python-dev

from a terminal or use the graphical package manager.


  • For Ubuntu 12.04 Precise Boost (version 1.48) can be installed from the package manager
  • For ealier realeases download ALPS with the Boost sources included.


  • For Ubuntu 10.04 Lucid install
  • On Ubuntu 11.10 install

4. On Ubuntu, Vistrails is able to automatically install additional packages. If you however do not have administrative rights, you might need your administrator to install also the following packages:

python-qt4-gl python-qt4-sql python-vtk

Get dependent libraries and tools on CentOS 5.4 (should be identical with RHEL 5.4 and essentially all 5.* versions)

1. Make sure you have all the usual compilers installed. The following should pull in all required dependencies (including some libraries):

# yum install gcc-c++ gcc-gfortran

2. If you want to use the evaluation tools, you will need to install a newer version of Python than the provided 2.4. You can install from source or use an unofficial repository for binary RPMs. This is not required if you just want to run your compiled simulations (c++ applications), but make sure you still have python headers (specify -DALPS_BUILD_PYTHON=OFF when invoking cmake):

# yum install python-devel

3. CMake 2.8.0 or later and HDF5 1.8 or later need to be installed from source since there are no packages in the standard repositories. You can however use the install scripts in the script directory to save some work. See #Get some dependent libraries and tools from source using ALPS convenience scripts

4. More recent Boost packages are required. Use the ALPS package that includes them or get them separately.

5. If you don't have some version installed already, you will also need BLAS/LAPACK:

# yum install blas-devel lapack-devel

Get dependent libraries and tools on Debian GNU/Linux (sid)

(2010/04/08) You can now create ALPS binary (except SSE, #68) without external source!

  • Install build-essential package using apt. This will pull g++, make, etc.
$ sudo aptitude install build-essential
  • Install CMake using apt. Currently, this pulls 2.8.2
$ sudo aptitude install cmake-curses-gui
  • Install HDF5 using apt. Currently, this pulls 1.8.4-patch1.
$ sudo aptitude install libhdf5-serial-dev
  • Install Boost C++ Libraries using apt. Currently, this pulls 1.42.0. Note: Install libboost-all-dev. libboost-dev is not sufficient!
$ sudo aptitude install libboost-all-dev
  • Install FFTW using apt.
$ sudo aptitude install libfftw3-dev
  • Install Python and the needed packages h5py, numpy, scipy and matplotlib using apt.
$ sudo aptitude install python-h5py python-numpy python-matplotlib python-scipy
  • Install gfortran using apt for LAPACK/BLAS autodetection.
$ sudo aptitude install gfortran

Get some dependent libraries and tools from source using ALPS convenience scripts

We have provided some shell scripts that can simplify building some of the dependent libraries from source:

  • Checkout the ALPS source from subversion. (assume e.g. at $HOME/src/alps2)
  • Install CMake and HDF5 using scripts, building in $HOME/tmp and installing into $HOME/opt
$ $HOME/src/alps2/script/ $HOME/opt $HOME/tmp
$ $HOME/src/alps2/script/ $HOME/opt $HOME/tmp

Build ALPS

  • Download a source package of ALPS.
  • Create a build directory (anywhere you have write access) and execute cmake giving the path to the alps and to the boost directory:
$ cmake -D Boost_ROOT_DIR:PATH=/path/to/boost/directory /path/to/alps/directory

In this case the installation directory will be '/opt/alps'. If you want to specify a different installation directory set the variable CMAKE_INSTALL_PREFIX. Note that for the directory you specify here, you need to have writing-rights, therefore if you do not have the right to write to '/opt/alps' you need to give this option in any case:

$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/directory /path/to/alps/directory

If you want to link against a 64-bit LAPACK version turn the LAPACK_64_BIT option on in cmake by adding the option -D LAPACK_64_BIT=ON

  • Optionally look at or edit the CMake configuration settings using the CMake GUI or ccmake. This lets you set include and library paths for libraries which cmake did not find automatically. You may want to take a look at the descriptions of the relevant cmake options.
$ ccmake .
  • Build and test ALPS
$ make 
$ make test
$ make install

Building Vistrails and ALPS Vistrails package from source on Linux

  • Download the latest Vistrails sources from [1].
  • Install Vistrails following the Building from Source instructions.
    • For example in Ubuntu Vistrails will interact automatically with apt. You just have to start it
      $ python
  • Go to your ALPS build directory
  • Turn ALPS_INSTALL_VISTRAILS_PACKAGES on, either in the GUI or by running cmake initially as
  • Set the CMake VISTRAILS_APP_DIR variable to point to the directory containing vistrails.
  • Build and install ALPS. This will build both a full ALPS installation and install the ALPS Vistrails extensions into Vistrails

If you have problems...

f you've had previous versions of Vistrails installed, it might be confused by some old files in ~/.vistrails. Try renaming that folder and start again.

Building ALPS from MacPort on MacOS X

ALPS is also shipped as a MacPort package. This is going to install all libraries needed and compile ALPS.

  1. Install MacPort
  2. Open the terminal and type: # sudo port install alps

Additional notes

Notes for high performance computers

On HPC machines it might be nontrivial to configure and set up ALPS with the right combination of libraries. We thus provide setup configuration files for those machines where we have successfully installed ALPS and where the setup was nontrivial. More information can be found here

Notes for Unix Servers

On Unix servers you often do not have access to the root directory, and you cannot use the default directory to install HDF5 and Cmake. Here is an example on how to install Alps 2.0 on a server in which you have writing access only to your home directory (~/)

1. Download HDF5 and install into ~/opt

2. Download and install cmake into ~/cmake

3. Download the Alps sources into your home directory and expand them using "gunzip" and "tar -xrf". From the directory that you have just created execute:

> ../cmake-2.8.1/bin/cmake  -D BLAS_LIBRARY=/usr/lib64/ 
 -D LAPACK_64_BIT=ON  -D HDF5_LIBRARIES=~/opt/lib/ 
 -D HDF5_INCLUDE_DIR=~/opt/include/ ~/alps-2.0.0b1-r4556-src-with-boost/alps/

4. add the following line to the ~/.bashrc file

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/opt/lib to .bashrc

Advanced builds

Instructions for advanced build versions are available on the developer Wiki:

If you want to build the Python extensions against a non-standard Python installation set the CMake variable PYTHON_INTERPRETER to point to the Python interpreter you want to use