From b3f62cda5ae9b28d06274df03d71e7fa8e630746 Mon Sep 17 00:00:00 2001 From: Oliviero Andreussi Date: Fri, 21 Jun 2024 12:03:25 -0600 Subject: [PATCH 01/27] Bring back parallel gather in get_dvtot --- src/main.f90 | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main.f90 b/src/main.f90 index 50c862d..b745cf7 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -717,24 +717,45 @@ END FUNCTION get_vzero !> !! !------------------------------------------------------------------------------------ - FUNCTION get_dvtot(this, nnr) RESULT(dvtot) + FUNCTION get_dvtot(this, nnr, gather) RESULT(dvtot) !-------------------------------------------------------------------------------- ! INTEGER, INTENT(IN) :: nnr + LOGICAL, INTENT(IN), OPTIONAL :: gather CLASS(environ_main), INTENT(IN) :: this ! REAL(DP) :: dvtot(nnr) ! + LOGICAL :: use_gather CHARACTER(LEN=80) :: routine = 'get_dvtot' ! !-------------------------------------------------------------------------------- ! - IF (nnr /= this%dvtot%cell%nnr) & - CALL io%error(routine, "Mismatch in grid size", 1) + use_gather = .FALSE. + IF (PRESENT(gather)) use_gather = gather + ! + IF (.NOT.use_gather .AND. nnr /= this%dvtot%cell%nnr) THEN + CALL io%error(routine, "Mismatch in local grid size", 1) + ELSE IF (use_gather .AND. nnr /= this%dvtot%cell%nnt) THEN + CALL io%error(routine, "Mismatch in global grid size", 1) + ENDIF ! !-------------------------------------------------------------------------------- ! - dvtot = this%dvtot%of_r + IF (use_gather) THEN +#if defined(__MPI) + dvtot = 0.D0 + ! + CALL env_gather_grid(this%setup%system_cell%dfft, this%dvtot%of_r, dvtot) + ! + CALL env_mp_sum(dvtot, this%setup%system_cell%dfft%comm) + ! +#else + dvtot = this%dvtot%of_r +#endif + ELSE + dvtot = this%dvtot%of_r + END IF ! !-------------------------------------------------------------------------------- END FUNCTION get_dvtot From e5af4e4c6633e6b36f3a36620a486553a81fbc9e Mon Sep 17 00:00:00 2001 From: Oliviero Andreussi Date: Fri, 21 Jun 2024 15:06:13 -0600 Subject: [PATCH 02/27] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8d05b3f..4c11abc 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# Copyright (C) 2018-2022 ENVIRON (www.quantum-environ.org) +# Copyright (C) 2018-2024 ENVIRON (www.quantum-environ.org) -### This file is part of Environ version 3.0 +### This file is part of Environ version 3.1 - Environ 3.0 is free software: you can redistribute it and/or modify + Environ 3.1 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - Environ 3.0 is distributed in the hope that it will be useful, + Environ 3.1 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more detail, either the file @@ -20,13 +20,13 @@ | Name | Institution | | ------------------ | --------------------------------------------------------------- | -| Oliviero Andreussi | Department of Physics, University of North Texas | +| Oliviero Andreussi | Department of Chemistry and Biochemistry, Boise State University| | Francesco Nattino | THEOS and NCCR-MARVEL, Ecole Polytechnique Federale de Lausanne | -| Iurii Timrov | THEOS and NCCR-MARVEL, Ecole Polytechnique Federale de Lausanne | +| Iurii Timrov | PSI Zurich and NCCR-MARVEL | | Ismaila Dabo | Department of Materials Science and Engineering, Penn State | | Nicola Marzari | THEOS and NCCR-MARVEL, Ecole Polytechnique Federale de Lausanne | | Quinn Campbell | Sandia National Labs | -| Edan Bainglass | Department of Physics, University of North Texas | +| Edan Bainglass | PSI Zurich and NCCR-MARVEL | | Matthew Truscott | Department of Physics, University of North Texas | | Gabriel Medrano | Department of Physics, University of North Texas | @@ -50,7 +50,7 @@ http://www.quantum-espresso.org/ -# QE + Environ 3.0 Installation +# QE + Environ 3.1 Installation The following instructions refer to Environ 3.0 installed on QE >= 7.1 For previous versions, please refer to the instructions on the website: @@ -111,7 +111,7 @@ If using cmake, modify the ESPRESSO_ROOT variable in the following files to refl # -# Uninstall Environ 3.0 +# Uninstall Environ 3.1 From Environ root: From 90ed29dbc1179ebf96377d33794ef72e5f90dff9 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Sun, 23 Jun 2024 21:34:21 -0500 Subject: [PATCH 03/27] Write Dockerfile Replicate Environ, QE compilation; Include helpful tools: pseudos, python; Configure for custom options; additional testing needed--occasional warnings with tests, examples --- Dockerfile | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cca2faf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,71 @@ +# Use containerized installation +# 0) Install Docker (https://docs.docker.com/engine/install/) or Docker Desktop (https://www.docker.com/products/docker-desktop/) +# 1) Clone repo: git clone https://github.com/environ-developers/Environ.git && cd Environ +# 2) Build image: docker build -t environ-sandbox . && docker image ls +# 3) Run container: docker run -i -p 8000:80 environ-sandbox && docker ps +# 4) Access container: +# a) Docker Desktop +# b) CLI: docker exec -it bash + +# Configure sandbox -- compiler, dependencies, python + +FROM ubuntu +RUN apt-get update +RUN apt-get install --assume-yes --no-install-recommends \ + autoconf \ + build-essential \ + ca-certificates \ + gfortran \ + git-all \ + libblas3 \ + libc6 \ + libfftw3-dev \ + libgcc-s1 \ + liblapack-dev \ + python3 \ + pipx \ + wget +RUN pipx install Cython numpy ase matplotlib pandas notebook --include-deps +WORKDIR /app +COPY . /app + +# Set environment variables +# N number of processors +# QE_VERSION Quantum ESPRESSO source version +# QE_CONFIG Quantum ESPRESSO configuration options +# ENVIRON_CONFIG Environ configuration options +# BIN_DIR absolute path to binary directory (QE variable) +# PSEUDO_DIR absolute path to pseudopotential directory (QE variable) +# TMP_DIR absolute path of placeholder directory (QE variable) +ENV N=1 \ + QE_VERSION=qe-7.2 \ + QE_CONFIG="--with-environ=/app/q-e/Environ" \ + ENVIRON_CONFIG="--with-qe=/app/q-e" \ + BIN_DIR="/app/q-e/bin" \ + PSEUDO_DIR="/app/sssp_efficiency" \ + TMP_DIR="/app" + +# Install Environ + +RUN git clone https://github.com/QEF/q-e.git +WORKDIR /app/q-e +RUN git checkout $QE_VERSION && git clone https://github.com/environ-developers/Environ.git +WORKDIR /app/q-e/Environ +RUN ./configure $ENVIRON_CONFIG && make -j $N compile +WORKDIR /app/q-e +RUN ./configure $QE_CONFIG && make -j $N pw +RUN alias pw=/app/q-e/bin/pw.x +WORKDIR /app + +# Download SSSP pseudopotentials + +RUN mkdir sssp_efficiency sssp_precision +RUN wget "https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_efficiency.tar.gz" --output-document=efficiency.tar.gz && \ + tar -xvzf efficiency.tar.gz -C sssp_efficiency +RUN wget "https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_precision.tar.gz" --output-document=precision.tar.gz && \ + tar -xvzf precision.tar.gz -C sssp_precision +RUN rm efficiency.tar.gz precision.tar.gz + +# Run shell + +CMD bash \ No newline at end of file From 59dea32e331d8b1070a05ba825627f3bf7f5ee69 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 16:31:14 -0500 Subject: [PATCH 04/27] Update Dockerfile Run tests and examples; Add flags for optional pseudo download, run tests/examples; Use v22.04 distro with additional deps; Add env variables, refactor for legibility; 58/71 tests passing, 8/10 examples run --- Dockerfile | 82 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index cca2faf..f93db0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,65 +6,99 @@ # 4) Access container: # a) Docker Desktop # b) CLI: docker exec -it bash +# 5) Review test and/or example logs: +# a) cat /app/tests.log +# b) cat /app/examples.log -# Configure sandbox -- compiler, dependencies, python +# Configure sandbox -- compiler, dependencies, openmpi, python -FROM ubuntu +FROM ubuntu:22.04 RUN apt-get update -RUN apt-get install --assume-yes --no-install-recommends \ +RUN DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends \ autoconf \ + bc \ build-essential \ ca-certificates \ gfortran \ git-all \ libblas3 \ libc6 \ + libelpa17 \ libfftw3-dev \ libgcc-s1 \ liblapack-dev \ + libopenmpi-dev \ + libscalapack-openmpi-dev \ python3 \ pipx \ wget -RUN pipx install Cython numpy ase matplotlib pandas notebook --include-deps +#RUN pipx install Cython numpy ase matplotlib pandas notebook --include-deps WORKDIR /app -COPY . /app # Set environment variables -# N number of processors -# QE_VERSION Quantum ESPRESSO source version -# QE_CONFIG Quantum ESPRESSO configuration options -# ENVIRON_CONFIG Environ configuration options -# BIN_DIR absolute path to binary directory (QE variable) -# PSEUDO_DIR absolute path to pseudopotential directory (QE variable) -# TMP_DIR absolute path of placeholder directory (QE variable) -ENV N=1 \ +# N number of processors +# QE_VERSION Quantum ESPRESSO source version +# QE_CONFIG Quantum ESPRESSO configuration options +# ENVIRON_CONFIG Environ configuration options +# DOWNLOAD_EFFICIENCY download efficiency SSSP pseudopotential during build +# DOWNLOAD_PRECISION download precision SSSP pseudopotential during build +# RUN_TESTS run tests during build +# RUN_EXAMPLES run examples during build +# BIN_DIR absolute path to binary directory (QE variable) +# PSEUDO_DIR absolute path to pseudopotential directory (QE variable) +# TMP_DIR absolute path of placeholder directory (QE variable) +# OMPI_ALLOW_RUN_AS_ROOT root-level execution permission (MPI variable) +# OMPI_ALLOW_RUN_AS_ROOT_CONFIRM root-level execution confirmation (MPI variable) +ENV N=4 \ QE_VERSION=qe-7.2 \ - QE_CONFIG="--with-environ=/app/q-e/Environ" \ + QE_CONFIG="--enable-parallel --with-environ=/app/q-e/Environ" \ ENVIRON_CONFIG="--with-qe=/app/q-e" \ + DOWNLOAD_EFFICIENCY=0 \ + DOWNLOAD_PRECISION=0 \ + RUN_TESTS=1 \ + RUN_EXAMPLES=0 \ BIN_DIR="/app/q-e/bin" \ - PSEUDO_DIR="/app/sssp_efficiency" \ - TMP_DIR="/app" + PSEUDO_DIR="/app/q-e/pseudo" \ + TMP_DIR="/app" \ + OMPI_ALLOW_RUN_AS_ROOT=1 \ + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 -# Install Environ +# Compile & install QE with Environ RUN git clone https://github.com/QEF/q-e.git WORKDIR /app/q-e RUN git checkout $QE_VERSION && git clone https://github.com/environ-developers/Environ.git +RUN grep -rl .*NETWORK_PSEUDO=http:.* | xargs sed -i "s/NETWORK_PSEUDO=http:/NETWORK_PSEUDO=https:/" +RUN grep -rl .*NETWORK_PSEUDO=https:\/\/www.quantum-espresso.org\/wp-content\/uploads\/upf_files\/.* | xargs sed -i "s/NETWORK_PSEUDO=https:\/\/www.quantum-espresso.org\/wp-content\/uploads\/upf_files\//NETWORK_PSEUDO=https:\/\/pseudopotentials.quantum-espresso.org\/upf_files\//" WORKDIR /app/q-e/Environ RUN ./configure $ENVIRON_CONFIG && make -j $N compile WORKDIR /app/q-e RUN ./configure $QE_CONFIG && make -j $N pw -RUN alias pw=/app/q-e/bin/pw.x +RUN export PATH="$BIN_DIR:$PATH" WORKDIR /app # Download SSSP pseudopotentials -RUN mkdir sssp_efficiency sssp_precision -RUN wget "https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_efficiency.tar.gz" --output-document=efficiency.tar.gz && \ - tar -xvzf efficiency.tar.gz -C sssp_efficiency -RUN wget "https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_precision.tar.gz" --output-document=precision.tar.gz && \ - tar -xvzf precision.tar.gz -C sssp_precision -RUN rm efficiency.tar.gz precision.tar.gz +ENV EFFICIENCY_TARBALL="https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_efficiency.tar.gz" +ENV PRECISION_TARBALL="https://archive.materialscloud.org/record/file?record_id=1732&filename=SSSP_1.3.0_PBE_precision.tar.gz" +RUN if [ "$DOWNLOAD_EFFICIENCY" = "1" ]; then \ + wget $EFFICIENCY_TARBALL --output-document=efficiency.tar.gz && \ + tar -xvzf efficiency.tar.gz -C /app/q-e/pseudo && \ + rm efficiency.tar.gz; fi +RUN if [ "$DOWNLOAD_PRECISION" = "1" ]; then \ + wget $PRECISION_TARBALL --output-document=precision.tar.gz && \ + tar -xvzf precision.tar.gz -C /app/q-e/pseudo && \ + rm precision.tar.gz; fi + +# Run Environ tests and examples + +WORKDIR /app/q-e/Environ/tests +RUN if [ "$RUN_TESTS" = "1" ]; then \ + make --ignore-errors run-tests-parallel | tee /app/tests.log; fi +WORKDIR /app/q-e/Environ/examples/qe/pw +RUN if [ "$RUN_EXAMPLES" = "1" ]; then \ + ./run_all.sh | tee /app/examples.log; fi +WORKDIR /app # Run shell From ca78f8eac9f3dca5d6d92657c02c0be32a6dea44 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 20:47:17 -0500 Subject: [PATCH 05/27] Develop build action as production-grade build test Configure docker image building, artifact loading; Unset Dockerfile flags for CI --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..95897ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + compile: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: Dockerfile + sparse-checkout-cone-mode: false + - name: Deactivate flags + run: sed -i "s/\(EFFICIENCY\|PRECISION\|TESTS\|EXAMPLES\)=1/\\1=0\" Dockerfile && cat Dockerfile | head -70 + - name: Build image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + tags: ci-environ + outputs: type=docker,dest=/tmp/ci-environ.tar + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ci-environ + path: /tmp/ci-environ.tar + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/download-artifact@v2 + with: + name: ci-environ + path: /tmp + - name: Load image + run: docker load --input /tmp/ci-environ.tar + - name: Run container + run: docker run --interactive --name ci-environ environ-image + - name: Access container + run: docker exec --interactive --tty ci-environ bash + - name: run tests + run: cd q-e/Environ/tests && make --ignore-errors run-tests-parallel From 3fa3951cd77e0f56bb5b978e91338e276b20f401 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 20:48:48 -0500 Subject: [PATCH 06/27] Unset tests flag in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f93db0e..0697be4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ ENV N=4 \ ENVIRON_CONFIG="--with-qe=/app/q-e" \ DOWNLOAD_EFFICIENCY=0 \ DOWNLOAD_PRECISION=0 \ - RUN_TESTS=1 \ + RUN_TESTS=0 \ RUN_EXAMPLES=0 \ BIN_DIR="/app/q-e/bin" \ PSEUDO_DIR="/app/q-e/pseudo" \ From 9b32d23d0eccf1fcb2cc8f6e5dcf3f5bd2403705 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 20:50:26 -0500 Subject: [PATCH 07/27] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95897ac..5d9a163 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: branches: - master - develop + - containerization pull_request: jobs: @@ -41,5 +42,5 @@ jobs: run: docker run --interactive --name ci-environ environ-image - name: Access container run: docker exec --interactive --tty ci-environ bash - - name: run tests + - name: Run tests run: cd q-e/Environ/tests && make --ignore-errors run-tests-parallel From 4a2dcbd67a1321ff74dac7951769bfdd087b80da Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 20:56:01 -0500 Subject: [PATCH 08/27] Add print statements --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d9a163..017618c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,10 @@ jobs: sparse-checkout: Dockerfile sparse-checkout-cone-mode: false - name: Deactivate flags - run: sed -i "s/\(EFFICIENCY\|PRECISION\|TESTS\|EXAMPLES\)=1/\\1=0\" Dockerfile && cat Dockerfile | head -70 + run: | + ls -l + sed -i "s/\(EFFICIENCY\|PRECISION\|TESTS\|EXAMPLES\)=1/\\1=0\" Dockerfile + cat Dockerfile - name: Build image uses: docker/build-push-action@v2 with: From d6680da32ce7cf727f6600e950045f2fbf3806c3 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:00:02 -0500 Subject: [PATCH 09/27] Remove sed, add needs --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 017618c..3d6cc62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,11 +15,6 @@ jobs: with: sparse-checkout: Dockerfile sparse-checkout-cone-mode: false - - name: Deactivate flags - run: | - ls -l - sed -i "s/\(EFFICIENCY\|PRECISION\|TESTS\|EXAMPLES\)=1/\\1=0\" Dockerfile - cat Dockerfile - name: Build image uses: docker/build-push-action@v2 with: @@ -33,6 +28,7 @@ jobs: name: ci-environ path: /tmp/ci-environ.tar test: + needs: compile runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v2 From 3381acb4d729f986d264aa5553da1947db861532 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:02:03 -0500 Subject: [PATCH 10/27] Update builderx version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d6cc62..cdfdd02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: sparse-checkout: Dockerfile sparse-checkout-cone-mode: false - name: Build image - uses: docker/build-push-action@v2 + uses: docker/setup-buildx-action@v3 with: context: . file: ./Dockerfile From dba140697224dd4945b369677bfe27ff04efc997 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:18:23 -0500 Subject: [PATCH 11/27] Add buildx setup step, fix buildx push ref --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdfdd02..9c7924d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,9 @@ jobs: with: sparse-checkout: Dockerfile sparse-checkout-cone-mode: false + - uses: docker/setup-buildx-action@v3 - name: Build image - uses: docker/setup-buildx-action@v3 + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile From ba5a74b2cc113f78b3a6908a6ce2edf9d4d494c5 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:28:12 -0500 Subject: [PATCH 12/27] Debug bad image reference --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c7924d..3286f03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,8 +39,8 @@ jobs: - name: Load image run: docker load --input /tmp/ci-environ.tar - name: Run container - run: docker run --interactive --name ci-environ environ-image + run: docker run --interactive --name environ-build ci-environ - name: Access container - run: docker exec --interactive --tty ci-environ bash + run: docker exec --interactive --tty environ-build bash - name: Run tests - run: cd q-e/Environ/tests && make --ignore-errors run-tests-parallel + run: cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel From 91f6034ee05dc217ad1f6df81e2863e5ec75963f Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:40:07 -0500 Subject: [PATCH 13/27] Correct exec flags --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3286f03..fd1012e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,6 @@ jobs: - name: Run container run: docker run --interactive --name environ-build ci-environ - name: Access container - run: docker exec --interactive --tty environ-build bash + run: docker exec -it environ-build bash - name: Run tests run: cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel From 3681e219719c1dd5b1df3918f1c7b9d697fc528f Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 21:55:28 -0500 Subject: [PATCH 14/27] Refactor ci --- .github/workflows/ci.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd1012e..816f572 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,26 +21,24 @@ jobs: with: context: . file: ./Dockerfile - tags: ci-environ - outputs: type=docker,dest=/tmp/ci-environ.tar + tags: environ + outputs: type=docker,dest=/tmp/environ.tar - name: Upload artifact uses: actions/upload-artifact@v2 with: - name: ci-environ - path: /tmp/ci-environ.tar + name: environ + path: /tmp/environ.tar test: needs: compile runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v2 with: - name: ci-environ + name: environ path: /tmp - name: Load image - run: docker load --input /tmp/ci-environ.tar + run: docker load --input /tmp/environ.tar - name: Run container - run: docker run --interactive --name environ-build ci-environ - - name: Access container - run: docker exec -it environ-build bash + run: docker run --interactive --name ci-environ environ - name: Run tests - run: cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel + run: docker exec -it ci-environ sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel" From dc580121559dea1477e7679884bb1202c8906a56 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 22:11:23 -0500 Subject: [PATCH 15/27] Remove exec interactivity --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 816f572..6febc07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,4 @@ jobs: - name: Run container run: docker run --interactive --name ci-environ environ - name: Run tests - run: docker exec -it ci-environ sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel" + run: docker exec ci-environ sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel" From d17d13387343f6098a1de89ffddce52b7c5731c2 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 22:31:43 -0500 Subject: [PATCH 16/27] Use run-action to run tests --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6febc07..416d87b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,10 @@ jobs: path: /tmp - name: Load image run: docker load --input /tmp/environ.tar - - name: Run container - run: docker run --interactive --name ci-environ environ - name: Run tests - run: docker exec ci-environ sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel" + uses: addnab/docker-run-action@v3 + with: + image: environ:latest + run: | + cd /app/q-e/Environ/tests + make --ignore-errors run-tests-parallel From 61833ac7d4576d65197aad09c5f3276bac6d0e63 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 22:47:04 -0500 Subject: [PATCH 17/27] Add ompi env variables to test job --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 416d87b..401b892 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,7 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest + options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 run: | cd /app/q-e/Environ/tests make --ignore-errors run-tests-parallel From 7c1e702e01237254e8fcb381f35166ac56ed647a Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 23:02:58 -0500 Subject: [PATCH 18/27] Use env for OMPI vars, set fail exit code condition --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 401b892..4c48a9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,9 +40,9 @@ jobs: run: docker load --input /tmp/environ.tar - name: Run tests uses: addnab/docker-run-action@v3 + env: + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 with: image: environ:latest - options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - run: | - cd /app/q-e/Environ/tests - make --ignore-errors run-tests-parallel + run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit -1" From 4cef6e8340473400f5031f263731b831a2758647 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Mon, 24 Jun 2024 23:12:37 -0500 Subject: [PATCH 19/27] Set ompi vars inline, add fi --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c48a9a..79abf63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,9 +40,6 @@ jobs: run: docker load --input /tmp/environ.tar - name: Run tests uses: addnab/docker-run-action@v3 - env: - OMPI_ALLOW_RUN_AS_ROOT: 1 - OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 with: image: environ:latest - run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit -1" + run: sh -c "OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit -1; fi" From da6b144c1972b7a774112d5749395beb9594ecb1 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 10:22:09 -0500 Subject: [PATCH 20/27] Use -e flags, exit status 1 for any failed tests --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79abf63..6d2d8a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,5 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest - run: sh -c "OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit -1; fi" + options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit 1; fi" From 7300b505b0693cedb49374e9f0b2dbbb2f8c3e8b Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 10:34:44 -0500 Subject: [PATCH 21/27] Set env variables inline, grep silently --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d2d8a4..1d0a367 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,5 +42,4 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest - options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep **FAILED** /app/tests.log; then exit 1; fi" + run: sh -c "export OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 && cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From f9a099a7c543f181ba1417f112e91a5903ea59f4 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 11:20:12 -0500 Subject: [PATCH 22/27] Set env variables for step and command --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d0a367..18370c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,10 @@ jobs: run: docker load --input /tmp/environ.tar - name: Run tests uses: addnab/docker-run-action@v3 + env: + OMPI_ALLOW_RUN_AS_ROOT: 1 + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 with: image: environ:latest - run: sh -c "export OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 && cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" + options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From 7b579c9912661a9bd4174a8f969de820d7736679 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 11:35:04 -0500 Subject: [PATCH 23/27] Run tests serially --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18370c7..4ce33cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,10 +40,7 @@ jobs: run: docker load --input /tmp/environ.tar - name: Run tests uses: addnab/docker-run-action@v3 - env: - OMPI_ALLOW_RUN_AS_ROOT: 1 - OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 with: image: environ:latest options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" + run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From f647c8b5ea300ba56141815270b3018bf86dfc2b Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 12:32:51 -0500 Subject: [PATCH 24/27] Display env variables --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ce33cf..1e685a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,5 +42,4 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest - options: -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 - run: sh -c "cd /app/q-e/Environ/tests && make --ignore-errors run-tests | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" + run: sh -c "env && cd /app/q-e/Environ/tests && make --ignore-errors run-tests | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From a6bd5219354aa416fe3323029e1ac11a34ad32c8 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 13:53:03 -0500 Subject: [PATCH 25/27] Use root flag with mpirun --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e685a5..e159a3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,4 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest - run: sh -c "env && cd /app/q-e/Environ/tests && make --ignore-errors run-tests | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" + run: sh -c "env && cd /app/q-e/Environ/tests && sed -i 's/mpirun/mpirun --allow-run-as-root/' run-pw.sh && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From 37b7df8f49f95a7049ce1d7efa90f74befbe20c8 Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 14:06:44 -0500 Subject: [PATCH 26/27] Run tests serially for now `mpirun --allow-run-as-root` and OMPI environment vars not honored at runtime --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e159a3d..1e685a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,4 @@ jobs: uses: addnab/docker-run-action@v3 with: image: environ:latest - run: sh -c "env && cd /app/q-e/Environ/tests && sed -i 's/mpirun/mpirun --allow-run-as-root/' run-pw.sh && make --ignore-errors run-tests-parallel | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" + run: sh -c "env && cd /app/q-e/Environ/tests && make --ignore-errors run-tests | tee /app/tests.log && if grep -q **FAILED** /app/tests.log; then exit 1; fi" From 27f9118de45debaead4a02e07945e12bf627d53b Mon Sep 17 00:00:00 2001 From: Nicholas Martinez Date: Tue, 25 Jun 2024 14:57:46 -0500 Subject: [PATCH 27/27] Configure ci triggers--merges, pushes to master, develop --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e685a5..3858e03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: branches: - master - develop - - containerization pull_request: jobs: @@ -29,6 +28,8 @@ jobs: name: environ path: /tmp/environ.tar test: + # if-condition source: https://github.com/orgs/community/discussions/25692#discussioncomment-3248764 + if: github.event_name == 'pull_request' || (github.event_name == 'push' && (contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v'))) needs: compile runs-on: ubuntu-22.04 steps: