Skip to content

Commit

Permalink
add docker tests for spack build centos image (QMCPACK#4404)
Browse files Browse the repository at this point in the history
* add docker tests for spack build centos image

* change os to ubuntu, githubrunners have a limited list of supported os's

* debug output path

* update path and lib path

* syntax errror

* update env variable mapping

* forgot to update variable name in runs script

* migrate version to gcc11, remove gcc-toolset

* update job names, add missing PATH path

* update build scripts to account for new cases of cmake

* update actual job names, not just matrix

* add /opt/view/lib to library path to access spack libraries

* syntax error in runscript

* added includes from spack

* export fftw_home to help find fftw

* try to add include folder through cxxflags

* remove cxxflags, manually specify libxml vars

* use libxml_root instead

* add hdf5 root

* add boost root

* update binutils to version compatible with gcc11

* added rsync to image, apparently missing

* * try running tests with +binutils build spack container

* syntax error

* syntax error

* add back glib fix

* Revert "add back glib fix"

This reverts commit b61ed0b.

* Revert "syntax error"

This reverts commit 4794104.

* Revert "syntax error"

This reverts commit 493f2f6.

* Revert "* try running tests with +binutils build spack container"

This reverts commit 1390eeb.
  • Loading branch information
walshmm authored Mar 5, 2023
1 parent 4148d9f commit f5fbadb
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 3 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci-github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,56 @@ jobs:

- name: Install
run: tests/test_automation/github-actions/ci/run_step.sh install

spack-centos-stream:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
env:
GH_JOBNAME: ${{ matrix.jobname }}
GH_OS: Linux
CONTAINER_OS: spack-centos-stream
strategy:
fail-fast: false
matrix:
jobname:
[
GCC11-NoMPI-Debug-Real,
GCC11-NoMPI-NoOMP-Real,
GCC11-NoMPI-NoOMP-Complex,
GCC11-NoMPI-Sandbox-Real,
]
include:
- jobname: GCC11-NoMPI-Debug-Real
container:
image: walshmm/qmcpack-ci:centos-stream-gcc11
options: -u 1001
- jobname: GCC11-NoMPI-NoOMP-Real
container:
image: walshmm/qmcpack-ci:centos-stream-gcc11
options: -u 1001
- jobname: GCC11-NoMPI-NoOMP-Complex
container:
image: walshmm/qmcpack-ci:centos-stream-gcc11
options: -u 1001
- jobname: GCC11-NoMPI-Sandbox-Real
container:
image: walshmm/qmcpack-ci:centos-stream-gcc11
options: -u 1001

steps:
- name: Checkout Action
uses: actions/checkout@v3

- name: Echo Debug
run: |
echo $PATH
echo $LD_LIBRARY_PATH
- name: Configure
run: tests/test_automation/github-actions/ci/run_step.sh configure

- name: Build
run: tests/test_automation/github-actions/ci/run_step.sh build

- name: Test
run: tests/test_automation/github-actions/ci/run_step.sh test
86 changes: 86 additions & 0 deletions config/docker/dependencies/centos-stream/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Build stage with Spack pre-installed and ready to be used
FROM spack/centos-stream as builder


# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)

RUN which tar
RUN tar -cf tarfilename.tar -T /dev/null

RUN spack install [email protected]
RUN spack load [email protected]
RUN spack compiler add $(spack location -i [email protected])
RUN spack compilers

RUN yum install texinfo -y

RUN mkdir /opt/spack-environment \
&& export gcc_vnew=11.3.0\
&& export cmake_vnew=3.24.2 \
&& export libxml2_v=2.9.13 \
&& export boost_vnew=1.79.0 \
&& export hdf5_vnew=1.12.2 \
&& export fftw_vnew=3.3.10 \
&& (echo "spack:" \
&& echo " specs:" \
&& echo " - gcc@${gcc_vnew}%gcc@${gcc_vnew}" \
&& echo " - texinfo" \
&& echo " - binutils" \
&& echo " - git" \
&& echo " - ninja" \
&& echo " - cmake@${cmake_vnew}" \
&& echo " - libxml2@${libxml2_v}%gcc@${gcc_vnew}" \
&& echo " - boost@${boost_vnew}%gcc@${gcc_vnew}" \
&& echo " - util-linux-uuid%gcc@${gcc_vnew}" \
&& echo " - python%gcc@${gcc_vnew}" \
&& echo " - hdf5@${hdf5_vnew}%gcc@${gcc_vnew} +fortran +hl ~mpi" \
&& echo " - fftw@${fftw_vnew}%gcc@${gcc_vnew} -mpi" \
&& echo " - openblas%gcc@${gcc_vnew} threads=openmp" \
&& echo " - py-lxml" \
&& echo " - py-matplotlib" \
&& echo " - py-pandas" \
&& echo " - py-scipy" \
&& echo " - py-h5py ^hdf5@${hdf5_vnew}%gcc@${gcc_vnew} +fortran +hl ~mpi" \
&& echo " concretizer:" \
&& echo " unify: true" \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " build_stage:" \
&& echo " - $HOME" \
&& echo " view: /opt/view") > /opt/spack-environment/spack.yaml


# Install the software, remove unnecessary deps
RUN cd /opt/spack-environment && spack env activate . && spack install --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 env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh

# Bare OS image to run the installed executables
FROM quay.io/centos/centos:stream

COPY --from=builder /opt/spack-environment /opt/spack-environment
COPY --from=builder /opt/software /opt/software
COPY --from=builder /opt/._view /opt/._view
COPY --from=builder /opt/view /opt/view
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh

# building from source is missing ld (the linker)
RUN yum install -y gcc-toolset-11-binutils
RUN yum install -y rsync
RUN export PATH=/opt/rh/gcc-toolset-11/root/bin/:$PATH
RUN yum install -y libgcc.i686 glibc-devel.i686 libstdc++-devel.i686
RUN ranlib /opt/view/lib/gcc/x86_64-pc-linux-gnu/11.3.0/libgcc.a

ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c", "$*", "--" ]
CMD [ "/bin/bash" ]

30 changes: 27 additions & 3 deletions tests/test_automation/github-actions/ci/run_step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,32 @@ case "$1" in
echo "LD_LIBRARY_PATH=/opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9:$LD_LIBRARY_PATH" >> $GITHUB_ENV
fi

if [[ "$CONTAINER_OS" =~ (centos) ]]
then
# use spack
export PATH=/opt/rh/gcc-toolset-11/root/bin/:/opt/view:/opt/view/bin:/opt/spack/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`which gcc|sed 's/bin\/gcc/lib64/g'`
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/view/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/view/include
export FFTW_HOME=/opt/view
export LibXml2_ROOT=/opt/view
export HDF5_ROOT=/opt/view
export BOOST_ROOT=/opt/view


# Make current environment variables available to subsequent steps
echo "PATH=/opt/rh/gcc-toolset-11/root/bin/:/opt/view:/opt/view/bin:/opt/spack/bin:$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`which gcc|sed 's/bin\/gcc/lib64/g'`" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/view/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/view/include" >> $GITHUB_ENV
echo "FFTW_HOME=/opt/view" >> $GITHUB_ENV
echo "LibXml2_ROOT=/opt/view" >> $GITHUB_ENV
echo "HDF5_ROOT=/opt/view" >> $GITHUB_ENV
echo "BOOST_ROOT=/opt/view" >> $GITHUB_ENV
fi

case "${GH_JOBNAME}" in
*"GCC9-NoMPI-Debug-"*)
*"GCC9-NoMPI-Debug-"*|*"GCC11-NoMPI-Debug-"*)
echo 'Configure for debug mode to capture asserts with gcc'
cmake -GNinja \
-DCMAKE_C_COMPILER=gcc \
Expand All @@ -113,7 +137,7 @@ case "$1" in
-DCMAKE_BUILD_TYPE=Debug \
${GITHUB_WORKSPACE}
;;
*"GCC9-NoMPI-NoOMP-"*)
*"GCC9-NoMPI-NoOMP-"*|*"GCC11-NoMPI-NoOMP-"*)
echo 'Configure for disabling OpenMP with QMC_OMP=0'
cmake -GNinja \
-DCMAKE_C_COMPILER=gcc \
Expand All @@ -124,7 +148,7 @@ case "$1" in
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
${GITHUB_WORKSPACE}
;;
*"GCC9-NoMPI-Sandbox-"*)
*"GCC9-NoMPI-Sandbox-"*|*"GCC11-NoMPI-Sandbox-"*)
echo 'Configure for enabling sandbox (minimal) only option with gcc'
cmake -GNinja \
-DCMAKE_C_COMPILER=gcc \
Expand Down

0 comments on commit f5fbadb

Please sign in to comment.