Skip to content

Commit

Permalink
Merge pull request #1162 from LLNL/feature/han12/docker_tutorial
Browse files Browse the repository at this point in the history
Docker Image for AWS Tutorial
  • Loading branch information
bmhan12 committed Dec 15, 2023
2 parents 9410ed3 + 6634449 commit 18fbecd
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 0 deletions.
69 changes: 69 additions & 0 deletions scripts/docker/dockerfile_gcc-9_cuda-11
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Docker image for Axom tutorial with CUDA support.
# Docker container runs a VS Code server accessible through a web browser.
# Docker and openvscode setup based on the RAJA suite tutorial:
# https://github.com/LLNL/raja-suite-tutorial/tree/main/containers/tutorial

# This script can be run with the following command from the root axom directory:
# docker build --build-arg branch=<your branch here, defaults to develop> -t "axom/tpls:gcc-9-cuda-11" -f ./scripts/docker/dockerfile_gcc-9_cuda-11 .

# Command to launch openvscode server with the resulting docker image:
# docker run --init --gpus all --restart=always -p 3000:3000 <image id>

FROM ghcr.io/rse-ops/cuda-ubuntu-20.04:cuda-11.1.1
# Tutorial branch
ARG branch=develop
ARG USER=axomdev
ENV HOME /home/${USER}

SHELL ["/bin/bash", "-c"]
RUN sudo apt-get update -y
RUN sudo apt-get install -y supervisor
RUN sudo useradd --create-home --shell /bin/bash ${USER}
RUN sudo apt-get install doxygen gfortran graphviz language-pack-en-base less libopenblas-dev libomp-dev mpich python3-sphinx ssh texlive-full tree -fy

WORKDIR /opt/archives
RUN curl -L https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.69.1/openvscode-server-v1.69.1-linux-x64.tar.gz > \
/opt/archives/openvscode-server-v1.69.1-linux-x64.tar.gz
RUN tar xzf openvscode-server-v1.69.1-linux-x64.tar.gz && chown -R ${USER}:${USER} openvscode-server-v1.69.1-linux-x64

WORKDIR ${HOME}
USER ${USER}

# Clone axom at axom_repo directory
RUN git clone --recursive --branch $branch https://github.com/LLNL/axom.git axom_repo

# Build/install TPLs via spack and then remove the temporary build directory on success
RUN cd ${HOME}/axom_repo && python3 ./scripts/uberenv/uberenv.py --spack-env-file=./scripts/spack/configs/docker/ubuntu20_cuda/spack.yaml \
--project-json=.uberenv_config.json \
--spec="%gcc@9.3.0+mfem+cuda cuda_arch=70" \
--prefix=${HOME}/axom_tpls -k \
&& rm -rf ${HOME}/axom_tpls/builds

# Make sure the new hostconfig works with a release build
# Note: having high job slots causes build log to disappear and job to fail
# Omit testing step, hangs at slam_lulesh unit test (same behavior for azure pipeline images, as well)
RUN cd ${HOME}/axom_repo && python3 config-build.py -hc *cuda.cmake \
-bp ${HOME}/axom_repo/build-release \
-ip ${HOME}/axom_repo/install-release \
-bt Release \
&& cd ${HOME}/axom_repo/build-release \
&& make -j4 install

# Larger STL meshes for testing (optional)
# Note: These meshes are large, copied from local directory instead of
# downloaded from Github.
# COPY boxedSphere.stl car.stl porsche.stl ${HOME}/axom_repo/data/quest


# Create symlinks for easy access to tutorial material (optional)
# RUN ln -s ${HOME}/axom_repo/install-release/examples/axom/radiuss_tutorial/ ${HOME}/radiuss_tutorial \
# && ln -s ${HOME}/axom_repo/data/quest ${HOME}/radiuss_tutorial/stl_meshes

USER root
ADD ./scripts/docker/supervisord.conf /etc/supervisord.conf
RUN sed -i "s/XXX/${USER}/g" /etc/supervisord.conf

RUN touch /var/log/openvscode-server.log && chown -R ${USER}:${USER} /var/log/openvscode-server.log

CMD ["/usr/bin/supervisord"]

12 changes: 12 additions & 0 deletions scripts/docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; Supervisor config file to run the OpenVSCode server

[supervisord]
nodaemon = true
user = XXX
logfile = /tmp/supervisord.log

