Add Ubuntu 20.04 OneAPI container definition

This commit is contained in:
Richard Berger
2021-12-01 10:41:01 -05:00
parent 8589ecd6c1
commit e0770a2ac0

View File

@ -0,0 +1,185 @@
BootStrap: docker
From: ubuntu:20.04
%post
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --no-install-recommends -y software-properties-common
add-apt-repository ppa:openkim/latest
apt-get update
apt-get upgrade --no-install-recommends -y
apt-get install --no-install-recommends -y \
gpg-agent \
bc \
build-essential \
ccache \
clang \
curl \
doxygen \
enchant \
g++ \
gcc \
gfortran \
git \
hdf5-tools \
less \
libblas-dev \
libeigen3-dev \
libenchant-dev \
libfftw3-dev \
libgsl-dev \
libhdf5-serial-dev \
libhwloc-dev \
libjpeg-dev \
liblapack-dev \
libnetcdf-dev \
libomp-dev \
libopenblas-dev \
libnuma-dev \
libpng-dev \
libproj-dev \
libreadline-dev \
libvtk6-dev \
libyaml-dev \
libzstd-dev \
make \
mpi-default-bin \
mpi-default-dev \
ninja-build \
python3-dev \
python3-pip \
python3-pkg-resources \
python3-setuptools \
python3-virtualenv \
rsync \
ssh \
texlive \
texlive-latex-recommended \
texlive-formats-extra \
texlive-pictures \
texlive-publishers \
texlive-science \
dvipng \
latexmk \
xindy \
vim-nox \
virtualenv \
voro++-dev \
wget \
xxd \
valgrind \
gdb \
zstd \
libyaml-cpp-dev \
libkim-api-dev \
openkim-models
###########################################################################
# Latest CMake (needed for OneAPI)
###########################################################################
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
apt update
apt install -y cmake
###########################################################################
# OneAPI
###########################################################################
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# add to your apt sources keyring so that archives signed with this key will be trusted.
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
# remove the public key
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list
add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
apt update
apt install -y \
intel-oneapi-compiler-dpcpp-cpp \
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic \
intel-oneapi-compiler-fortran \
intel-oneapi-dev-utilities \
intel-oneapi-openmp \
intel-oneapi-ipp-devel \
intel-oneapi-mpi-devel \
intel-oneapi-tbb-devel \
intel-oneapi-ippcp-devel \
intel-oneapi-ccl-devel \
intel-oneapi-dnnl-devel \
intel-oneapi-onevpl-devel \
intel-oneapi-dal-devel \
intel-oneapi-mkl-devel \
intel-oneapi-libdpstd-devel
###########################################################################
# KIM-API
###########################################################################
# workaround for installing files in /usr/share/doc inside of a container
sed -i 's/path-exclude=\/usr\/share\/doc/#path-exclude=\/usr\/share\/doc/g' /etc/dpkg/dpkg.cfg.d/excludes
apt-get install -y libkim-api-doc
sed -i 's/#path-exclude=\/usr\/share\/doc/path-exclude=\/usr\/share\/doc/g' /etc/dpkg/dpkg.cfg.d/excludes
# install KIM models
KIM_API_EXAMPLES=/usr/share/doc/libkim-api-dev/examples
gunzip $KIM_API_EXAMPLES/portable-models/LennardJones612_UniversalShifted__MO_959249795837_003/LennardJones612_UniversalShifted.params.gz
gunzip $KIM_API_EXAMPLES/model-drivers/ex_model_driver_P_LJ/ex_model_driver_P_LJ.f90.gz
kim-api-collections-management install system $KIM_API_EXAMPLES/model-drivers/LennardJones612__MD_414112407348_003
kim-api-collections-management install system $KIM_API_EXAMPLES/model-drivers/ex_model_driver_P_LJ
kim-api-collections-management install system $KIM_API_EXAMPLES/portable-models/LennardJones_Ar
kim-api-collections-management install system $KIM_API_EXAMPLES/portable-models/ex_model_Ar_P_LJ
kim-api-collections-management install system $KIM_API_EXAMPLES/portable-models/LennardJones612_UniversalShifted__MO_959249795837_003
kim-api-collections-management install system $KIM_API_EXAMPLES/simulator-models/Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu
###########################################################################
# Plumed
###########################################################################
export PLUMED_PKG_VERSION=2.7.2
mkdir plumed
cd plumed
curl -L -o plumed.tar.gz https://github.com/plumed/plumed2/releases/download/v${PLUMED_PKG_VERSION}/plumed-src-${PLUMED_PKG_VERSION}.tgz
tar -xzf plumed.tar.gz
cd plumed-${PLUMED_PKG_VERSION}
./configure --disable-doc --prefix=/usr
make
make install
cd ../../
rm -rvf plumed
###########################################################################
# Customizations
###########################################################################
# set custom prompt indicating the container name
CUSTOM_PROMPT_ENV=/.singularity.d/env/99-zz_custom_prompt.sh
cat >$CUSTOM_PROMPT_ENV <<EOF
#!/bin/bash
PS1="[ubuntu20.04_oneapi:\u@\h] \W> "
EOF
chmod 755 $CUSTOM_PROMPT_ENV
###########################################################################
# Cleanup
###########################################################################
# clean cache
rm -rf /var/lib/apt/lists/*
%environment
LC_ALL=C
export LC_ALL
export PATH=/usr/lib/ccache:$PATH
# tell OpenMPI to not try using Infiniband
OMPI_MCA_btl="^openib"
# do not warn about unused components as this messes up testing
OMPI_MCA_btl_base_warn_component_unused="0"
export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused
%labels
Author akohlmey, rbberger