Skip to content

Commit

Permalink
Add GitHub Actions workflow for Docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke committed Nov 29, 2023
1 parent 24b859e commit 1e06823
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 44 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
58 changes: 58 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Create and publish Docker images

on:
push: { branches: [ unstable ] }
pull_request: { branches: [ unstable ] }
workflow_call:
workflow_dispatch:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
include:
- name: github_ci
#- name: jenkins_ci # flatironinstitute/cthyb:master-ubuntu-clang not accessible
- name: mpich
- name: openmpi
#- name: triqs_default # flatironinstitute/triqs:unstable-ubuntu-clang not accessible

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}_${{ matrix.name }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./Docker
file: ./Docker/${{ matrix.name }}_dockerfile
build-args: |
NCORES=2
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
3 changes: 3 additions & 0 deletions Docker/github_ci_dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ ENV CPATH=/triqs/include:${CPATH} \
LD_LIBRARY_PATH=/triqs/lib:${LD_LIBRARY_PATH} \
PYTHONPATH=/triqs/lib/python3.10/site-packages:${PYTHONPATH} \
CMAKE_PREFIX_PATH=/triqs/share/cmake:${CMAKE_PREFIX_PATH} \
CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} \
CTEST_OUTPUT_ON_FAILURE=1 \
CTEST_PARALLEL_LEVEL=${NCORES} \
TRIQS_ROOT=/triqs

RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs \
Expand Down
100 changes: 57 additions & 43 deletions Docker/mpich_dockerfile
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:jammy
FROM ubuntu:22.04
ARG LLVM=15

##################################################
# Essential packages and libraries #
Expand All @@ -16,7 +17,7 @@ RUN apt-get update && \
cmake \
# OpenMP problem
libmkl-gnu-thread \
libomp-dev \
libomp-${LLVM}-dev \
libgomp1 \
# Vasp, doesn't work with newer gfortran versions
gfortran \
Expand All @@ -30,8 +31,10 @@ RUN apt-get update && \
# For TRIQS
libgmp-dev \
libhdf5-dev \
clang \
libclang-dev \
clang-${LLVM} \
libclang-${LLVM}-dev \
libc++-${LLVM}-dev \
libc++abi-${LLVM}-dev \
libboost-dev \
python3-pip \
python3-setuptools \
Expand Down Expand Up @@ -102,65 +105,75 @@ RUN pip3 install --no-cache-dir \
##################################################

# set some compiler flags
ENV CFLAGS="-m64 -O3 -Wl,--no-as-needed"
ENV CXXFLAGS="-m64 -O3 -Wl,--no-as-needed"
ENV LDFLAGS="-ldl -lm"
ENV FFLAGS="-m64 -O3"
ENV PYTHON_VERSION=3.10 CC=mpicc.mpich MPICH_CC=clang-${LLVM} CXX=mpicxx.mpich MPICH_CXX=clang++-${LLVM}
ENV CXXFLAGS="-stdlib=libc++"

# triqs
RUN cd / && mkdir -p triqs && mkdir -p source

RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs triqs.src \
&& mkdir -p triqs.build && cd triqs.build \
&& cmake ../triqs.src -DCMAKE_INSTALL_PREFIX=/triqs \
-DBLAS_LIBRARIES=/lib/x86_64-linux-gnu/libmkl_rt.so \
-DLIBCLANG_LOCATION=/usr/lib/llvm-13/lib/libclang.so \
&& make -j2
RUN cd /source/triqs.build && make -j2 test && make install
ENV OMP_NUM_THREADS=1
ENV MKL_NUM_THREADS=1
ENV MKL_INTERFACE_LAYER=GNU,LP64
ENV MKL_THREADING_LAYER=SEQUENTIAL
ARG NCORES=10

ENV CPATH=/triqs/include:${CPATH}
ENV CPATH=/triqs/include:/usr/include/mkl:${CPATH}
ENV PATH=/triqs/bin:${PATH}
ENV LIBRARY_PATH=/triqs/lib:${LIBRARY_PATH}
ENV LD_LIBRARY_PATH=/triqs/lib:${LD_LIBRARY_PATH}
ENV PYTHONPATH=/triqs/lib/python3.10/site-packages:${PYTHONPATH}
ENV CMAKE_PREFIX_PATH=/triqs/share/cmake:${CMAKE_PREFIX_PATH}
ENV CMAKE_BUILD_PARALLEL_LEVEL=${NCORES}
ENV CTEST_OUTPUT_ON_FAILURE=1
ENV CTEST_PARALLEL_LEVEL=${NCORES}
ENV TRIQS_ROOT=/triqs

# triqs
RUN cd / && mkdir -p triqs && mkdir -p source

RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs triqs.src \
&& mkdir -p triqs.build && cd triqs.build \
&& cmake ../triqs.src -DCMAKE_INSTALL_PREFIX=/triqs -DBLA_VENDOR=Intel10_64_dyn \
&& make -j$NCORES && ctest -j$NCORES && make install

