Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions .github/workflows/ghci-snl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

compiler:
runs-on: ubuntu-latest
needs: base
Expand Down Expand Up @@ -136,13 +137,27 @@ jobs:
BASE_TAG=${{ github.event_name == 'pull_request' && format('base-pr-{0}', github.event.pull_request.number) || 'base' }}
cache-from: type=gha,scope=${{ matrix.compiler }}
cache-to: type=gha,scope=${{ matrix.compiler }},mode=max
gnu-cpu-env:

final-env:
runs-on: ubuntu-latest
needs: compiler
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
include:
- compiler: gnu
tag: gnu-cpu-env
version: 13.3.0
- compiler: gnu
tag: gnu-cuda-env
version: 13.3.0
- compiler: intel
tag: intel-cpu-env
version: 2024.1.0

steps:
- name: Checkout
Expand All @@ -168,22 +183,22 @@ jobs:
with:
images: ghcr.io/${{ github.repository_owner }}/e3sm-ghci-snl
tags: |
type=raw,value=gnu-cpu-env,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=pr,prefix=gnu-cpu-env-pr-
type=ref,event=branch,prefix=gnu-cpu-env-
type=match,pattern=ghci-snl-(.*),group=1,prefix=gnu-cpu-env
type=raw,value=${{ matrix.tag }},enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=pr,prefix=${{ matrix.tag }}-pr-
type=ref,event=branch,prefix=${{ matrix.tag }}-
type=match,pattern=ghci-snl-(.*),group=1,prefix=${{ matrix.tag }}-
labels: |
org.opencontainers.image.description=GNU env image for E3SM ghci-snl testing on CPU on GitHub actions
org.opencontainers.image.description=${{ matrix.tag }} image for E3SM ghci-snl testing on CPU on GitHub actions

- name: Push
uses: docker/build-push-action@v6
with:
context: ghci-snl/env/gnu-cpu
file: ghci-snl/env/gnu-cpu/Dockerfile
context: ghci-snl/final/${{ matrix.tag }}
file: ghci-snl/final/${{ matrix.tag }}/Dockerfile
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_TAG=${{ github.event_name == 'pull_request' && format('gnu-13.3.0-pr-{0}', github.event.pull_request.number) || 'gnu-13.3.0' }}
cache-from: type=gha
cache-to: type=gha,mode=max
BASE_TAG=${{ matrix.compiler }}-${{ matrix.version }}${{ github.event_name == 'pull_request' && format('-pr-{0}', github.event.pull_request.number) || '' }}
cache-from: type=gha,scope=${{ matrix.tag }}
cache-to: type=gha,scope=${{ matrix.tag }},mode=max
28 changes: 17 additions & 11 deletions ghci-snl/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
FROM registry.access.redhat.com/ubi9-minimal:latest

# 1. Setup EPEL repository
# 1. Setup certificates
RUN microdnf update -y && \
microdnf install -y ca-certificates && \
update-ca-trust && \
microdnf clean all && \
rm -rf /var/cache/dnf

ENV SSL_CERT_DIR=/etc/pki/tls/certs \
SSL_CERT_FILE=/etc/pki/tls/cert.pem

# 2. Setup EPEL repository
RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/epel*.repo && \
microdnf clean all && \
rm -rf /var/cache/dnf

# 2. Core build tools & compilers
# 3. Core build tools & compilers
RUN microdnf -y install \
binutils \
bzip2-devel \
Expand All @@ -29,15 +33,15 @@ RUN microdnf -y install \
&& microdnf clean all \
&& rm -rf /var/cache/dnf

# 3. Scripting runtimes (python & perl)
# 4. Scripting runtimes (python & perl)
RUN microdnf -y install \
perl-devel \
python3 \
python3-pip \
&& microdnf clean all \
&& rm -rf /var/cache/dnf

# 4. Utilities, archiving & environment tools
# 5. Utilities, archiving & environment tools
RUN microdnf -y --enablerepo=epel install \
bind-utils \
bzip2 \
Expand All @@ -52,12 +56,13 @@ RUN microdnf -y --enablerepo=epel install \
sudo \
tar \
unzip \
vi \
wget \
xz \
&& microdnf clean all \
&& rm -rf /var/cache/dnf

# 5. Locales configuration
# 6. Locales configuration
RUN microdnf -y install \
glibc-langpack-en \
&& microdnf clean all \
Expand All @@ -68,7 +73,7 @@ ENV LANG=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8

