Skip to content

Commit

Permalink
testing build with nvidia base (#1)
Browse files Browse the repository at this point in the history
* testing build with nvidia base
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Dec 21, 2022
1 parent 5f28eff commit 0594668
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 2 deletions.
100 changes: 100 additions & 0 deletions spack-nvidia/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
ARG tag="11.3.0-cudnn8-devel-ubuntu20.04"
FROM nvidia/cuda:${tag} as builder

ENV DEBIAN_FRONTEND=noninteractive
ENV SPACK_ROOT=/opt/spack-environment/spack
ARG spack_cpu_arch=x86_64
ARG build_jobs=6

RUN apt-get update && \
apt-get -y install \
apt-utils \
autotools-dev \
autoconf \
automake \
build-essential \
ca-certificates \
cmake \
curl \
dnsutils \
fftw3-dev fftw3 \
gfortran \
git \
libyaml-cpp-dev \
libedit-dev \
libnuma-dev \
libgomp1 \
libboost-graph-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-regex-dev \
munge \
openssh-server \
openssh-client \
python-yaml \
python3-jsonschema \
python3-pip \
python3-cffi \
python3 \
pdsh \
sudo \
unzip \
wget \
&& apt-get clean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir /opt/spack-environment \
&& (echo "spack:" \
&& echo " specs:" \
&& echo " - openmpi@4.1.2 target=${spack_cpu_arch}" \
&& echo " - flux-sched target=${spack_cpu_arch}" \
&& echo " - flux-pmix target=${spack_cpu_arch}" \
&& echo " concretizer:" \
&& echo " unify: true" \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " view: /opt/view") > /opt/spack-environment/spack.yaml

# Install the software, remove unnecessary deps
RUN cd /opt/spack-environment \
&& git clone --single-branch --branch v0.19.0 https://github.com/spack/spack.git \
&& . spack/share/spack/setup-env.sh \
&& spack env activate . \
&& spack external find openssh \
&& spack external find cmake \
&& spack external find python \
&& spack install --reuse --fail-fast \
&& spack gc -y

# Strip all the binaries
RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s

# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment \
&& . spack/share/spack/setup-env.sh \
&& spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh

# Important! The versions of flux with pmix won't work without this flag
# the flux-restful api added support via version 0.0.15 of the python client
ENV FLUX_OPTION_FLAGS="-ompi=openmpi@5"

# Make sure that flux owns the spack install (so we see it)
# We have to install python deps to system python because they are not
# seen in the spaaaaaaaaaaaaaaaaaaaaaaaaaack install
RUN sudo adduser --disabled-password --uid 1000 --gecos "" flux && \
chown -R flux /opt && \
sudo chmod -R +r /opt && \
sudo apt-get install python3-distutils && \
wget https://bootstrap.pypa.io/get-pip.py && \
sudo python3 -m pip install pyyaml jsonschema cffi

COPY ./etc.sudoers /etc/sudoers
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions spack-nvidia/uptodate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dockerbuild:
build_args:
tag:
key: "cuda"
versions:
- "11.3.0-cudnn8-devel-ubuntu20.04"
4 changes: 2 additions & 2 deletions flux-spack/Dockerfile → spack-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG ubuntu_version=20.04
FROM ubuntu:${ubuntu_version} as builder
ARG tag="20.04"
FROM ubuntu:${tag} as builder

ENV DEBIAN_FRONTEND=noninteractive
ENV SPACK_ROOT=/opt/spack-environment/spack
Expand Down
5 changes: 5 additions & 0 deletions spack-ubuntu/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

. /etc/profile.d/z10_spack_environment.sh

exec "$@"
31 changes: 31 additions & 0 deletions spack-ubuntu/etc.sudoers
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/view/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL
flux ALL=(ALL) NOPASSWD:ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
File renamed without changes.

0 comments on commit 0594668

Please sign in to comment.