# dft_tools
RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/dft_tools.git dft_tools.src \
&& mkdir -p dft_tools.build && cd dft_tools.build \
&& cmake ../dft_tools.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j2 && make -j2 test && make install
&& make -j$NCORES && ctest -j$NCORES test && make install

# cthyb
RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/cthyb.git cthyb.src \
&& mkdir -p cthyb.build && cd cthyb.build \
&& cmake ../cthyb.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j2 && make -j2 test && make install
&& make -j$NCORES && make -j$NCORES test && make install

# maxent
RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/maxent.git maxent.src \
&& mkdir -p maxent.build && cd maxent.build \
&& cmake ../maxent.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j2 && make -j2 test && make install
&& make -j$NCORES && make -j$NCORES test && make install

# ctint
# ADD ctint-3.0.x.tar.gz /source/ctint.src
# RUN cd /source && mkdir -p ctint.build && cd ctint.build \
# && cmake ../ctint.src -DCMAKE_INSTALL_PREFIX=/triqs \
# && make -j2 && make -j2 test && make install
# && make -j$NCORES && make -j$NCORES test && make install

# hubbardI
RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/hubbardI hubbardI.src \
&& mkdir -p hubbardI.build && cd hubbardI.build \
&& cmake ../hubbardI.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j2 && make -j2 test && make install
&& make -j$NCORES && make -j$NCORES test && make install

# hartree_fock
RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/hartree_fock.git hartree_fock.src \
&& mkdir -p hartree_fock.build && cd hartree_fock.build \
&& cmake ../hartree_fock.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j$NCORES && ctest -j$NCORES && make install

# solid_dmft
RUN cd /source && git clone -b unstable --depth 1 https://github.com/flatironinstitute/solid_dmft.git solid_dmft.src \
&& mkdir -p solid_dmft.build && cd solid_dmft.build \
&& cmake ../solid_dmft.src -DCMAKE_INSTALL_PREFIX=/triqs \
&& make -j2 && make -j2 test && make install
&& make -j$NCORES && make -j$NCORES test && make install


##################################################
Expand All @@ -173,24 +186,25 @@ RUN cd / && git clone -b v3.1.0 --depth 1 https://github.com/wannier-developers/
# Make gfort use the intel libraries
COPY wannier90.make.inc /wannier90/make.inc
RUN cd /wannier90 && make default lib && rm -r test-suite

# TODO: include scalapack
# Adds modified VASP for CSC calculations
ADD vasp.6.3.0.tgz /
RUN mv /vasp.6.3.0 /vasp
COPY mpich_vasp.makefile /vasp/makefile.include
COPY vasp_diffs /vasp/vasp_diffs
RUN cd /vasp/src \
&& for name in electron.F fileio.F locproj.F mlwf.F .objects; \
do patch $name -p1 -i ../vasp_diffs/$name; done

# Install vasp
# TODO: add ncl
RUN cd /vasp/ \
&& make std \
&& rm -rf src/ build/ arch/ vasp_diffs/ testsuite/

ENV PATH=/vasp/bin:/wannier90:${PATH}
ENV PATH=/wannier90:${PATH}

## TODO: include scalapack
## Adds modified VASP for CSC calculations
#ADD vasp.6.3.0.tgz /
#RUN mv /vasp.6.3.0 /vasp
#COPY mpich_vasp.makefile /vasp/makefile.include
#COPY vasp_diffs /vasp/vasp_diffs
#RUN cd /vasp/src \
# && for name in electron.F fileio.F locproj.F mlwf.F .objects; \
# do patch $name -p1 -i ../vasp_diffs/$name; done
#
## Install vasp
## TODO: add ncl
#RUN cd /vasp/ \
# && make std \
# && rm -rf src/ build/ arch/ vasp_diffs/ testsuite/
#
#ENV PATH=/vasp/bin:${PATH}

##################################################
# Cleanup #
Expand Down
Empty file modified Docker/mpich_dockerfile_vasp5
100755 → 100644
Empty file.
5 changes: 4 additions & 1 deletion Docker/openmpi_dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ RUN cd /source && wget --quiet https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-q
#ENV PATH=/vasp/bin:${PATH}

# triqs
ENV CPATH=/triqs/include:${CPATH} \
ENV CPATH=/triqs/include:/usr/include/mkl:${CPATH} \
PATH=/triqs/bin:${PATH} \
LIBRARY_PATH=/triqs/lib:${LIBRARY_PATH} \
LD_LIBRARY_PATH=/triqs/lib:${LD_LIBRARY_PATH} \
PYTHONPATH=/triqs/lib/python3.10/site-packages:${PYTHONPATH} \
CMAKE_PREFIX_PATH=/triqs/share/cmake:${CMAKE_PREFIX_PATH} \
CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} \
CTEST_OUTPUT_ON_FAILURE=1 \
CTEST_PARALLEL_LEVEL=${NCORES} \
TRIQS_ROOT=/triqs

RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/triqs triqs.src \
Expand Down

0 comments on commit 1e06823

Please sign in to comment.