-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create updated Ubuntu ECP image/CI job #120
Merged
kwryankrattiger
merged 7 commits into
SENSEI-insitu:develop
from
willdunklin:ubuntu-test-image
Jun 28, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
17cb93b
Add Ubuntu ecp test image
willdunklin 2508276
Update build script to use ghcr.io
willdunklin 85e79de
Update CI job to use updated Ubuntu image
willdunklin 48576ad
Make buildcaches extractable into docker images
willdunklin 2c18de6
Remove fedora test image/runner
willdunklin bc58004
Change buildcache location to sensei ghcr.io
willdunklin e8c2ae8
Update CI job image
willdunklin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
5 changes: 3 additions & 2 deletions
5
.../ci/configure_fedora35_ecp_catalyst.cmake → ...ub/ci/configure_ubuntu_ecp_catalyst.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
set(SENSEI_USE_EXTERNAL_pugixml ON CACHE BOOL "") | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_adios2.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_ascent.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_catalyst.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_hdf5.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_python3.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_vtkio.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_python3.cmake) | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/configure_fedora35.cmake) | ||
include(${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
buildcache* | ||
*-log.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM alpine | ||
|
||
# Install Pre-reqs and Spack | ||
COPY buildcache /buildcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# SENSEI Spack Buildcache | ||
|
||
This directory contains the spack binary buildcache for SENSEI's dependencies. | ||
|
||
Use of buildcaches speeds up the build process for iterating SENSEI CI containers. | ||
|
||
## Extracting a buildcache from a working CI image | ||
|
||
SENSEI uses CI docker images to perform automated testing. These CI images are built | ||
using the `build_image.sh` script. Occasionally development needs to be performed on | ||
the CI image themselves, which can be an arduous process given the need to rebuild | ||
SENSEI and all of its dependencies in Spack. To speed up this process, SENSEI uses | ||
buildcaches to speed up the build process. | ||
|
||
The `extract_buildcache.sh` script will extract the buildcache from a built SENSEI | ||
CI docker image and create a new minimal docker image containing the buildcache. | ||
|
||
To use the `extract_buildcache.sh` script, specify the source CI image you'd like to | ||
extract built binaries from. If no image is specified, the script will use the most | ||
recent `sensei-insitu/ci-ecp` image found locally. The script will then extract the | ||
buildcache to a local volume, and run a docker built to create a new buildcache image. | ||
This image is tagged with the operating system, compiler and architecture of the | ||
source CI image to ensure compatibility. | ||
|
||
## How buildcaches are used in SENSEI CI images | ||
|
||
SENSEI CI images are built with the `build_image.sh` script. This script builds a CI | ||
docker image based on a preexisting buildcache docker image. The script will identify | ||
the proper buildcache image tag for the CI environment, and attempt to use the | ||
prebuilt binaries if they are available. If the buildcache image is not in the | ||
container registry, it defaults to using the `empty` tagged image. | ||
|
||
`build_image.sh` invokes a docker build that uses the buildcache image as an | ||
intermediate layer to mount copy the buildcache into the CI image. The buildcache is | ||
then used speed up the to build the SENSEI CI image. The buildcache is not included | ||
in the final image. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
|
||
IMAGE=$1 | ||
if [[ -z $1 ]]; then | ||
echo "No image specified. Using latest sensei-insitu/ci-ecp image." | ||
IMAGE=$(docker image list | grep sensei-insitu/ci-ecp | awk '{ print $1 ":" $2 }' | head -n 1) | ||
fi | ||
echo "Using image: ${IMAGE}" | ||
echo | ||
|
||
tag=$(docker run -it --rm --volume "$(pwd):/sensei/cache" ${IMAGE} /sensei/bin/tag.sh | tr -d '\r') | ||
buildcache_container=ghcr.io/sensei-insitu/sensei-buildcache | ||
|
||
# append the buildcache to the prior version | ||
IMAGE_EXISTS=$(docker manifest inspect $buildcache_container:$tag | grep "layers") | ||
if [[ -n ${IMAGE_EXISTS} ]]; then | ||
echo "Found existing buildcache version: $tag" | ||
echo "Appending to image." | ||
|
||
# clear the buildcache folder | ||
docker run -it --rm --volume "$(pwd):/cache" alpine rm -rf /cache/buildcache | ||
|
||
container=$(docker run --detach $buildcache_container:$tag) | ||
docker cp $container:/buildcache ./buildcache | ||
docker rm -f $container | ||
else | ||
echo "Buildcache version $tag not found, using empty buildcache." | ||
fi | ||
|
||
# generate the buildcache from CI image | ||
docker run -it --rm --volume "$(pwd):/sensei/cache" ${IMAGE} \ | ||
bin/launch-env.sh \ | ||
spack buildcache create --force --allow-root --unsigned /sensei/cache/buildcache | ||
|
||
docker build -t $buildcache_container:$tag . | ||
docker push $buildcache_container:$tag | ||
|
||
# cleanup the buildcache directory, sometimes this has root permissions | ||
docker run -it --rm --volume "$(pwd):/cache" alpine rm -rf /cache/buildcache |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
.github/ci/docker/fedora35-ecp-catalyst/install-prereqs.sh
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ARG BUILDCACHE_VERSION=empty | ||
FROM ubuntu:20.04 AS init_spack | ||
|
||
ENV SPACK_PYTHON=/usr/bin/python3 | ||
ENV SPACK_ROOT=/opt/spack | ||
ENV SENSEI_ENV=sensei | ||
|
||
# Install Pre-reqs and Spack | ||
COPY install-prereqs.sh /sensei/tmp/ | ||
COPY spack.yaml /sensei/tmp/ | ||
COPY modules.yaml $SPACK_ROOT/etc/spack/ | ||
RUN /sensei/tmp/install-prereqs.sh | ||
COPY tag.sh /sensei/bin/ | ||
|
||
FROM ghcr.io/sensei-insitu/sensei-buildcache:$BUILDCACHE_VERSION AS buildcache | ||
|
||
# Install SENSEI deps with spack | ||
FROM init_spack AS build_sensei | ||
COPY --from=buildcache /buildcache /sensei/buildcache | ||
COPY install-deps.sh /sensei/tmp/ | ||
RUN /sensei/tmp/install-deps.sh | ||
|
||
WORKDIR /sensei/ | ||
COPY configure-env.sh /sensei/bin/ | ||
COPY launch-env.sh /sensei/bin/ | ||
RUN echo ". /sensei/bin/configure-env.sh" >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
. ${SPACK_ROOT}/share/spack/setup-env.sh | ||
|
||
SPACK_LMOD_ROOT=$(spack find --paths lmod | grep ^lmod@ | awk '{ print $2 }') | ||
. ${SPACK_LMOD_ROOT}/lmod/lmod/init/bash | ||
|
||
if [[ -z ${SENSEI_ENV} ]]; then | ||
echo "No environment configured." | ||
exit 1 | ||
fi | ||
|
||
export CMAKE_CONFIGURATION=ubuntu_ecp_catalyst | ||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
export OMPI_ALLOW_RUN_AS_ROOT=1 | ||
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 | ||
|
||
spack env activate ${SENSEI_ENV} | ||
|
||
module use ${SPACK_ROOT}/share/spack/lmod/linux-ubuntu20.04-x86_64/Core | ||
module load openmpi ninja swig | ||
|
||
. ${SPACK_ROOT}/var/spack/environments/${SENSEI_ENV}/loads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
|
||
source ${SPACK_ROOT}/share/spack/setup-env.sh | ||
spack env activate ${SENSEI_ENV} | ||
{ | ||
ls /sensei/buildcache/build_cache && \ | ||
spack mirror add sensei /sensei/buildcache && \ | ||
spack buildcache update-index sensei | ||
} || { | ||
echo "Error: Failed to install buildcache." | ||
echo " Skipping buildcache installation..." | ||
} | ||
|
||
# install | ||
N_THREADS=$(grep -c '^processor' /proc/cpuinfo) | ||
spack install -v --use-cache --no-check-signature -j ${N_THREADS} | ||
spack install -v --use-cache --no-check-signature -j ${N_THREADS} sensei | ||
|
||
# cleanup | ||
spack clean -a | ||
rm -rf /root/.spack /sensei/tmp /sensei/buildcache | ||
|
||
# load modules | ||
spack module lmod refresh -y | ||
spack env loads -m lmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -xe | ||
|
||
export DEBIAN_FRONTEND="noninteractive" | ||
apt-get update -y | ||
apt-get install -y file git curl \ | ||
build-essential software-properties-common \ | ||
tar xz-utils bzip2 gzip unzip \ | ||
python3 python3-pip ccache \ | ||
patch patchelf libtool \ | ||
vim | ||
|
||
add-apt-repository ppa:ubuntu-toolchain-r/test -y | ||
apt-get update -y | ||
apt-get install -y gcc-11 g++-11 gfortran-11 | ||
|
||
# Install spack | ||
mkdir -p ${SPACK_ROOT} | ||
cd ${SPACK_ROOT} | ||
git init | ||
git remote add origin https://github.com/spack/spack.git | ||
git fetch origin develop | ||
git checkout -f develop | ||
|
||
rm -rf .git | ||
|
||
source ${SPACK_ROOT}/share/spack/setup-env.sh | ||
spack compiler find --scope site | ||
|
||
# Extra packages required by SENSEI test scripts (Not used by spack) | ||
apt-get install -y bc | ||
apt-get clean -y | ||
|
||
# Setup sensei environment | ||
spack env create ${SENSEI_ENV} | ||
cp /sensei/tmp/spack.yaml ${SPACK_ROOT}/var/spack/environments/${SENSEI_ENV} | ||
spack env activate ${SENSEI_ENV} | ||
spack concretize -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
. /sensei/bin/configure-env.sh | ||
|
||
$@ |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this we also want to add
--only dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, actually I think we want to remove the next line, considering this should also install an up to date lmod. Is the splitting between dependencies and the packages important for this script?