From 763f4690c95dd25893b795e2d48fe4a57f3fbe1f Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Sat, 23 Dec 2023 19:35:19 +0100 Subject: [PATCH] [build] Add GitHub Actions workflow for Docker images (#66) * Add GitHub Actions workflow for Docker images * Batch Dependabot updates * Make python3 default by installing python-is-python3 * update nodejs installation and silence w90 wget/tar * Install Python dependencies via APT * Backport linkify-it-py --------- Co-authored-by: Alexander Hampel --- .github/dependabot.yml | 10 ++ .github/workflows/docker.yml | 57 ++++++++++ Docker/github_ci_dockerfile | 86 ++++++++------ Docker/jupyter_start.sh | 4 +- Docker/mpich_dockerfile | 192 +++++++++++++++----------------- Docker/mpich_dockerfile_vasp5 | 0 Docker/openmpi_dockerfile | 162 ++++++++++++++------------- Docker/triqs_default_dockerfile | 16 --- 8 files changed, 294 insertions(+), 233 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 delete mode 100644 Docker/triqs_default_dockerfile diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..228ed394 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + batch: + patterns: + - "*" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..34a01c37 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,57 @@ +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: openmpi + + 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 + # cache pkgs layer in dockerfile + no-cache-filters: pkgs + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.name }} + cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.name }} diff --git a/Docker/github_ci_dockerfile b/Docker/github_ci_dockerfile index 4833d2e8..fd5bd6f1 100644 --- a/Docker/github_ci_dockerfile +++ b/Docker/github_ci_dockerfile @@ -1,66 +1,78 @@ -FROM ubuntu:22.04 +FROM ubuntu:22.04 AS base RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + ca-certificates \ cmake \ + curl \ + cython3 \ + debhelper \ + dh-python \ g++-12 \ gfortran-12 \ git \ hdf5-tools \ - liblapack-dev \ libboost-dev \ libfftw3-dev \ - libnfft3-dev \ libgfortran5 \ libgmp-dev \ libhdf5-dev \ + liblapack-dev \ + libnfft3-dev \ + libomp-dev \ libopenmpi-dev \ - cython3 \ + libpython3-dev \ openmpi-bin \ openmpi-common \ openmpi-doc \ + openssl \ + pandoc \ + python-is-python3 \ + python3-ase \ + python3-decorator \ python3-dev \ + python3-jinja2 \ python3-mako \ - python3-numpy \ - python3-scipy \ python3-matplotlib \ + python3-monty \ python3-mpi4py \ - python3-pip \ - python3-sphinx \ + python3-myst-parser \ python3-nbsphinx \ - python3-skimage \ python3-notebook \ - libpython3-dev \ - curl \ - ca-certificates \ - openssl \ - wget \ + python3-numpy \ + python3-pip \ + python3-pytest \ + python3-scipy \ + python3-shapely \ + python3-skimage \ + python3-sphinx \ + python3-sphinx-rtd-theme \ rsync \ - libomp-dev \ sudo \ - nodejs \ - npm \ && \ apt-get autoremove --purge -y && \ apt-get autoclean -y && \ rm -rf /var/cache/apt/* /var/lib/apt/lists/* -RUN pip3 install --no-cache-dir \ - cython \ - decorator \ - pytest \ - shapely \ - monty \ - mpi4py \ - Jinja2 \ - Mako \ - ase \ - tornado \ - zmq \ - tk \ - myst_parser \ - sphinx_rtd_theme \ - linkify-it-py \ - Pandoc +# linkify-it-py (required by sphinx doc build) is not available in Ubuntu 22.04 as package +# the following manually installs it and its only dependency uc-micro-py +RUN mkdir -p /src && cd /src \ + && curl -LOOO http://archive.ubuntu.com/ubuntu/pool/universe/u/uc-micro-py/uc-micro-py_1.0.1{-3.dsc,.orig.tar.xz,-3.debian.tar.xz} \ + && dpkg-source -x uc-micro-py_1.0.1-3.dsc \ + && cd uc-micro-py-1.0.1 \ + && DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -d -uc -us \ + && cd - \ + && apt-get install ./python3-uc-micro_1.0.1-3_all.deb \ + && curl -LOOO http://archive.ubuntu.com/ubuntu/pool/universe/l/linkify-it-py/linkify-it-py_2.0.0{-1.dsc,.orig.tar.gz,-1.debian.tar.xz} \ + && dpkg-source -x linkify-it-py_2.0.0-1.dsc \ + && cd linkify-it-py-2.0.0/ \ + && DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -d -uc -us \ + && cd - \ + && apt-get install ./python3-linkify-it_2.0.0-1_all.deb \ + && cd / && rm -rf /src + +# the above is cached by the github action workflow +FROM base AS pkgs ENV OMP_NUM_THREADS=1 ENV MKL_NUM_THREADS=1 @@ -81,6 +93,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 \ @@ -121,6 +136,3 @@ RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/maxen # remove source RUN cd / && rm -rf source -# make python3 default -RUN `ln -s /usr/bin/python3 /usr/bin/python` - diff --git a/Docker/jupyter_start.sh b/Docker/jupyter_start.sh index 4a003126..c410ac5a 100644 --- a/Docker/jupyter_start.sh +++ b/Docker/jupyter_start.sh @@ -1,4 +1,4 @@ #!/bin/bash -# start script for jupyterlab -jupyter-lab --no-browser --port 8378 --ip=0.0.0.0 +# start script for jupyter notebook +jupyter notebook --no-browser --port 8378 --ip=0.0.0.0 diff --git a/Docker/mpich_dockerfile b/Docker/mpich_dockerfile old mode 100755 new mode 100644 index 679a2c81..54ee5308 --- a/Docker/mpich_dockerfile +++ b/Docker/mpich_dockerfile @@ -1,4 +1,5 @@ -FROM ubuntu:jammy +FROM ubuntu:22.04 AS base +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,23 +31,39 @@ 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 \ + jupyter-notebook \ + pandoc \ + python-is-python3 \ + python3-ase \ + python3-decorator \ + python3-dev \ + python3-jinja2 \ + python3-mako \ + python3-matplotlib \ + python3-monty \ + python3-mpi4py \ + python3-myst-parser \ + python3-nbsphinx \ + python3-notebook \ + python3-numpy \ + python3-pandas \ python3-pip \ + python3-pytest \ + python3-scipy \ python3-setuptools \ - python3-dev \ + python3-shapely \ + python3-skimage \ + python3-sphinx \ + python3-sphinx-rtd-theme \ libfftw3-dev \ libnfft3-dev \ less \ vim \ -# Jupyter lab packages - texlive \ - dvipng \ - texlive-latex-extra \ - texlive-fonts-recommended \ - nodejs \ - npm \ && \ apt-get autoremove --purge -y && \ apt-get autoclean -y && \ @@ -59,138 +76,113 @@ RUN apt-get update && \ RUN ldconfig -v -################################################## -# Python modules # -################################################## - -# Install python packages -RUN pip3 install --no-cache-dir \ - cython \ - numpy \ - scipy \ - matplotlib \ - decorator \ - jupyter \ - ipywidgets \ - pytest \ - pylint \ - pandas \ - shapely \ - monty \ - mpi4py \ - pymatgen \ - Jinja2 \ - Mako \ - tornado \ - zmq \ - notebook \ - tk \ - scikit-image \ - # Jupyter lab packages - jupyterlab \ - descartes \ - ipympl \ - RISE - -# jupyter lab extension -# TODO: fix, right now it crashes with "nodejs required" -#RUN jupyter-labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib @jupyterlab/toc -#RUN jupyter-lab build - ################################################## # TRIQS and its packages # ################################################## # 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 +################################################## +# Wannier90 and VASP # +################################################## + +# W90 +# Uncomment the lines in this and the following VASP block to have W90 as a library in VASP, allowing for the tag LWANNIER90=.TRUE. +RUN cd / && git clone -b v3.1.0 --depth 1 https://github.com/wannier-developers/wannier90.git +# Make gfort use the intel libraries +COPY wannier90.make.inc /wannier90/make.inc +RUN cd /wannier90 && make default lib && rm -r test-suite +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} + +FROM base AS pkgs + +# 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 - - -################################################## -# Wannier90 and VASP # -################################################## - -# W90 -# Uncomment the lines in this and the following VASP block to have W90 as a library in VASP, allowing for the tag LWANNIER90=.TRUE. -RUN cd / && git clone -b v3.1.0 --depth 1 https://github.com/wannier-developers/wannier90.git -# Make gfort use the intel libraries -COPY wannier90.make.inc /wannier90/make.inc -RUN cd /wannier90 && make default lib && rm -r test-suite + && make -j$NCORES && make -j$NCORES test && make install -# 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} ################################################## # 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..a4656079 100644 --- a/Docker/openmpi_dockerfile +++ b/Docker/openmpi_dockerfile @@ -1,63 +1,92 @@ -FROM ubuntu:22.04 +FROM ubuntu:22.04 AS base ARG LLVM=15 -# install basics -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl sudo wget git less rsync nano openssl ca-certificates make vim - -# for nodejs 20 -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - - # This platform includes dependencies for building docs RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + clang-${LLVM} \ cmake \ + curl \ + cython3 \ + debhelper \ + dh-python \ g++ \ gfortran \ - llvm-${LLVM}-dev \ - libclang-${LLVM}-dev \ - clang-${LLVM} \ - libc++-${LLVM}-dev \ - libc++abi-${LLVM}-dev \ + git \ hdf5-tools \ - libmkl-full-dev \ - libopenblas-dev \ + jupyter-notebook \ libboost-dev \ + libc++-${LLVM}-dev \ + libc++abi-${LLVM}-dev \ + libclang-${LLVM}-dev \ + libevent-dev \ + libfabric-dev \ libfftw3-dev \ - libnfft3-dev \ libgfortran5 \ libgmp-dev \ libhdf5-dev \ libhwloc-dev \ - libevent-dev \ - libpmi2-0-dev \ - cython3 \ - # comment the next 4 lines if you want to build openmpi manually + libmkl-dev \ + libnfft3-dev \ + libomp-${LLVM}-dev \ + libopenblas-dev \ libopenmpi-dev \ + libpmi2-0-dev \ + libpython3-dev \ + llvm-${LLVM}-dev \ openmpi-bin \ openmpi-common \ openmpi-doc \ - libfabric-dev \ - libomp-${LLVM}-dev \ - nodejs \ + pandoc \ + python-is-python3 \ + python3-ase \ + python3-clang-${LLVM} \ + python3-decorator \ python3-dev \ + python3-jinja2 \ python3-mako \ - python3-numpy \ - python3-scipy \ python3-matplotlib \ - python3-pip \ - python3-sphinx \ - python3-clang-${LLVM} \ - python3-skimage \ + python3-monty \ + python3-mpi4py \ + python3-myst-parser \ python3-nbsphinx \ python3-notebook \ - libpython3-dev \ + python3-numpy \ + python3-pandas \ + python3-pip \ + python3-pymatgen \ + python3-pytest \ + python3-scipy \ + python3-shapely \ + python3-skimage \ + python3-sphinx \ + python3-sphinx-rtd-theme \ && \ apt-get autoremove --purge -y && \ apt-get autoclean -y && \ rm -rf /var/cache/apt/* /var/lib/apt/lists/* - + +# linkify-it-py (required by sphinx doc build) is not available in Ubuntu 22.04 as package +# the following manually installs it and its only dependency uc-micro-py +RUN mkdir -p /src && cd /src \ + && curl -LOOO http://archive.ubuntu.com/ubuntu/pool/universe/u/uc-micro-py/uc-micro-py_1.0.1{-3.dsc,.orig.tar.xz,-3.debian.tar.xz} \ + && dpkg-source -x uc-micro-py_1.0.1-3.dsc \ + && cd uc-micro-py-1.0.1 \ + && DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -d -uc -us \ + && cd - \ + && apt-get install ./python3-uc-micro_1.0.1-3_all.deb \ + && curl -LOOO http://archive.ubuntu.com/ubuntu/pool/universe/l/linkify-it-py/linkify-it-py_2.0.0{-1.dsc,.orig.tar.gz,-1.debian.tar.xz} \ + && dpkg-source -x linkify-it-py_2.0.0-1.dsc \ + && cd linkify-it-py-2.0.0/ \ + && DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -d -uc -us \ + && cd - \ + && apt-get install ./python3-linkify-it_2.0.0-1_all.deb \ + && cd / && rm -rf /src + # install openmpi and compile openmpi manually # this is to ensure PMI compatibility with cray systems -# RUN wget -q https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz \ +# RUN curl -LO https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz \ # && tar xf openmpi-4.1.5.tar.gz \ # && cd openmpi-4.1.5 \ # && ./configure --prefix=/usr --enable-mpi-cxx --with-libfabric=/usr \ @@ -71,35 +100,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins # && cd .. \ # && rm -rf openmpi-4.1.5.tar.gz openmpi-4.1.5 -RUN pip3 install --no-cache-dir \ - mpi4py \ - cython \ - decorator \ - jupyter \ - ipywidgets \ - pytest \ - pandas \ - shapely \ - monty \ - mpi4py \ - pymatgen \ - ase \ - Jinja2 \ - Mako \ - tornado \ - zmq \ - notebook \ - tk \ - myst_parser \ - sphinx_rtd_theme \ - linkify-it-py \ - Pandoc \ - # Jupyter lab packages - jupyterlab \ - descartes \ - ipympl \ - RISE - ENV PYTHON_VERSION=3.10 \ CC=clang-${LLVM} CXX=clang++-${LLVM} CXXFLAGS="-stdlib=libc++" RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM} 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM} --slave /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-${LLVM} @@ -108,15 +108,19 @@ 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 OMPI_ALLOW_RUN_AS_ROOT=1 +ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 +ENV OMPI_MCA_rmaps_base_oversubscribe="yes" +ENV OMPI_MCA_btl_vader_single_copy_mechanism=none +ARG NCORES=20 # create source dirs RUN cd / && mkdir -p triqs && mkdir -p source # W90 -RUN cd /source && git clone -b develop --depth 1 https://github.com/wannier-developers/wannier90.git wannier90 \ - && cd wannier90 \ - # Using gfortran compiler +RUN cd /source && curl -Lo wannier90.tar.gz https://github.com/wannier-developers/wannier90/archive/d141f9f.tar.gz \ + && tar xf wannier90.tar.gz --xform='s/-d141f9f84dcd3ac54729b9e5874dabd451684237//g' && cd wannier90 \ + # Using gfortran compiler && echo "F90 = mpif90 \n COMMS = mpi \n MPIF90 = mpif90 \n FCOPTS = -O3 -fallow-argument-mismatch \n LIBS = -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl \n" > make.inc \ && cd /source/wannier90 \ && make PREFIX=/triqs wannier lib post w90chk2chk \ @@ -125,7 +129,7 @@ RUN cd /source && git clone -b develop --depth 1 https://github.com/wannier-deve && cp src/obj/* /triqs/include/ # install qe -RUN cd /source && wget --quiet https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-qe-7.2.tar.gz \ +RUN cd /source && curl -LO https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-qe-7.2.tar.gz \ && tar -xf q-e-qe-7.2.tar.gz \ && cd q-e-qe-7.2 \ && mkdir -p build && cd build \ @@ -139,7 +143,7 @@ RUN cd /source && wget --quiet https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-q -D QE_WANNIER90_INTERNAL=OFF \ -D WANNIER90_ROOT=/triqs \ ../ \ - && make -j$NCORES all \ + && make -j$NCORES all \ && make install # VASP for CSC calculations @@ -158,30 +162,37 @@ RUN cd /source && wget --quiet https://gitlab.com/QEF/q-e/-/archive/qe-7.2/q-e-q #ENV PATH=/vasp/bin:${PATH} +# the above is cached by the github action workflow +FROM base AS pkgs + # 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} \ + BLA_VENDOR=Intel10_64_dyn \ TRIQS_ROOT=/triqs 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 -DMPIEXEC_PREFLAGS='--allow-run-as-root' -DBLA_VENDOR=Intel10_64_dyn \ + && cmake ../triqs.src -DCMAKE_INSTALL_PREFIX=/triqs \ && 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 -DMPIEXEC_PREFLAGS='--allow-run-as-root' \ + && cmake ../dft_tools.src \ && make -j$NCORES && ctest -j$NCORES && 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 -DMPIEXEC_PREFLAGS='--allow-run-as-root' \ + && cmake ../cthyb.src \ && make -j$NCORES && ctest -j$NCORES && make install # maxent @@ -193,13 +204,13 @@ RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/maxen # TPRF RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/tprf.git tprf.src \ && mkdir -p tprf.build && cd tprf.build \ - && cmake ../tprf.src -DMPIEXEC_PREFLAGS='--allow-run-as-root' \ + && cmake ../tprf.src \ && make -j$NCORES && make test && make install # hubbardI RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/hubbardI.git hubbardI.src \ && mkdir -p hubbardI.build && cd hubbardI.build \ - && cmake ../hubbardI.src \ + && cmake ../hubbardI.src \ && make -j$NCORES && ctest -j$NCORES && make install # hartree_fock @@ -211,7 +222,7 @@ RUN cd /source && git clone -b unstable --depth 1 https://github.com/TRIQS/hartr # download solid_dmft and install 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 -DMPIEXEC_PREFLAGS='--allow-run-as-root' \ + && cmake ../solid_dmft.src \ && make test && make install # remove source @@ -219,10 +230,6 @@ RUN cd / && rm -rf source # create a useful work dir RUN cd / && mkdir work && cd work -ENV OMPI_MCA_btl_vader_single_copy_mechanism=none - -# make python3 default -RUN `ln -s /usr/bin/python3 /usr/bin/python` # expose port for jupyter EXPOSE 8378 @@ -236,4 +243,3 @@ RUN ["chmod", "+x", "/usr/local/bin/jupyter.sh"] # change user and group id to match host machine if options are passed accordingly ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - diff --git a/Docker/triqs_default_dockerfile b/Docker/triqs_default_dockerfile deleted file mode 100644 index fb7c6045..00000000 --- a/Docker/triqs_default_dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# See ../triqs/packaging for other options -FROM flatironinstitute/triqs:unstable-ubuntu-clang -ARG APPNAME=solid_dmft - -COPY requirements.txt /src/$APPNAME/requirements.txt -RUN pip3 install -r /src/$APPNAME/requirements.txt - -COPY --chown=build . $SRC/$APPNAME -WORKDIR $BUILD/$APPNAME -RUN chown build . -USER build -ARG BUILD_ID -ARG CMAKE_ARGS -RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} $CMAKE_ARGS && make -j4 || make -j1 VERBOSE=1 -USER root -RUN make install