[program:openvscode-server]
environment=HOME="/home/XXX",USER="XXX"
redirect_stderr = true
stdout_logfile = /var/log/openvscode-server.log
command = /opt/archives/openvscode-server-v1.69.1-linux-x64/bin/openvscode-server --without-connection-token --host 0.0.0.0
201 changes: 201 additions & 0 deletions scripts/spack/configs/docker/ubuntu20_cuda/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and
# Axom Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)

spack:
config:
install_tree:
root: $spack/..
projections:
all: '{compiler.name}-{compiler.version}/{name}-{version}-{hash}'
misc_cache: $spack/../misc_cache
test_stage: $spack/../test_stage
build_stage::
- $spack/../build_stage

# Regular TPLs do not need views
view: false

compilers::
- compiler:
environment: {}
extra_rpaths: []
flags:
cflags: -pthread
cxxflags: -pthread
modules: []
operating_system: ubuntu20.04
paths:
cc: /usr/bin/clang
cxx: /usr/bin/clang++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
spec: clang@10.0.0
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags:
cflags: -pthread
cxxflags: -pthread
modules: []
operating_system: ubuntu20.04
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
spec: gcc@11.1.0
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags:
cflags: -pthread
cxxflags: -pthread
modules: []
operating_system: ubuntu20.04
paths:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
spec: gcc@9.3.0
target: x86_64

packages:
all:
# This defaults us to machine specific flags of ivybridge which allows
# us to run on broadwell as well
target: [x86_64]
compiler: [gcc, intel, pgi, clang, xl, nag]
providers:
awk: [gawk]
blas: [openblas]
lapack: [openblas]
daal: [intel-daal]
elf: [elfutils]
golang: [gcc]
ipp: [intel-ipp]
java: [jdk]
mkl: [intel-mkl]
mpe: [mpe2]
mpi: [mpich]
opencl: [pocl]
openfoam: [openfoam-com, openfoam-org, foam-extend]
pil: [py-pillow]
scalapack: [netlib-scalapack]
szip: [libszip, libaec]
tbb: [intel-tbb]
jpeg: [libjpeg-turbo, libjpeg]

# Spack may grab for mpi & we don't want to use them
mpi:
buildable: false
mpich:
externals:
- spec: mpich@3.3
prefix: /usr

# System level packages to not build
autotools:
buildable: false
externals:
- spec: autotools@2.69
prefix: /usr
bzip2:
buildable: false
externals:
- spec: bzip2@1.0.6
prefix: /usr
cuda:
buildable: false
externals:
- spec: cuda@11.1.1
prefix: /usr/local/cuda
gettext:
buildable: false
externals:
- spec: gettext@0.19.8.1
prefix: /usr
m4:
buildable: false
externals:
- spec: m4@1.4.18
prefix: /usr
perl:
buildable: false
externals:
- spec: perl@5.26.1
prefix: /usr
pkg-config:
buildable: false
externals:
- spec: pkg-config@0.29.1
prefix: /usr
tar:
buildable: false
externals:
- spec: tar@1.29
prefix: /usr
graphviz:
buildable: false
externals:
- spec: graphviz@2.40.1
prefix: /usr
openblas:
buildable: false
externals:
- spec: openblas@0.2.20
prefix: /usr
ncurses:
buildable: false
externals:
- spec: ncurses@6.2
prefix: /opt/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-9.3.0/

# Globally lock version of third party libraries
camp:
require: "@2023.06.0"
conduit:
require: "@0.8.8~shared~test~examples~utilities"
hdf5:
variants: ~shared~mpi
hypre:
version: [2.24.0]
# do shared mfem to allow PIC flag in mfem
mfem:
require: "@4.5.2+shared~static"
raja:
require: "@2023.06.0~shared~examples~exercises"
scr:
require: "@develop~shared"
umpire:
require: "@2023.06.0~shared~examples"

# Globally lock in version of devtools
cmake:
version: [3.20.4]
buildable: false
externals:
- spec: cmake@3.20.4
prefix: /opt/view
doxygen:
version: [1.8.17]
buildable: false
externals:
- spec: doxygen@1.8.17
prefix: /usr
llvm:
version: [10.0.0]
buildable: false
externals:
- spec: llvm@10.0.0+clang
prefix: /usr
py-sphinx:
version: [1.8.5]
buildable: false
externals:
- spec: py-sphinx@1.8.5
prefix: /usr

0 comments on commit 18fbecd

Please sign in to comment.