ALPS

Algorithms and Libraries for Physics Simulations

Introduction

ALPS is a Computational Physics library written in C++ but available in C, Python and FORTRAN as well. It is designed to provide high-end codes for simulating strongly correlated quantum mechanical systems as well as to provide tools to expedite and simplify the process of developing these types of codes.

Running ALPS on RCC Resources

ALPS is available in C, C++, Python, and FORTRAN. Here we demonstrate how to compile and run a C++ ALPS program on the HPC using CMake.

Compiling and Running C++ Test Problem on HPC

To run an example program utilizing the ALPS library, the user must first load the module alps, make a temporary folder for the example, and copy the C++ file to it.

#Load the module
module load alps

#Make the temporary directory
mkdir ~/alps-test   

#Copy an example C++ file to the temporary directory
cp /panfs/storage.local/opt/alps/build/tutorials/code-02-c++/solution/ising.cpp ~/alps-test

Now create a CMakeLists.txt file (the file name should be exactly same) and copy the following into it.

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 project(alpsize NONE)

# find ALPS Library
find_package(/panfs/storage.local/opt/alps/build/share/alps/ALPS ${ALPS_ROOT_DIR} $ENV{ALPS_HOME} NO_SYSTEM_ENVIRONMENT_PATH)
message(STATUS "Found ALPS: ${ALPS_ROOT_DIR} (revision: ${ALPS_VERSION})")
include(${ALPS_USE_FILE})

# enable C and C++ compilers
enable_language(C CXX)

# rule for generating 'ising' program
add_executable(ising ising.cpp)
target_link_libraries(ising ${ALPS_LIBRARIES})
add_alps_test(ising) 

(Note that when using CMake with another C++ source file, 'ising' and 'ising.cpp' in the last three lines would be replaced with that source file's name and source file.) Finally navigate to the directory and use CMake. This will generate a Makefile, which can then generate the executable.

cd ~/alps-test
cmake .
make

The executable ising should be available now. To run this program on the Slurm scheduler, create a submit script similar to following.

#!/bin/bash
#SBATCH --job-name="ALPS"
#SBATCH -N 1
#SBATCH -p genacc_q
#SBATCH -t 01:00:00

cd $SLURM_SUBMIT_DIR
module load alps
./ising