Table of Contents
Installing and configuring dependencies and getting the source code
Overview
The current version of DMRG.x requires a Linux/Mac machine installed with the following libraries:
The program may work with more recent versions of PETSc and SLEPc but it has not yet been tested for compatibility. These will also require a working installation of MPI and a suitable BLAS/LAPACK library.
Note:
- If your computer does not have any MPI library installed, consider installing it through your package manager (
apt
,yum
,brew
, etc.) - On a computing cluster (Argo, Marconi, etc), the correct libraries may be obtained using the
module
utility, e.g. on Marconi:module load autoload mkl intelmpi
To properly use the Makefiles for generating executables, the following environment variables must also be defined with the correct values:
PETSC_DIR
SLEPC_DIR
PETSC_ARCH
Installing PETSc and SLEPc
In this section, we give a step-by-step approach for installing the PETSc and SLEPc libraries on our local machine and/or a cluster. The steps may vary depending on the specifications and pre-existing libraries for each computer, so we will try to give the most generic steps possible.
Getting the source codes
In this example we will install PETSc and SLEPc in a subdirectory called slepc
of your $HOME
folder. You can also choose any directory to install the libraries as long as they are accessible to you without root permissions.
First, create the subdirectory in your home folder where you will place the libraries:
$ mkdir -p $HOME/slepc $ cd $HOME/slepc
Then, download and extract the source codes from the download links above using the wget
utility:
$ wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.8.4.tar.gz $ wget http://slepc.upv.es/download/distrib/slepc-3.8.3.tar.gz $ tar xzf petsc-3.8.4.tar.gz $ tar xzf slepc-3.8.3.tar.gz
We should now have two directories: petsc-3.8.4
and slepc-3.8.3
:
$ ls > petsc-3.8.4 petsc-3.8.4.tar.gz slepc-3.8.3 slepc-3.8.3.tar.gz
Setting the environment variables
Edit your rc file (e.g. ~/.bashrc
if you are using bash
) with any text editor and add the following lines:
export PETSC_DIR="$HOME/slepc/petsc-3.8.4" export SLEPC_DIR="$HOME/slepc/slepc-3.8.3" export PETSC_ARCH="arch-linux-opt"
To implement these commands, source the rc file
$ source ~/.bashrc
or restart the terminal. Now check that the environment variables have been set correctly:
$ cd $PETSC_DIR && pwd $ cd $SLEPC_DIR && pwd $ echo $PETSC_ARCH
Configuration and Compilation
PETSc and SLEPc need to be configured according to the software and hardware specifications of your machine. This is done through the configure
utility in $PETSC_DIR
.
$ cd $PETSC_DIR $ ls configure
If you wish to see all arguments to the configure command,
$ ./configure --help
For more information on particular configurations and options, see the installation info and the PETSc Users Manual.
Assuming that the required libraries have been installed correctly, (on systems where MPI and BLAS/LAPACK are installed), the configure utility whill automatically locate these so that only the following minimum set of commands need to be used:
$ ./configure --with-debugging=0 COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3" FOPTFLAGS="-g -O3" --with-64-bit-indices=1
The --with-debugging=0
flag allows us to build the libraries for production and timing. The optimization flags -g -O3
give us the maximum compiler optimization and debigging symbols. And --with-64-bit-indices=1
ensures that the PetscInt
integer type is long long
or has a length of 64 bits, so that indices have larger capacity.
Note: On computing clusters (Marconi), the following additional flags may also need to be set to work with the batch scheduler and find the correct BLAS/LAPACK provided by Intel MKL:
--with-batch=1 --known-mpi-shared-libraries=0 --with-blas-lapack-dir=$MKLROOT
Additional flags should be provided if you are using different compilers and targetting for processors with specific extensions. Also, additional steps such as submission of a script to the scheduler have to be followed in order to complete the configuration.
When configuration is completed, follow the instruction on-screen, or execute:
$ make all test
Once PETSc has been configured and installed, we can now do the same for SLEPc. This step is now simpler since the configure
utility will obtain the corresponding settings from PETSc:
$ cd $SLEPC_DIR $ ./configure $ make all test
Installing DMRG.x
To download and use the source code:
$ cd path/to/place/DMRG.x $ git clone https://github.com/jnvance/DMRG.x.git DMRG.x $ cd DMRG.x
This will default to the master branch. To use the latest development version of the code:
$ git checkout develop
Details on the compilation of the executable may be found in Usage.