Algorithms and Libraries for Physics Simulations


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 /gpfs/research/software/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(/gpfs/research/software/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})")

# 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})

(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 .

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

#SBATCH --job-name="ALPS"
#SBATCH -p genacc_q
#SBATCH -t 01:00:00

module load alps