Unverified Commit 3bdfbdcf authored by Richard Berger's avatar Richard Berger
Browse files

Update Ubuntu 18.04 GPU container and add Ubuntu 20.04

parent 60d25c2e
Loading
Loading
Loading
Loading
+85 −23
Original line number Diff line number Diff line
@@ -2,11 +2,11 @@ BootStrap: docker
From: ubuntu:18.04

%environment
    export PATH=/usr/lib/ccache:/usr/local/cuda-10.2/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
    export CUDADIR=/usr/local/cuda-10.2
    export CUDA_PATH=/usr/local/cuda-10.2
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.2/lib64
    export LIBRARY_PATH=/usr/local/cuda-10.2/lib64/stubs
    export PATH=/usr/lib/ccache:/usr/local/cuda-11.0/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
    export CUDADIR=/usr/local/cuda-11.0
    export CUDA_PATH=/usr/local/cuda-11.0
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64
    export LIBRARY_PATH=/usr/local/cuda-11.0/lib64/stubs
%post
    export DEBIAN_FRONTEND=noninteractive
    apt-get update
@@ -28,6 +28,8 @@ From: ubuntu:18.04
        build-essential

    apt-get install --no-install-recommends -y software-properties-common
    add-apt-repository ppa:openkim/latest
    apt-get update
    apt-get install --no-install-recommends -y \
        bc \
        build-essential \
@@ -36,30 +38,29 @@ From: ubuntu:18.04
        cmake \
        cmake-curses-gui \
        curl \
        doxygen \
        enchant \
        g++ \
        gcc \
        gfortran \
        git \
        hdf5-tools \
        kmod \
        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 \
        libvtk6-dev \
        libyaml-dev \
        libzstd-dev \
        make \
        mpi-default-bin \
        mpi-default-dev \
@@ -81,7 +82,15 @@ From: ubuntu:18.04
        wget \
        xxd \
        valgrind \
        gdb
        gdb \
        zstd \
        libkim-api-dev \
        openkim-models


    ###########################################################################
    # CUDA
    ###########################################################################

    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
    mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
@@ -89,7 +98,7 @@ From: ubuntu:18.04
    add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
    apt-get update

    export CUDA_PKG_VERSION=10.2
    export CUDA_PKG_VERSION=11.0

    apt-get install -y --no-install-recommends \
        cuda-libraries-$CUDA_PKG_VERSION \
@@ -97,37 +106,90 @@ From: ubuntu:18.04
        cuda-libraries-dev-$CUDA_PKG_VERSION \
        cuda-minimal-build-$CUDA_PKG_VERSION \
        cuda-compat-$CUDA_PKG_VERSION \
        libcublas10 \
        libcublas-dev
        libcublas-11-0 \
        libcublas-dev-11-0

    echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf
    echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf

    # add missing symlink
    ln -s /usr/local/cuda-11.0 /usr/local/cuda
    ln -s /usr/local/cuda-11.0/lib64/stubs/libcuda.so /usr/local/cuda-11.0/lib64/stubs/libcuda.so.1


    ###########################################################################
    # ROCm hipCUB
    ###########################################################################

    export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
    git clone -b master-rocm-3.5 https://github.com/ROCmSoftwarePlatform/hipCUB.git
    git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
    mkdir hipCUB/build
    cd hipCUB/build
    CXX=hipcc cmake -D BUILD_TEST=off ..
    make -j4
    make -j 8
    make package
    make install

    echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf
    echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf

    # clean cache
    rm -rf /var/lib/apt/lists/*
    ###########################################################################
    # KIM-API
    ###########################################################################

    # add missing symlink
    ln -s /usr/local/cuda-10.2 /usr/local/cuda
    ln -s /usr/local/cuda-10.2/lib64/stubs/libcuda.so /usr/local/cuda-10.2/lib64/stubs/libcuda.so.1
    # 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.6.1

    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 -j 8
    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="[ubuntu18/gpu:\u@\h] \W> "
PS1="[ubuntu18.04/gpu:\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
+200 −0
Original line number Diff line number Diff line
BootStrap: docker
From: ubuntu:20.04

%environment
    export PATH=/usr/lib/ccache:/usr/local/cuda-11.0/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
    export CUDADIR=/usr/local/cuda-11.0
    export CUDA_PATH=/usr/local/cuda-11.0
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64
    export LIBRARY_PATH=/usr/local/cuda-11.0/lib64/stubs
%post
    export DEBIAN_FRONTEND=noninteractive
    apt-get update
    apt-get upgrade --no-install-recommends -y

    apt-get install -y --no-install-recommends curl libnuma-dev gnupg

    curl -sL http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | apt-key add -
    # AMD is using xenial folder also for focal
    printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main" > /etc/apt/sources.list.d/rocm.list

    apt-get update
    apt-get install --no-install-recommends -y \
        kmod \
        file \
        sudo \
        libelf1 \
        rocm-dev \
        rocm-libs \
        build-essential

    apt-get install --no-install-recommends -y software-properties-common
    add-apt-repository ppa:openkim/latest
    apt-get update
    apt-get install --no-install-recommends -y \
        bc \
        build-essential \
        ccache \
        clang \
        cmake \
        cmake-curses-gui \
        curl \
        g++ \
        gcc \
        gfortran \
        git \
        hdf5-tools \
        less \
        libblas-dev \
        libeigen3-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 \
        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 \
        vim-nox \
        virtualenv \
        voro++-dev \
        wget \
        xxd \
        valgrind \
        gdb \
        zstd \
        libkim-api-dev \
        openkim-models


    ###########################################################################
    # CUDA
    ###########################################################################

    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
    mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
    apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
    add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
    apt-get update

    export CUDA_PKG_VERSION=11.0

    apt-get install -y --no-install-recommends \
        cuda-libraries-$CUDA_PKG_VERSION \
        cuda-command-line-tools-$CUDA_PKG_VERSION \
        cuda-libraries-dev-$CUDA_PKG_VERSION \
        cuda-minimal-build-$CUDA_PKG_VERSION \
        cuda-compat-$CUDA_PKG_VERSION \
        libcublas-11-0 \
        libcublas-dev-11-0

    echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf
    echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf

    # add missing symlink
    ln -s /usr/local/cuda-11.0 /usr/local/cuda
    ln -s /usr/local/cuda-11.0/lib64/stubs/libcuda.so /usr/local/cuda-11.0/lib64/stubs/libcuda.so.1


    ###########################################################################
    # ROCm hipCUB
    ###########################################################################

    export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64
    git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git
    mkdir hipCUB/build
    cd hipCUB/build
    CXX=hipcc cmake -D BUILD_TEST=off ..
    make -j 8
    make package
    make install


    ###########################################################################
    # 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.6.1

    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/gpu:\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
    # 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 rbberger, akohlmey