Skip to content
Snippets Groups Projects
Commit 6c2c8b9e authored by Magnus Hagdorn's avatar Magnus Hagdorn
Browse files

add documentation and singularity container definition files

parent bc464bd5
No related branches found
No related tags found
No related merge requests found
*.sif
pism.sif: petsc.sif
petsc.sif: openmpi.sif
%.sif: %.def
sudo singularity build $@ $<
# singularity-pism
Singularity containers for the parallel ice sheet model (PISM)
\ No newline at end of file
Using [singularity](https://sylabs.io/docs/) to build the [parallel ice sheet model (PISM)](https://pism-docs.org/wiki/doku.php) on Scientific Linux 7.
PISM is modern ice sheet model written C++ using [PETSc](https://www.mcs.anl.gov/petsc/). The cmake build system doesn't find the system provided openmpi implementation.
This repository provides three singularity container definition files. One for basic OpenMPI, one for PETSc and one for PISM.
You can run the container using
```
mpirun -n 4 singularity exec --bind /scratch pism.sif /opt/pism/bin/pismv -test G -y 200
```
This runs PSIM using 4 MPI processes. The `--bind /scratch` option exposes the `/scratch` directory to the container. Other directories can be exposed using the same approach.
\ No newline at end of file
Bootstrap: docker
From: ubuntu:20.04
%environment
export OMPI_DIR=/opt/ompi
export SINGULARITY_OMPI_DIR=$OMPI_DIR
export SINGULARITYENV_APPEND_PATH=$OMPI_DIR/bin
export SINGULARITYENV_APPEND_LD_LIBRARY_PATH=$OMPI_DIR/lib
%post
echo "Installing required packages..."
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt install -y bash gcc gfortran g++ make file wget libxml2-dev zlib1g-dev libpapi-dev
echo "Installing Open MPI"
export OMPI_DIR=/opt/ompi
export OMPI_VERSION=1.10.7
export HWLOC_VERS=1.11.8
export OMPI_URL="https://download.open-mpi.org/release/open-mpi/v1.10/openmpi-${OMPI_VERSION}.tar.bz2"
mkdir -p /tmp/ompi
mkdir -p /opt
# install hwloc
cd /tmp/ompi
wget -O hwloc-${HWLOC_VERS}.tar.bz2 https://download.open-mpi.org/release/hwloc/v1.11/hwloc-${HWLOC_VERS}.tar.bz2 && tar -xjf hwloc-${HWLOC_VERS}.tar.bz2
wget -O openmpi-$OMPI_VERSION.tar.bz2 $OMPI_URL && tar -xjf openmpi-$OMPI_VERSION.tar.bz2
# Compile and install
cd /tmp/ompi/hwloc-${HWLOC_VERS}
./configure --prefix=$OMPI_DIR
make install
cd /tmp/ompi/openmpi-$OMPI_VERSION
./configure --prefix=$OMPI_DIR \
--disable-silent-rules \
--enable-mpi-thread-multiple \
--with-hwloc=$OMPI_DIR
make install
# Set env variables so we can compile our application
export PATH=$OMPI_DIR/bin:$PATH
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$OMPI_DIR/share/man:$MANPATH
Bootstrap: localimage
From: /scratch/local/mhagdorn/pism/singularity/openmpi.sif
%environment
export PETSC_DIR=/opt/petsc
export SINGULARITY_PETSC_DIR=$PETSC_DIR
export SINGULARITYENV_APPEND_PATH=$PETSC_DIR/bin
export SINGULARITYENV_APPEND_LD_LIBRARY_PATH=$PETSC_DIR/lib
%post
apt install -y libblas-dev liblapack-dev python
export OMPI_DIR=/opt/ompi
export PATH=$OMPI_DIR/bin:$PATH
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$OMPI_DIR/share/man:$MANPATH
export PATH=$PETSC_DIR/bin:$PATH
export LD_LIBRARY_PATH=$PETSC_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$PETSC_DIR/share/man:$MANPATH
echo "Installing PETSc"
export PETSC_ARCH=opt
export PETSC_VERSION=3.13.4
export PETSC_DIR=/opt/petsc-${PETSC_VERSION}
export PETSC_URL=http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${PETSC_VERSION}.tar.gz
mkdir -p /tmp/petsc
cd /tmp/petsc
wget -O petsc-lite-${PETSC_VERSION}.tar.gz ${PETSC_URL}
cd /opt
tar xzf /tmp/petsc/petsc-lite-${PETSC_VERSION}.tar.gz
# Compile and install
cd ${PETSC_DIR}
CC=mpicc CXX=mpicxx ./config/configure.py --with-shared-libraries \
--with-debugging=0 \
--with-fc=0
make all
pism.def 0 → 100644
Bootstrap: localimage
From: /scratch/local/mhagdorn/pism/singularity/petsc.sif
%environment
export OMPI_DIR=/opt/ompi
export PATH=$OMPI_DIR/bin:$PATH
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$OMPI_DIR/share/man:$MANPATH
export PETSC_ARCH=opt
export PETSC_VERSION=3.13.4
export PETSC_DIR=/opt/petsc-${PETSC_VERSION}
%post
apt install -y cmake libgsl-dev libfftw3-dev libudunits2-dev libproj-dev git libnetcdf-dev netcdf-bin
export OMPI_DIR=/opt/ompi
export PATH=$OMPI_DIR/bin:$PATH
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$LD_LIBRARY_PATH
export MANPATH=$OMPI_DIR/share/man:$MANPATH
export PETSC_ARCH=opt
export PETSC_VERSION=3.13.4
export PETSC_DIR=/opt/petsc-${PETSC_VERSION}
export PISM_VERSION=v1.2.1
mkdir -p /opt/pism
cd /opt/pism
git clone https://github.com/pism/pism.git
cd pism
git checkout ${PISM_VERSION}
mkdir build
cd build
PISM_INSTALL_PREFIX=/opt/pism CC=mpicc CXX=mpicxx cmake ..
make install
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment