Permalink
Find file Copy path
bef8198 Nov 19, 2018
2 contributors

Users who have contributed to this file

@mwallerb @galexv
182 lines (117 sloc) 6.85 KB

Prerequisites

To install ALPSCore, the following is needed:

  1. C++ compiler: g++ >= 4.8.1 OR Intel >= 15.0 OR Clang >= 3.2
  2. CMake >= 3.1 (NOTE: CMake 3.6.0 on Mac has a known problem)
  3. HDF5 library 1.8.x (NOTE: HDF5 1.10 has a known problem)
  4. Boost >= 1.56.0
  5. Eigen 3.3.4 (can be requested to be downloaded automatically)

Optional requirements:

  1. An MPI library and headers for compiling multi-cpu versions of the libraries.
  2. Doxygen for creating low-level documentation.

Installing pre-packaged ALPSCore

  1. MacOS via macports

    $ sudo port install alpscore
    
  2. Linux:

    a. Debian package

    b. Gentoo packaging

For other systems: please file an issue to let us know your system and we will try to add package files.

Manual source installation

Obtaining the source code

The ALPSCore package can be obtained by following methods:

  • Clone Git repository at https://github.com/ALPSCore/ALPSCore.git:

      $ git clone https://github.com/ALPSCore/ALPSCore.git
      $ cd ALPSCore
    
  • From release tarball:

    1. Download a release tarball from https://github.com/ALPSCore/ALPSCore/releases.

    2. Rename the downloaded tarball to ALPSCore.tar.gz (or ALPSCore.zip, if you chose the zip version), unpack it and change into the created directory:

         $ tar -xzf ALPSCore.tar.gz
         $ cd ALPSCore*/
      

Compilation

The ALPSCore library uses CMake as its build system.

  1. Create a build directory and change to it:

    $ mkdir build
    $ cd build
    
  2. Next, generate the ALPSCore build. The simplest build with reasonable defaults is generated by:

    $ cmake .. -DALPS_INSTALL_EIGEN=yes -DCMAKE_INSTALL_PREFIX=/where/to/install/ALPSCore
    

    This will attempt to download Eigen3 and co-install it along with ALPSCore.

    Alternatively, if you already have Eigen3 installed, you may pass its location to the build:

    $ cmake .. -DEIGEN3_INCLUDE_DIR=/path/to/Eigen3/headers \
               -DCMAKE_INSTALL_PREFIX=/where/to/install/ALPSCore
    

    There are many CMake and environment variables affecting ALPSCore build, which you can pass using cmake -Dvariable=value syntax, please refer to the corresponding Wiki page.

    You can also have a look at the build.jenkins.sh file in the directory common/build. This outlines some of the common options used by our automatic build system.

    NOTE: You must compile the ALPSCore libraries and all your codes which depend on the ALPScore libraries with the same C++ standard for ABI compatibility. At the very least, do not mix C++03 and C++11 code. More detailed information about setting C++ standard version is available on the wiki.

    For advanced users: If you do not wish to install all ALPSCore components, please refer to the wiki page Selecting ALPSCore components.

  3. Once the build tree successfully generated, perform the build:

    $ make
    

    on multicore machines with enough memory you can also run

    $ make -j njobs
    

    with njobs the number of parallel jobs to run the compilation in parallel.

  4. Run the tests:

    $ make test
    
  5. and install ALPSCore:

    $ make install
    

    The ALPScore will be installed in the directory specified in step 3 (/where/to/install/ALPSCore in this example).

Troubleshooting

  1. If your build generation seems to pick up the wrong Boost library, the following may help (note the mixed-case Boost_ in some of the arguments!):

    $ cmake .. -DBOOST_ROOT=/path/to/boost \
               -DBoost_NO_SYSTEM_PATHS=ON \
               -DBoost_NO_BOOST_CMAKE=ON
    
  2. To point CMake to the correct location of HDF5 library, set environment variable HDF5_ROOT=/path/to/hdf5 prior to CMake invocation.

  3. If your CMake run fails with a message In source builds are disabled. Please use a separate build directory, first make sure that you are not indeed attempting to build in the source directory. The error may be a lasting effect of a previous attempt at an in-source build, see CMake FAQ.

    You should remove CMake-generated files from the source directory and redo the build. For example, this way (from the build directory):

     $ mv ../CMakeLists.txt ../save_CMakeLists.txt
     $ rm -rf ../CMake*
     $ mv ../save_CMakeLists.txt ../CMakeLists.txt
    
  4. On most high performance computers with non-standard environments, e.g. crays/blue genes, you will get the best results by using the wrapper compilers and enabling static linking (see ALPS_BUILD_TYPE in CMake variables.

  5. See also a page listing known problems.

Build your project with ALPSCore

To use ALPSCore, your project must utilize CMake build system. Add the following lines to your project's CMakeLists.txt:

    # Not strictly necessary, but will create executables that are
    # aware of ALPSCore location
    SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

    # Request the ALPSCore package:
    find_package(ALPSCore)
    # (optionally, components can be also listed, like this:)
    # find_package(ALPSCore accumulators params)

    # Use ALPSCore_LIBRARIES variable to link to ALPSCore
    target_link_libraries(your_project_target ${ALPSCore_LIBRARIES})

You can see a CMakeLists.txt in an example project at https://github.com/ALPSCore/ALPSCore/tree/master/tutorials/mc/ising_mc . To build the project:

    $ mkdir ~/alpscore-tutorial
    $ cd ~/alpscore-tutorial
    $ env ALPSCore_DIR=/where/to/install/ALPSCore cmake /path/to/the/tutorials/mc/ising_mc
    $ make