Install

From diagham
Jump to navigation Jump to search

Requirements

To install DiagHam, you need the following softwares

  • GNU make or any compatible version of make.
  • autotools (i.e. automake and autoconf)
  • subversion (the easiest way to get DiagHam)
  • blas/lapack (not mandatory, but they provide better performance)
  • bunzip2 libraries (not mandatory)
  • GMP (not mandatory)
  • MPI (not mandatory unless you want to run DiagHam on a cluster)
  • Scalapack (not mandatory)


First installation

There are many ways to install DiagHam. The most convenient one relies on subversion. It is an easy way to keep your version up to date. You can check that subversion is available by typing the command

svn --help


if the command was found, go to the place where you want to install DiagHam and type


svn checkout https://www.nick-ux.org/diagham/svn/DiagHam/trunk DiagHam

This will create a directory called DiagHam and download all the source code. If everything went fine just into the newly created DiagHam directory. A sane way to work with DiagHam is to separate the source, the compiled programs and the data one will produce. Thus create two directories build et run

mkdir build
mkdir run

Now it's time to configure the code for the architecture it will work on. Run

./bootstrap.sh

Now go into the build directory. The simplest configuration is done by typing the command

../configure --enable-fqhe

If lapack is available on your computer, you should use instead

../configure --enable-fqhe --enable-lapack

If there is any problem with you lapack installation, you will get some informations at that point. It may happen on Mac OS X that configure has some trouble to find lapack and blas (due to some lowercase/uppercase convention). I f you have such a proble, just use

../configure --enable-fqhe --enable-lapack --with-blas-libs="-lBLAS" --with-lapack-libs="-lLAPACK"

You can also activate the part of the code related to quantum spin chains using the --enable-spin option or to the fractional topological insulator using the --enable-fti option. This can be done in addition to the --enable-fqhe i.e.

../configure --enable-fqhe --enable-lapack --enable-spin

or

../configure --enable-fqhe --enable-lapack --enable-fti

Any other feature that has to be turned on (such as support for GMP, bz2,...) can be done using the corresponding option. See ../configure --help for the corresponding syntax.

You can now compile the whole code

make

This may take a while (i.e. a few minutes). If you are working on a multi-cpu and/or multi-core cpu, you should use instead of make

make -jx

where x is the total number of cores.

Checking your DiagHam installation

Everything went fine? You can now go to the run directory

cd ../run

and check for example

../build/FQHE/src/Programs/FQHEOnSphere/FQHESphereJackGenerator --help

This should display the help of the FQHESphereJackGenerator program which looks like

   FQHESphereJackGenerator, version 0.01
   
   Usage: FQHESphereJackGenerator [options]
   
   Options:
   
   system options:
       --reference-file : use a file as the definition of the reference state
       -a, --alpha : alpha coefficient of the Jack polynomial (default value = -2)
       --symmetrized-basis : use Lz <-> -Lz symmetrized version of the basis (only valid if     total-lz=0) to speed up calculations
       --sym-storage : use Lz <-> -Lz symmetrized version of the basis (only valid if total-lz=0), both for speed and storage
       --initial-state : use an optional state where some of the components have already been computed, improving computation time
       --resume : resume Jack calculation (only available in huge mode)
       --min-index : compute the Jack polynomial from the min-index-th component (require an initial state) (default value = 0)
       --max-index : compute the Jack polynomial from the max-index-th component (require an initial state, 0 if it has computed up to the end) (default value = 0)
       --fermion : compute the slater decomposition of the Jack polynomial times Vandermonde
       --huge-basis : use huge Hilbert space support
       --large-basis : use large Hilbert space support (i.e. handle non-squeezed Hilbert space larger than 2^31 without hard-drive storage)
       --huge-fulldim : indicate the full Hilbert space dimension (i.e. without squeezing) when using huge Hilbert space (0 if it has to be computed) (default value = 0)
       --file-size : maximum file size (in MBytes) when using huge mode (default value = 0)
       --memory : maximum memory (in MBytes) that can allocated for precalculations when using huge mode (default value = 100)
       --huge-vector : maximum memory (in MBytes) that can allocated for buffering vector when using huge mode (default value = 100)
       --huge-blocks : maximum memory (in MBytes) that can allocated for buffering indices when using huge mode (useful to improve parallelization speed-up) (default value = 100)
       --disk-storage : use disk storage in huge mode both for the Hilbert space and vectors
       --large-memory : maximum memory (in kBytes) that can allocated for precalculations when using huge mode (default value = 1)
       --check-singularity : display configurations which may produce singularities
   
   output options:
       -o, --bin-output : output the Jack polynomial decomposition into a binary file
       -t, --txt-output : output the Jack polynomial decomposition into a text file
       -n, --normalize : express the Jack polynomial in the normalized basis
   
   precalculation options:
       --save-hilbert : save Hilbert space description in the indicated file and exit (only available for the Haldane basis)
       --load-hilbert : load Hilbert space description from the indicated file (only available for the Haldane basis)
   
   parallelization options:
       -S, --SMP : enable SMP mode
       --processors : number of processors to use in SMP mode (default value = 2)
       --smp-profil : enable SMP profiling, the name of the log file  has to be passed as argument
       --mpi : enable MPI mode
       --mpi-smp : enable both MPI and SMP mode, the name file describing the cluster has     to be passed as argument
       --cluster-profil : enable cluster profiling, the name of the log file  has to be passed as argument
   
   misc options:
       -h, --help : display this help