# 6. Setup SPACK
# 7. Setup SPACK
ARG SPACK_VER=v0.23.1
ENV SPACK_ROOT=/spack \
SPACK_ARCH=linux-rhel9-x86_64 \
Expand All @@ -82,10 +87,11 @@ ADD spack-configuration/packages.yaml /spack-configuration/packages.yaml
ADD spack-configuration/config.yaml /spack-configuration/config.yaml
ADD spack-configuration/mirrors.yaml /spack-configuration/mirrors.yaml

# 7. Setup project directory & user shell environment
RUN mkdir -p /projects/e3sm/software /projects/e3sm/data /opt/share && \
echo 'bind "\"\\e[A\": history-search-backward"' > /opt/share/bash-goodies.sh && \
echo 'bind "\"\\e[B\": history-search-forward"' >> /opt/share/bash-goodies.sh && \
echo 'git config --global url."https://github.com/".insteadOf git@github.com:' >> /opt/share/bash-goodies.sh
# 8. Setup project directory & user shell environment
RUN mkdir -p /projects/e3sm/software /projects/e3sm/data

RUN echo 'bind "\"\\e[A\": history-search-backward"' > /etc/profile.d/eamxx-env.sh && \
echo 'bind "\"\\e[B\": history-search-forward"' >> /etc/profile.d/eamxx-env.sh && \
echo 'git config --global url."https://github.com/".insteadOf git@github.com:' >> /etc/profile.d/eamxx-env.sh

CMD [ "/bin/bash" ]
2 changes: 1 addition & 1 deletion ghci-snl/compiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN source /spack/share/spack/setup-env.sh && source /etc/profile.d/compiler_nam
# to be re-installed with diff compiler, and lmod to reload the proper version.
# This is 100% fine, but would produce rather lengthy warnings.
RUN source /etc/profile.d/compiler_name.sh && \
echo "source /etc/profile.d/modules.sh" > /etc/profile.d/eamxx-env.sh && \
echo "source /etc/profile.d/modules.sh" >> /etc/profile.d/eamxx-env.sh && \
echo "MODULEPATH=/modulefiles/${SPACK_ARCH}/Core" >> /etc/profile.d/eamxx-env.sh && \
echo "export LMOD_EXPERT=1" >> /etc/profile.d/eamxx-env.sh && \
echo "export LMOD_DISABLE_WARNINGS=yes" >> /etc/profile.d/eamxx-env.sh && \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_TAG=base
ARG BASE_TAG=UNSET
ARG BASE_IMAGE=ghcr.io/e3sm-project/e3sm-ghci-snl
FROM ${BASE_IMAGE}:${BASE_TAG}

Expand Down Expand Up @@ -67,7 +67,7 @@ RUN microdnf install -y autoconf automake libtool && \

RUN . /etc/profile.d/eamxx-env.sh && \
git clone https://github.com/e3sm-project/e3sm /tmp/e3sm && \
cd /tmp/e3sm && . /opt/share/bash-goodies.sh && git submodule update --init cime
cd /tmp/e3sm && git submodule update --init cime

RUN . /etc/profile.d/eamxx-env.sh && \
curl -fsSL "https://bitbucket.org/fathomteam/moab/raw/vijaysm/automated-build-scripts/install/install-bootstrap.sh?cb=$RANDOM" > /tmp/install-bootstrap.sh && \
Expand Down
69 changes: 69 additions & 0 deletions ghci-snl/final/gnu-cuda-env/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
ARG BASE_TAG=UNSET
ARG NVIDIA_DRIVER_VERSION=535
Comment thread
mahf708 marked this conversation as resolved.
ARG BASE_IMAGE=ghcr.io/e3sm-project/e3sm-ghci-snl
FROM ${BASE_IMAGE}:${BASE_TAG}

# Install packages in chunks, so we can tweak versions of some pkg without
# rebuilding the whole image. Hence, put "stable" pkgs first to minimize rebuild time
# NOTE: the env vars COMPILER, COMPILER_VERSION, and SPACK_ARCH are defined in the base image

# Common utilities
RUN source /spack/share/spack/setup-env.sh && \
spack install yaml-cpp cmake %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Common scientific libs (non-MPI dependent)
RUN source /spack/share/spack/setup-env.sh && \
spack install boost netlib-lapack %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# CUDA
RUN source /spack/share/spack/setup-env.sh && \
spack install cuda@12.4.0 %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# MPI
RUN source /spack/share/spack/setup-env.sh && \
spack install mpich@4.1.1 %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Netcdf libraries
RUN source /spack/share/spack/setup-env.sh && \
spack install netcdf-c+mpi netcdf-fortran parallel-netcdf %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Make sure the modules for the installed packages are all available
RUN source /spack/share/spack/setup-env.sh && \
spack module lmod refresh -y --delete-tree

