From 1e0682359d23edbf3888190837291eda82f16cc1 Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Sat, 11 Nov 2023 15:24:09 +0100 Subject: [PATCH] Add GitHub Actions workflow for Docker images --- .github/dependabot.yml | 6 ++ .github/workflows/docker.yml | 58 ++++++++++++++++++++ Docker/github_ci_dockerfile | 3 + Docker/mpich_dockerfile | 100 +++++++++++++++++++--------------- Docker/mpich_dockerfile_vasp5 | 0 Docker/openmpi_dockerfile | 5 +- 6 files changed, 128 insertions(+), 44 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/docker.yml mode change 100755 => 100644 Docker/mpich_dockerfile mode change 100755 => 100644 Docker/mpich_dockerfile_vasp5 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..5ace4600 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..d733b147 --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 diff --git a/Docker/github_ci_dockerfile b/Docker/github_ci_dockerfile index 4833d2e8..449dd78a 100644 --- a/Docker/github_ci_dockerfile +++ b/Docker/github_ci_dockerfile @@ -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 \ diff --git a/Docker/mpich_dockerfile b/Docker/mpich_dockerfile old mode 100755 new mode 100644 index 679a2c81..511e6f12 --- a/Docker/mpich_dockerfile +++ b/Docker/mpich_dockerfile @@ -1,4 +1,5 @@ -FROM ubuntu:jammy +FROM ubuntu:22.04 +ARG LLVM=15 ################################################## # Essential packages and libraries # @@ -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 \ @@ -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 \ @@ -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 ################################################## @@ -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 # diff --git a/Docker/mpich_dockerfile_vasp5 b/Docker/mpich_dockerfile_vasp5 old mode 100755 new mode 100644 diff --git a/Docker/openmpi_dockerfile b/Docker/openmpi_dockerfile index 2bc7f3b1..1db31cc8 100644 --- a/Docker/openmpi_dockerfile +++ b/Docker/openmpi_dockerfile @@ -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 \