for any program you can always display help using the --help or -h option.

Now you can start some serious job. For example you can have a look at FQHESphereJackGenerator .


Updating the code

Next time you will need to get the latest version, just go into the DiagHam directory and type

svn update

you can then proceed with the compilation i.e. go into the build directory and type

make -jx

Common issues

Recently, several problems have been reported with svn. DiagHam cannot be retrieved with the typical error message

   svn: OPTIONS of 'https://www.nick-ux.org/diagham/svn/DiagHam': SSL negotiation failed:
   SSL error code -1/1/336032856 (https://www.nick-ux.org)

Most probably, this error is due to svn being outdated. Svn version should >= 1.6.12 . The version number can be checked using svn --version . In particular Ubuntu 10.04 or older Mac OsX lion have an svn version older than 1.6.12 . You can either update your system or download/compile a new version of svn . For Mac OsX users, macport provides an updated version of subversion.

On MacOSX, you might expect some strange behavior with the fortan2c library. While the g2c, f2c or gfortran2c libs are missing, the code runs fine without it. In that case, one can try to add the option --with-fortran2c-libs="" on the configure command line.

Using Intel compiler and MKL

While DiagHam is developed with GNU gcc as the default compiler, it should work with Intel compiler icc. There are a few tricks in order to make it work with icc and MKL. The configuration line should look like

CXX="icc" CC="icc" FC="ifort" ../configure --enable-fti --enable-fqhe --enable-mpi --enable-intelmkl --with-intelmkl-libdir=$MKL_HOME/lib/intel64

In this example, we have to force the compilers to be icc for C and C++ and ifort for the fortran compiler. While we still want to use Lapack, we rely on MKL for that purpose with the --enable-intelmkl option. In particular, we DO NOT set --enable-lapack. Most of the time, you will have to set the location of the MKL library using the --with-intelmkl-libdir option. A simple way to know this machine-dependent path is not to use the --with-intelmkl-libdir option and to try to compile. In principle, the compilation should fail and reveal in the error messages the path to th MKL library.

Note that in our example, we have also turned on MPI which should work fine with icc.

Using LLVM

DiagHam should compile without any problem with llvm (using clang or the Mac OS gcc frontend to llvm). On a Linux machine, compiling with llvm is straightforward. A configure command like

CC="clang" CXX="clang++" ../configure --enable-fqhe --enable-lapack --enable-gsl --enable-bz2 --enable-gmp --enable-spin --enable-fti

should work (last test done on Sep. 2024 using Arch Linux). Note that all the options are not mandatory.

Compiling on M1/M2/... Mac

There are two options to compile Diagham on ARM Mac architecture. A rather straightforward method relies on homebrew and installing gcc/openblas/openlapack

./configure --enable-fqhe --enable-fti --enable-gmp --enable-lapack --with-blas-libs=-lopenblas --with-lapack-libs=-llapack 'CFLAGS=-I/opt/homebrew/include -I/opt/homebrew/opt/openblas/include -I/opt/homebrew/opt/lapack/include' 'LDFLAGS=-L/opt/homebrew/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/opt/lapack/lib -L/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/13/' 'CPPFLAGS=-I/opt/homebrew/include -I/opt/homebrew/opt/openblas/include -I/opt/homebrew/opt/lapack/include'

Note that you might have to adapt paths in this command depending on the version of gcc installed on your system. If there is any issue with gfortran/g2c/f2c, add the option--with-fortran2c-libs="".

The major drawback of this methods is that the openblas/lapack libraries do not benefit from Apple optimizations. Another approach is based on suggestion of the R-projet (see comment 10.5: Which BLAS is used and how can it be changed?) . One can symlink to the veclib version of blas, which is from apple’s accelerate framework. Once R is installed, we can use the libs there

../configure -enable-fqhe --enable-fti --enable-gmp --enable-lapack --with-lapack-libs="-L/Library/Frameworks/R.framework/Resources/lib/ -lRlapack" --with-blas-libs="-L/Library/Frameworks/R.framework/Resources/lib/ -lRblas" CPPFLAGS="-g -I/opt/local/include/" LDFLAGS=-L/opt/local/lib

Testing the configuration

If you have any doubt that some configure options might not enabled or that the architecture options (like 128 bits integers) have not been detected properly. You can use the following command

'build/src/Programs/TestDiagHamConf'

that should output the following information (depending on the options that you have selected)

   __LITTLEENDIAN__ defined
   __SSTREAM_STYLE__ defined
   MACHINE_PRECISION 1e-14 defined
   __SMP__ defined
   __DEBUG__ defined
   __64_BITS__ defined
   __LAPACK__ defined
   __BZ2LIB__ defined
   __GMP__ defined
   __GSL__ defined
   x86-64 architecture detected
   __64_BITS__ defined
   __128_BIT_LONGLONG__ defined
   LONGLONG int128_t defined
   ULONGLONG uint128_t defined
   USE_OUTPUT defined
   USE_CLUSTER_ARCHITECTURE defined
   USE_HILBERT_SPACE defined