# Generate the profile.d script to load them all at bash startup
RUN echo "module load yaml-cpp cmake" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load boost netlib-lapack" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load cuda" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load mpich" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load netcdf-c netcdf-fortran parallel-netcdf" >> /etc/profile.d/eamxx-env.sh

# Install numpy/cupy
RUN source /etc/profile.d/modules.sh && \
source /etc/profile.d/eamxx-env.sh && \
Comment thread
mahf708 marked this conversation as resolved.
LIBRARY_PATH="$CUDA_HOME/lib64/stubs:$LIBRARY_PATH" \
python3 -m pip install numpy cupy

# Install pytorch
RUN source /etc/profile.d/modules.sh && \
source /etc/profile.d/eamxx-env.sh && \
python3 -m pip install \
--extra-index-url https://download.pytorch.org/whl/cu124 \
torch==2.6.0+cu124

# Whomever will run the container will be able to pip install pkgs in the venv
# After all, the container is ephemeral/disposable, so there's no persistent state
RUN chmod -R a+rwX /projects/e3sm/software/eamxx-venv

# Clean up garbage packages that were only needed to BUILD other pkgs (not to USE them)
RUN source /spack/share/spack/setup-env.sh && spack gc -y

# Remove spack repo (except .git, so you can restore it) and spack buildcache (to keep image size under control)
RUN rm -rf /spack-buildcache && \
rm -rf /spack/*

# CIME tests need a bunch of perl
RUN microdnf install -y perl

ENTRYPOINT []
CMD [ "/bin/bash", "--login" ]
58 changes: 58 additions & 0 deletions ghci-snl/final/intel-cpu-env/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ARG BASE_TAG=UNSET
ARG BASE_IMAGE=ghcr.io/e3sm-project/e3sm-ghci-snl
FROM ${BASE_IMAGE}:${BASE_TAG}

# Install packages in chunks, so we can tweak versions of some pkg without
# rebuilding the whole image. Hence, put "stable" pkgs first to minimize rebuild time
# NOTE: the env vars COMPILER, COMPILER_VERSION, and SPACK_ARCH are defined in the base image

# Common utilities
RUN source /spack/share/spack/setup-env.sh && \
spack install yaml-cpp cmake %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Common scientific libs (non-MPI dependent)
RUN source /spack/share/spack/setup-env.sh && \
spack install boost intel-oneapi-mkl %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# MPI and Netcdf libraries
RUN source /spack/share/spack/setup-env.sh && \
spack install openmpi@4.1.4 netcdf-c+mpi netcdf-fortran parallel-netcdf %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Debugging libs
RUN source /spack/share/spack/setup-env.sh && \
spack install valgrind@3.20~mpi %${COMPILER}@${COMPILER_VERSION} arch=${SPACK_ARCH}

# Make sure the modules for the installed packages are all available
RUN source /spack/share/spack/setup-env.sh && \
spack module lmod refresh -y --delete-tree

# Generate the profile.d script to load them all at bash startup
RUN echo "module load yaml-cpp cmake" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load boost intel-oneapi-mkl" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load openmpi" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load netcdf-c netcdf-fortran parallel-netcdf" >> /etc/profile.d/eamxx-env.sh
RUN echo "module load valgrind" >> /etc/profile.d/eamxx-env.sh

# Install pytorch
RUN source /etc/profile.d/modules.sh && \
source /etc/profile.d/eamxx-env.sh && \
python3 -m pip install \
--extra-index-url https://download.pytorch.org/whl/cpu \
torch numpy

# Whomever will run the container will be able to pip install pkgs in the venv
# After all, the container is ephemeral/disposable, so there's no persistent state
RUN chmod -R a+rwX /projects/e3sm/software/eamxx-venv

# Clean up garbage packages that were only needed to BUILD other pkgs (not to USE them)
RUN source /spack/share/spack/setup-env.sh && spack gc -y

# Remove spack repo (except .git, so you can restore it) and spack buildcache (to keep image size under control)
RUN rm -rf /spack-buildcache && \
rm -rf /spack/*

# CIME tests need a bunch of perl
RUN microdnf install -y perl

ENTRYPOINT []
CMD [ "/bin/bash", "--login" ]
Loading