Singularity Containers Use Case: Old PGI 32-bit Compilers
Use Case Description
When we upgraded the HPC system from the SLES 12 operating system to SLES 15, some old 32-bit PGI compilers previously installed on the system stopped working. It turned out those compilers had relied on a 32-bit system library that had been part of the SLES 12 OS, but was no longer provided by SLES 15. Furthermore, more recent versions of the PGI compilers had dropped support for 32-bit binaries altogether. One solution was to update the code to compile and run correctly with recent 64-bit compilers. Since this was deemed to require more time an effort than was immediately available to the user, we implemented a workaround by creating a containerized install of the same PGI compilers built on an older Ubuntu distribution that did provide the required system library. Running legacy software is in fact one of the important use cases of containerization.
Container Definition File ("pgi.def")
A definition file is essentially a recipe or set of instructions consumed by the singularity container runtime in order to create a custom container image. Here is the one we used to produce our PGI compiler container...
Bootstrap: docker
From: ubuntu:14.04
%setup
mkdir -p $SINGULARITY_ROOTFS/opt/pgi # installation dir for pgi compilers
mkdir -p $SINGULARITY_ROOTFS/mnt # pgi license & installer files accessed here
echo "SERVER rc-lics 005056a36384 27015" > $SINGULARITY_ROOTFS/opt/pgi/license.dat
echo "USE_SERVER" >> $SINGULARITY_ROOTFS/opt/pgi/license.dat
%files
pgilinux-2016-1610-x86.tar.gz /mnt/pgilinux-2016-1610-x86.tar.gz
pgilinux-2016-1610-x86_64.tar.gz /mnt/pgilinux-2016-1610-x86_64.tar.gz
%environment
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
export DISPLAY=$(echo $SSH_CLIENT | awk '{ if ($1 == "") print "localhost:0.0"; else print $1 ":0.0"; }')
export PGI=/opt/pgi
export PATH=/opt/pgi/linux86/16.10/bin:$PATH
export MANPATH=$MANPATH:/opt/pgi/linux86/16.10/man
export LM_LICENSE_FILE=$LM_LICENSE_FILE:/opt/pgi/license.dat
%post
truncate -s0 /tmp/preseed.cfg
echo "tzdata tzdata/Areas select Asia" >> /tmp/preseed.cfg
echo "tzdata tzdata/Zones/Asia select Qatar" >> /tmp/preseed.cfg
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
export DISPLAY=$(echo $SSH_CLIENT | awk '{ if ($1 == "") print "localhost:0.0"; else print $1 ":0.0"; }')
apt update -y
rm -rf /etc/timezone /etc/localtime
debconf-set-selections /tmp/preseed.cfg
apt install -y wget gnupg build-essential apt-utils lsb lib32gcc-4.8-dev gcc-multilib g++-multilib
dpkg-reconfigure tzdata
apt update -y
cd /mnt
tar xzf pgilinux-2016-1610-x86.tar.gz
tar xzf pgilinux-2016-1610-x86_64.tar.gz
cd install_components/
export PGI_SILENT=true
export PGI_ACCEPT_EULA=accept
export PGI_INSTALL_DIR=/opt/pgi
export PGI_INSTALL_NVIDIA=false
export PGI_INSTALL_AMD=false
export PGI_INSTALL_JAVA=false
export PGI_INSTALL_MPI=true
export PGI_MPI_GPU_SUPPORT=false
export PGI_INSTALL_MANAGED=false
./install
cd ..
rm -rf install_components/
How to Build the Container
We need three inputs to build our container: (1) the definition file reproduced above, (2) the installation media (i.e. tar file) for the 32-bit PGI compilers, and (3) the installation media (i.e. tar file) for the 64-bit PGI compilers. These three are available on raad2 under "/ddn/share/singularity" and should be copied to a common directory on any linux system on which the user has administrative (i.e. root) privileges. Needless to say, the actual creation of the container cannot therefore be performed on raad2 itself (where users don't have admin rights). One way to do it is to install a Linux VM on your Windows desktop/laptop and perform this step inside that VM.
Once you have access to a VM on which you have administrative (i.e. root) privileges, you first need to install the Singularity container runtime software. In the instructions below, we assume you have created a VM with the Ubuntu 20.04 linux distribution and your home directory is /home/faisal. Only the sequence of instructions is shown below, not the output of the commands:
sudo apt update
sudo apt upgrade
sudo apt-get update
sudo apt-get install -y build-essential libseccomp-dev libglib2.0-dev pkg-config squashfs-tools cryptsetup runc
sudo apt install golang
export VERSION=3.8.4
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz
tar -xzf singularity-ce-${VERSION}.tar.gz
cd singularity-ce-3.8.4/
./mconfig --prefix=/opt/singularity
cd /home/faisal/singularity-ce-3.8.4/builddir
make
sudo make install