Building parallel Siesta with OpenMPI

These are the steps I followed to build a parallel version of the Siesta electronic structure code with OpenMPI, using the GNU compilers. I've tested this recipe for Debian 8.6 "jessie", Ubuntu 14.04.5 "Trusty Tahr", Ubuntu 16.04.1 "Xenial Xerus" and Centos 7 (a Red Hat derivative), all with Siesta 4.0. My older instructions for building against the ancient Debian 5.0 "lenny" can still be found here.

We'll start by installing some necessary packages, as well as those for the optional NetCDF support. I'm assuming you already have installed basic development packages such as make, gfortran and gcc. These are slightly different depending which OS you're building for:

Debian 8:

  sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev libblacs-openmpi1 \
               libopenmpi1.6 libnetcdf-dev netcdf-bin libscalapack-openmpi1 libscalapack-mpi-dev \
               libblas-common libblas-dev liblapack-dev
Ubuntu 14.04:
  sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev libblacs-mpi-dev \
               libopenmpi1.6 libnetcdf-dev netcdf-bin libscalapack-mpi-dev \
               libblas-dev liblapack-dev
Ubuntu 16.04:
  sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev libblacs-mpi-dev \
               libnetcdf-dev netcdf-bin libnetcdff-dev libscalapack-mpi-dev \
               libblas-dev liblapack-dev
Centos 7:
  sudo yum group install "Development Tools"
  sudo yum install openmpi openmpi-devel lapack lapack-devel scalapack-common scalapack-openmpi \
                   scalapack-openmpi-devel scalapack-openmpi-static netcdf-devel \
                   netcdf-fortran-devel lapack-static 

Download the Siesta source from the web site above, e.g. version 4.0 can be downloaded from here. Uncompress it and navigate to the Obj directory:

  tar zxf siesta-4.0.tgz
  cd siesta-4.0/Obj

Set up the Obj directory:

  sh ../Src/

Download the appropriate arch.make file for your OS: this one for Debian or Ubuntu, or this one for Centos. Rename the downloaded file to arch.make and make any changes desirable, e.g. you may well want to modify the FFLAGS compiler option to be specific for your processor, or remove the debug option. If in doubt, don't modify it. Build the siesta executable by simply running:


If the compilation all goes well then the siesta executable should now be in the Obj directory. You can test your build by downlading this simple H2O example, untarring it and running your new build with it:

  tar xf Files-h2o.tar

  # We'll test with 4 processes on the same multi-core machine 
  export PROCS=4
  /bin/echo "localhost slots=$PROCS" > machines

  # For Debian or Ubuntu run the calculation with:
  /usr/bin/mpirun -np $PROCS --machinefile machines --mca btl self,sm siesta < h2o.fdf > h2o.default.out

  # *OR* for Centos use:
  /usr/lib64/openmpi/bin/mpirun -np $PROCS --machinefile machines --mca btl self,sm siesta < h2o.fdf > h2o.default.out

The README file that comes with the example tells you how to confirm that your results make sense.

By Mark Calleja. Last modified 20th November 2016.