From a02d6786015ff91890673f24081164812c4509f7 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 14:46:43 +0800 Subject: [PATCH 01/92] Test: Modify FindMKL.cmake --- .github/workflows/devcontainer.yml | 6 +++++- cmake/FindMKL.cmake | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index ef9bbbfc84..f9fbdd47c0 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -1,6 +1,9 @@ name: Container on: + pull_request: # 当有 PR 指向 develop 分支时触发 + branches: + - develop push: branches: - develop @@ -54,6 +57,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: Dockerfile.${{ matrix.dockerfile }} - push: true + # 只有在 develop 分支或打标签时才推送,PR时不推送 + push: ${{ github.event_name != 'pull_request' }} cache-from: type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest cache-to: type=inline diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index f9cddfcf74..26dece3b44 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -4,7 +4,7 @@ # MKL_INCLUDE - where to find mkl.h, etc. # MKL_FOUND - True if mkl found. -find_package(MKL NO_MODULE) # try using official module first +# find_package(MKL NO_MODULE) # try using official module first if(NOT TARGET MKL::MKL) find_path(MKL_INCLUDE mkl_service.h HINTS ${MKLROOT}/include) From 04bc224cb6e22e334ab33d472b54316cec87f353 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 16:10:44 +0800 Subject: [PATCH 02/92] Fix: Add condition to login to Aliyun Registry only for non-forked PRs --- .github/workflows/devcontainer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index f9fbdd47c0..7eb4014364 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -44,10 +44,11 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Aliyun Registry + # 只有在不是由 fork 的 PR 触发时才执行 + if: github.event.pull_request.head.repo.full_name == github.repository uses: docker/login-action@v3 with: registry: dp-harbor-registry.us-east-1.cr.aliyuncs.com - # AliCloud automatically mirrors to registry.dp.tech username: ${{ secrets.DP_HARBOR_USERNAME }} password: ${{ secrets.DP_HARBOR_PASSWORD }} From b8b78efc7729c745ea7108f335b70951cf78db3b Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 18:19:27 +0800 Subject: [PATCH 03/92] Update Dockerfile: streamline oneAPI installation and improve environment setup --- Dockerfile.intel | 107 ++++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 42 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 5bf6308e79..ed52e2c101 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -1,66 +1,89 @@ +# Base image FROM ubuntu:22.04 +# allow selecting oneAPI minor version at build time +ARG ONEAPI_VER=2025.3 +ENV ONEAPI_VER=${ONEAPI_VER} + +# Basic build tools RUN apt-get update && apt-get install -y \ - bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \ - libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev + bc cmake git gnupg gcc g++ python3-numpy wget unzip ca-certificates \ + vim sudo build-essential curl pkg-config \ + libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \ + && rm -rf /var/lib/apt/lists/* -# Following steps by https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html . +# Add Intel apt repo RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ - echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ - | sudo tee /etc/apt/sources.list.d/oneAPI.list + | gpg --dearmor --yes -o /usr/share/keyrings/oneapi-archive-keyring.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ + > /etc/apt/sources.list.d/oneAPI.list -# To save disk space, only install the essential components, but not the whole toolkit. -RUN apt-get update && \ - apt-get install -y \ +# Install essential oneAPI components (avoid pinning an exact mpi minor version) +RUN apt-get update && apt-get install -y \ intel-oneapi-compiler-dpcpp-cpp \ intel-oneapi-compiler-fortran \ intel-oneapi-mkl-devel \ - intel-oneapi-mpi-devel="2021.11.*" \ - intel-oneapi-vtune && \ - rm /opt/intel/oneapi/mpi/latest && ln -s /opt/intel/oneapi/mpi/2021.11 /opt/intel/oneapi/mpi/latest -ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest \ - LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib/:/opt/intel/oneapi/ippcp/latest/lib/:/opt/intel/oneapi/ipp/latest/lib:/opt/intel/oneapi/dpl/latest/lib:/opt/intel/oneapi/dnnl/latest/lib:/opt/intel/oneapi/dal/latest/lib:/opt/intel/oneapi/compiler/latest/lib:/opt/intel/oneapi/ccl/latest/lib/ \ - LD_LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib:/opt/intel/oneapi/itac/latest/slib:/opt/intel/oneapi/ippcp/latest/lib/:/opt/intel/oneapi/ipp/latest/lib:/opt/intel/oneapi/dpl/latest/lib:/opt/intel/oneapi/dnnl/latest/lib:/opt/intel/oneapi/debugger/latest/opt/debugger/lib:/opt/intel/oneapi/dal/latest/lib:/opt/intel/oneapi/compiler/latest/opt/oclfpga/host/linux64/lib:/opt/intel/oneapi/compiler/latest/opt/compiler/lib:/opt/intel/oneapi/compiler/latest/lib:/opt/intel/oneapi/ccl/latest/lib/ \ - PATH=/opt/intel/oneapi/vtune/latest/bin64:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/bin:/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mkl/latest/bin/:/opt/intel/oneapi/itac/latest/bin:/opt/intel/oneapi/inspector/latest/bin64:/opt/intel/oneapi/dpcpp-ct/latest/bin:/opt/intel/oneapi/dev-utilities/latest/bin:/opt/intel/oneapi/debugger/latest/opt/debugger/bin:/opt/intel/oneapi/compiler/latest/opt/oclfpga/bin:/opt/intel/oneapi/compiler/latest/bin:/opt/intel/oneapi/advisor/latest/bin64:/opt/mamba/bin:/opt/mamba/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ - MKLROOT=/opt/intel/oneapi/mkl/latest \ - FI_PROVIDER_PATH=/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib/prov:/usr/lib/x86_64-linux-gnu/libfabric \ - CMAKE_PREFIX_PATH=/opt/intel/oneapi/tbb/latest/env/..:/opt/intel/oneapi/mkl/latest/lib/cmake:/opt/intel/oneapi/ipp/latest/lib/cmake/ipp:/opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL:/opt/intel/oneapi/dnnl/latest/lib/cmake:/opt/intel/oneapi/dal/latest:/opt/intel/oneapi/compiler/latest \ - CMPLR_ROOT=/opt/intel/oneapi/compiler/latest + intel-oneapi-mpi-devel \ + intel-oneapi-vtune \ + && rm -rf /var/lib/apt/lists/* + +# Normalize 'latest' symlinks for mkl/mpi if possible; prefer requested ONEAPI_VER when present +RUN set -eux; \ + mkdir -p /opt/intel/oneapi; \ + if [ -d "/opt/intel/oneapi/mkl/${ONEAPI_VER}" ]; then \ + ln -sfn "/opt/intel/oneapi/mkl/${ONEAPI_VER}" /opt/intel/oneapi/mkl/latest; \ + elif [ -d /opt/intel/oneapi/mkl ]; then \ + ver=$(ls -1 /opt/intel/oneapi/mkl | sort -V | tail -n1 || true); \ + [ -n "$ver" ] && ln -sfn "/opt/intel/oneapi/mkl/$ver" /opt/intel/oneapi/mkl/latest || true; \ + fi; \ + if [ -d "/opt/intel/oneapi/mpi/${ONEAPI_VER}" ]; then \ + ln -sfn "/opt/intel/oneapi/mpi/${ONEAPI_VER}" /opt/intel/oneapi/mpi/latest; \ + elif [ -d /opt/intel/oneapi/mpi ]; then \ + ver=$(ls -1 /opt/intel/oneapi/mpi | sort -V | tail -n1 || true); \ + [ -n "$ver" ] && ln -sfn "/opt/intel/oneapi/mpi/$ver" /opt/intel/oneapi/mpi/latest || true; \ + fi; \ + echo "MKL dirs:"; ls -la /opt/intel/oneapi/mkl || true; \ + echo "MPI dirs:"; ls -la /opt/intel/oneapi/mpi || true + +# Set consistent envs referencing 'latest' symlink +ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest +ENV MKLROOT=/opt/intel/oneapi/mkl/latest +ENV LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib +ENV LD_LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib +ENV PATH=/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mkl/latest/bin:$PATH +ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake SHELL ["/bin/bash", "-c"] ENV CC=mpiicx CXX=mpiicpx FC=mpiifx -# https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html -RUN source /opt/intel/oneapi/setvars.sh && \ +# Build ELPA (example dependency) +RUN source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ cd /tmp && \ - ELPA_VER=2022.11.001 && \ + ELPA_VER=2025.06.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ + tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ cd elpa-$ELPA_VER && mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ - make -j`nproc` && \ - make PREFIX=/usr/local install && \ - ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \ + make -j"$(nproc)" && make PREFIX=/usr/local install && \ + ln -sfn /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/elpa || true && \ cd /tmp && rm -rf elpa-$ELPA_VER -RUN cd /tmp && git clone https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ \ - && rm -rf rapidjson - -RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip \ - --no-check-certificate --quiet -O libtorch.zip && \ - unzip -q libtorch.zip -d /opt && rm libtorch.zip - -ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake +# rapidjson and libtorch +RUN cd /tmp && git clone --depth 1 https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ && rm -rf rapidjson +RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \ + unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip +ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} +# Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null - -RUN source /opt/intel/oneapi/setvars.sh && \ - git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ +RUN set -eux; source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ + cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \ - cmake --build build -j`nproc` && \ + cmake --build build -j"$(nproc)" && \ cmake --install build && \ - rm -rf build && \ - abacus --version - #&& rm -rf abacus-develop + /usr/bin/abacus --version || true && \ + rm -rf /tmp/abacus-develop /tmp/abacus-develop.tar.gz + +# Default entry +CMD ["/bin/bash"] From a393a725f1c1c2c08a697b2f2624575880fce2ad Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 19:17:46 +0800 Subject: [PATCH 04/92] Fix: Add gzip installation to Dockerfile for build tools --- Dockerfile.intel | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index ed52e2c101..2c4bf73e0b 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -8,6 +8,7 @@ ENV ONEAPI_VER=${ONEAPI_VER} # Basic build tools RUN apt-get update && apt-get install -y \ bc cmake git gnupg gcc g++ python3-numpy wget unzip ca-certificates \ + gzip \ vim sudo build-essential curl pkg-config \ libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \ && rm -rf /var/lib/apt/lists/* From a81705f46fa9aa272ff1ae28a489c2ed22a14ed6 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 20:09:55 +0800 Subject: [PATCH 05/92] Update Dockerfile.intel --- .github/workflows/build_test_cmake.yml | 2 +- .github/workflows/build_test_makefile.yml | 2 +- .github/workflows/cuda.yml | 2 +- .github/workflows/devcontainer.yml | 3 ++- .github/workflows/pytest.yml | 3 ++- .github/workflows/test.yml | 3 ++- Dockerfile.intel | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_test_cmake.yml b/.github/workflows/build_test_cmake.yml index 22610fb454..a9ec3c8a6d 100644 --- a/.github/workflows/build_test_cmake.yml +++ b/.github/workflows/build_test_cmake.yml @@ -1,7 +1,7 @@ name: Build Test on: push: - pull_request: + # pull_request: jobs: test: diff --git a/.github/workflows/build_test_makefile.yml b/.github/workflows/build_test_makefile.yml index 237d25ebf8..45ea727557 100644 --- a/.github/workflows/build_test_makefile.yml +++ b/.github/workflows/build_test_makefile.yml @@ -1,7 +1,7 @@ name: Build Test on: push: - pull_request: + # pull_request: jobs: test: diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 14e829e546..2400fa4775 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -2,7 +2,7 @@ name: CUDA Test on: workflow_dispatch: - pull_request: + # pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 7eb4014364..d3ff39b69f 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -17,7 +17,8 @@ jobs: if: github.repository_owner == 'deepmodeling' strategy: matrix: - dockerfile: ["gnu","intel","cuda"] + dockerfile: ["intel"] + # dockerfile: ["gnu","intel","cuda"] steps: - name: Checkout uses: actions/checkout@v5 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 1e78dfb0a1..b0790c92a1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,7 +1,8 @@ name: Pyabacus Build and Test on: - pull_request: + push: + # pull_request: jobs: test: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df1dfb29dc..b87792a8db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,8 @@ name: Integration Test and Unit Test on: - pull_request: + push: + # pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/Dockerfile.intel b/Dockerfile.intel index 2c4bf73e0b..604fd9b1b1 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -62,7 +62,7 @@ RUN source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ cd /tmp && \ ELPA_VER=2025.06.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ + tar xzf elpa-$ELPA_VER.tar.gz --no-same-owner --no-same-permissions && rm elpa-$ELPA_VER.tar.gz && \ cd elpa-$ELPA_VER && mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ make -j"$(nproc)" && make PREFIX=/usr/local install && \ From e6f7eff21950b1691a544efd65ddfbb7bd1273dc Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 28 Oct 2025 21:27:14 +0800 Subject: [PATCH 06/92] Fix: Update ELPA version to 2022.11.001 in Dockerfile --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 604fd9b1b1..0afac6434e 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -60,7 +60,7 @@ ENV CC=mpiicx CXX=mpiicpx FC=mpiifx # Build ELPA (example dependency) RUN source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ cd /tmp && \ - ELPA_VER=2025.06.001 && \ + ELPA_VER=2022.11.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ tar xzf elpa-$ELPA_VER.tar.gz --no-same-owner --no-same-permissions && rm elpa-$ELPA_VER.tar.gz && \ cd elpa-$ELPA_VER && mkdir build && cd build && \ From d3cc27c6c4c912527d0b092f2580a38b58fd1227 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 14:05:56 +0800 Subject: [PATCH 07/92] Fix: Refactor Dockerfile.intel to streamline package installation and improve ELPA build process --- Dockerfile.intel | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 0afac6434e..67f6952e70 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -7,17 +7,14 @@ ENV ONEAPI_VER=${ONEAPI_VER} # Basic build tools RUN apt-get update && apt-get install -y \ - bc cmake git gnupg gcc g++ python3-numpy wget unzip ca-certificates \ - gzip \ - vim sudo build-essential curl pkg-config \ - libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \ - && rm -rf /var/lib/apt/lists/* + bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \ + libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev # Add Intel apt repo RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor --yes -o /usr/share/keyrings/oneapi-archive-keyring.gpg \ - && echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ - > /etc/apt/sources.list.d/oneAPI.list + | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ + | sudo tee /etc/apt/sources.list.d/oneAPI.list # Install essential oneAPI components (avoid pinning an exact mpi minor version) RUN apt-get update && apt-get install -y \ @@ -58,15 +55,16 @@ SHELL ["/bin/bash", "-c"] ENV CC=mpiicx CXX=mpiicpx FC=mpiifx # Build ELPA (example dependency) -RUN source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ +RUN source /opt/intel/oneapi/setvars.sh \ cd /tmp && \ ELPA_VER=2022.11.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - tar xzf elpa-$ELPA_VER.tar.gz --no-same-owner --no-same-permissions && rm elpa-$ELPA_VER.tar.gz && \ + tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ cd elpa-$ELPA_VER && mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ - make -j"$(nproc)" && make PREFIX=/usr/local install && \ - ln -sfn /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/elpa || true && \ + make -j`nproc` && \ + make PREFIX=/usr/local install && \ + ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \ cd /tmp && rm -rf elpa-$ELPA_VER # rapidjson and libtorch From 7c6465c7edad9b78d8e28e9f8e9157ebc88d2687 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 16:51:48 +0800 Subject: [PATCH 08/92] Fix: Update ELPA build process in Dockerfile.intel to improve extraction and installation steps --- Dockerfile.intel | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 67f6952e70..9a06bb93e4 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -54,15 +54,20 @@ ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake SHELL ["/bin/bash", "-c"] ENV CC=mpiicx CXX=mpiicpx FC=mpiifx +RUN which gzip && ls -l $(which gzip) +RUN ls -l /bin/gzip /usr/bin/gzip + # Build ELPA (example dependency) -RUN source /opt/intel/oneapi/setvars.sh \ +RUN source /opt/intel/oneapi/setvars.sh && \ cd /tmp && \ ELPA_VER=2022.11.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ - cd elpa-$ELPA_VER && mkdir build && cd build && \ + /bin/tar xzf elpa-$ELPA_VER.tar.gz && \ + rm elpa-$ELPA_VER.tar.gz && \ + cd elpa-$ELPA_VER && \ + mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ - make -j`nproc` && \ + make -j$(nproc) && \ make PREFIX=/usr/local install && \ ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \ cd /tmp && rm -rf elpa-$ELPA_VER From 4479db1e70770c616e0c9e639768019528f81773 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 17:12:16 +0800 Subject: [PATCH 09/92] Fix: Update ELPA extraction method in Dockerfile.intel to use gzip and tar commands --- Dockerfile.intel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 9a06bb93e4..438042bafe 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -62,7 +62,8 @@ RUN source /opt/intel/oneapi/setvars.sh && \ cd /tmp && \ ELPA_VER=2022.11.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - /bin/tar xzf elpa-$ELPA_VER.tar.gz && \ + gzip -d elpa-$ELPA_VER.tar.gz && \ + tar xf elpa-$ELPA_VER.tar && \ rm elpa-$ELPA_VER.tar.gz && \ cd elpa-$ELPA_VER && \ mkdir build && cd build && \ From eeb7e60d63553577164b352a79f082b2b7f008af Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 17:55:01 +0800 Subject: [PATCH 10/92] Fix: Correct file removal command in ELPA build process in Dockerfile.intel --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 438042bafe..72c9771761 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -64,7 +64,7 @@ RUN source /opt/intel/oneapi/setvars.sh && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ gzip -d elpa-$ELPA_VER.tar.gz && \ tar xf elpa-$ELPA_VER.tar && \ - rm elpa-$ELPA_VER.tar.gz && \ + rm elpa-$ELPA_VER.tar && \ cd elpa-$ELPA_VER && \ mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ From fd422d63b9efee5869e826e64d7588e47f83e53d Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 18:49:26 +0800 Subject: [PATCH 11/92] Fix: Comment out LIBRARY_PATH and CC/CXX/FC environment variables in Dockerfile.intel --- Dockerfile.intel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 72c9771761..a50e15c101 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -46,12 +46,13 @@ RUN set -eux; \ # Set consistent envs referencing 'latest' symlink ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest ENV MKLROOT=/opt/intel/oneapi/mkl/latest -ENV LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib +# ENV LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib ENV LD_LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib ENV PATH=/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mkl/latest/bin:$PATH ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake SHELL ["/bin/bash", "-c"] +# ENV CC=mpiicc CXX=mpiicpc FC=mpiifort ENV CC=mpiicx CXX=mpiicpx FC=mpiifx RUN which gzip && ls -l $(which gzip) From 296046a610bda638e77cb6272aff4da479c5725c Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 19:06:05 +0800 Subject: [PATCH 12/92] Fix: Update Dockerfile.intel to include pkg-config and kernel headers installation for vtune --- Dockerfile.intel | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index a50e15c101..2e7b38b67f 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -8,7 +8,8 @@ ENV ONEAPI_VER=${ONEAPI_VER} # Basic build tools RUN apt-get update && apt-get install -y \ bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \ - libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev + libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \ + pkg-config build-essential make ca-certificates # Add Intel apt repo RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -17,7 +18,13 @@ RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRO | sudo tee /etc/apt/sources.list.d/oneAPI.list # Install essential oneAPI components (avoid pinning an exact mpi minor version) -RUN apt-get update && apt-get install -y \ +RUN apt-get update && \ + # Ensure pkg-config and kernel headers are present before installing vtune (vtune's installer checks kernel headers) + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + pkg-config || true && \ + # Try to install headers matching the build host kernel; fall back to generic headers if exact package not available. + DEBIAN_FRONTEND=noninteractive bash -lc "apt-get install -y --no-install-recommends linux-headers-$(uname -r) || apt-get install -y --no-install-recommends linux-headers-generic || true" && \ + apt-get install -y \ intel-oneapi-compiler-dpcpp-cpp \ intel-oneapi-compiler-fortran \ intel-oneapi-mkl-devel \ From 4c9d946f295c8352baecd6979a1ee722133cf90f Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 19:25:26 +0800 Subject: [PATCH 13/92] Fix: Correct environment variable assignments for compiler in Dockerfile.intel --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 2e7b38b67f..5935ec7da5 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -60,7 +60,7 @@ ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake SHELL ["/bin/bash", "-c"] # ENV CC=mpiicc CXX=mpiicpc FC=mpiifort -ENV CC=mpiicx CXX=mpiicpx FC=mpiifx +ENV CC=mpiicc CXX=mpiicpc FC=mpiifort RUN which gzip && ls -l $(which gzip) RUN ls -l /bin/gzip /usr/bin/gzip From e31d91ad61e840a3a9ac9ddb66830aa5317e29c3 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 20:12:54 +0800 Subject: [PATCH 14/92] Fix: Update Dockerfile.intel to streamline oneAPI installation and improve package management --- Dockerfile.intel | 83 +++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 5935ec7da5..c3c685be99 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -1,15 +1,10 @@ # Base image FROM ubuntu:22.04 -# allow selecting oneAPI minor version at build time -ARG ONEAPI_VER=2025.3 -ENV ONEAPI_VER=${ONEAPI_VER} - -# Basic build tools RUN apt-get update && apt-get install -y \ bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \ libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \ - pkg-config build-essential make ca-certificates + pkg-config build-essential autoconf automake libtool # Add Intel apt repo RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -17,64 +12,60 @@ RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRO echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ | sudo tee /etc/apt/sources.list.d/oneAPI.list -# Install essential oneAPI components (avoid pinning an exact mpi minor version) +# 安装oneAPI组件(使用更灵活的版本处理) RUN apt-get update && \ - # Ensure pkg-config and kernel headers are present before installing vtune (vtune's installer checks kernel headers) - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - pkg-config || true && \ - # Try to install headers matching the build host kernel; fall back to generic headers if exact package not available. - DEBIAN_FRONTEND=noninteractive bash -lc "apt-get install -y --no-install-recommends linux-headers-$(uname -r) || apt-get install -y --no-install-recommends linux-headers-generic || true" && \ apt-get install -y \ intel-oneapi-compiler-dpcpp-cpp \ intel-oneapi-compiler-fortran \ intel-oneapi-mkl-devel \ intel-oneapi-mpi-devel \ - intel-oneapi-vtune \ - && rm -rf /var/lib/apt/lists/* + intel-oneapi-vtune && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# 设置oneAPI环境变量 +ENV ONEAPI_ROOT=/opt/intel/oneapi +ENV I_MPI_ROOT=${ONEAPI_ROOT}/mpi/latest +ENV MKLROOT=${ONEAPI_ROOT}/mkl/latest +ENV CMPLR_ROOT=${ONEAPI_ROOT}/compiler/latest -# Normalize 'latest' symlinks for mkl/mpi if possible; prefer requested ONEAPI_VER when present -RUN set -eux; \ - mkdir -p /opt/intel/oneapi; \ - if [ -d "/opt/intel/oneapi/mkl/${ONEAPI_VER}" ]; then \ - ln -sfn "/opt/intel/oneapi/mkl/${ONEAPI_VER}" /opt/intel/oneapi/mkl/latest; \ - elif [ -d /opt/intel/oneapi/mkl ]; then \ - ver=$(ls -1 /opt/intel/oneapi/mkl | sort -V | tail -n1 || true); \ - [ -n "$ver" ] && ln -sfn "/opt/intel/oneapi/mkl/$ver" /opt/intel/oneapi/mkl/latest || true; \ - fi; \ - if [ -d "/opt/intel/oneapi/mpi/${ONEAPI_VER}" ]; then \ - ln -sfn "/opt/intel/oneapi/mpi/${ONEAPI_VER}" /opt/intel/oneapi/mpi/latest; \ - elif [ -d /opt/intel/oneapi/mpi ]; then \ - ver=$(ls -1 /opt/intel/oneapi/mpi | sort -V | tail -n1 || true); \ - [ -n "$ver" ] && ln -sfn "/opt/intel/oneapi/mpi/$ver" /opt/intel/oneapi/mpi/latest || true; \ - fi; \ - echo "MKL dirs:"; ls -la /opt/intel/oneapi/mkl || true; \ - echo "MPI dirs:"; ls -la /opt/intel/oneapi/mpi || true +# 设置库路径和包含路径 +ENV LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/intel64:${LIBRARY_PATH} +ENV LD_LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/intel64:${LD_LIBRARY_PATH} +ENV PATH=${ONEAPI_ROOT}/vtune/latest/bin64:${ONEAPI_ROOT}/mpi/latest/bin:${MKLROOT}/bin/intel64:${ONEAPI_ROOT}/compiler/latest/bin:${PATH} +ENV CPATH=${MKLROOT}/include:${ONEAPI_ROOT}/mpi/latest/include:${CPATH} +ENV PKG_CONFIG_PATH=${MKLROOT}/lib/pkgconfig:${ONEAPI_ROOT}/mpi/latest/lib/pkgconfig:${PKG_CONFIG_PATH} -# Set consistent envs referencing 'latest' symlink -ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest -ENV MKLROOT=/opt/intel/oneapi/mkl/latest -# ENV LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib -ENV LD_LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib -ENV PATH=/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mkl/latest/bin:$PATH -ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake +# 设置CMAKE相关路径 +ENV CMAKE_PREFIX_PATH=${ONEAPI_ROOT}/tbb/latest:${MKLROOT}/lib/cmake:${ONEAPI_ROOT}/dpl/latest/lib/cmake:${ONEAPI_ROOT}/dnnl/latest/lib/cmake:${ONEAPI_ROOT}/dal/latest:${ONEAPI_ROOT}/compiler/latest:${CMAKE_PREFIX_PATH} SHELL ["/bin/bash", "-c"] -# ENV CC=mpiicc CXX=mpiicpc FC=mpiifort + +# 设置编译器 - 使用更兼容的配置 ENV CC=mpiicc CXX=mpiicpc FC=mpiifort +# 备用设置(如果上面的不行) +# ENV CC=mpiicx CXX=mpiicpx FC=mpiifort + +SHELL ["/bin/bash", "-c"] +# ENV CC=mpiicc CXX=mpiicpc FC=mpiifort +ENV CC=mpiicx CXX=mpiicpx FC=mpiifx -RUN which gzip && ls -l $(which gzip) -RUN ls -l /bin/gzip /usr/bin/gzip +# 验证oneAPI安装 +RUN source ${ONEAPI_ROOT}/setvars.sh && \ + echo "=== 验证编译器 ===" && \ + which mpiicc && mpiicc --version && \ + echo "=== 验证MKL ===" && \ + ls ${MKLROOT}/lib/intel64/ && \ + echo "=== 验证MPI ===" && \ + which mpirun && mpirun --version # Build ELPA (example dependency) RUN source /opt/intel/oneapi/setvars.sh && \ cd /tmp && \ ELPA_VER=2022.11.001 && \ wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - gzip -d elpa-$ELPA_VER.tar.gz && \ - tar xf elpa-$ELPA_VER.tar && \ - rm elpa-$ELPA_VER.tar && \ - cd elpa-$ELPA_VER && \ - mkdir build && cd build && \ + tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ + cd elpa-$ELPA_VER && mkdir build && cd build && \ ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ make -j$(nproc) && \ make PREFIX=/usr/local install && \ From 47c555d79ab1d6efef82a606ab4bc40a2c9230b4 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Wed, 29 Oct 2025 20:29:40 +0800 Subject: [PATCH 15/92] Fix: Update compiler settings in Dockerfile.intel to use mpiicx for better compatibility --- Dockerfile.intel | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index c3c685be99..78274b3338 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -42,18 +42,14 @@ ENV CMAKE_PREFIX_PATH=${ONEAPI_ROOT}/tbb/latest:${MKLROOT}/lib/cmake:${ONEAPI_RO SHELL ["/bin/bash", "-c"] # 设置编译器 - 使用更兼容的配置 -ENV CC=mpiicc CXX=mpiicpc FC=mpiifort -# 备用设置(如果上面的不行) -# ENV CC=mpiicx CXX=mpiicpx FC=mpiifort - -SHELL ["/bin/bash", "-c"] # ENV CC=mpiicc CXX=mpiicpc FC=mpiifort +# 备用设置(如果上面的不行) ENV CC=mpiicx CXX=mpiicpx FC=mpiifx # 验证oneAPI安装 RUN source ${ONEAPI_ROOT}/setvars.sh && \ echo "=== 验证编译器 ===" && \ - which mpiicc && mpiicc --version && \ + which mpiicx && mpiicx --version && \ echo "=== 验证MKL ===" && \ ls ${MKLROOT}/lib/intel64/ && \ echo "=== 验证MPI ===" && \ From 727b9ec5d729b5df7500dbfc406af2d4dc314ba8 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 13:35:32 +0800 Subject: [PATCH 16/92] Fix: Remove output redirection from oneAPI environment setup in Dockerfile.intel --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 78274b3338..da0cec5bb6 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -76,7 +76,7 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null -RUN set -eux; source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; \ +RUN set -eux; source /opt/intel/oneapi/setvars.sh || true; \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \ From d6368ba1cafaf7208bdab15f71f3ef7e0f0ace7b Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 13:56:52 +0800 Subject: [PATCH 17/92] Fix: Update Dockerfile.intel to enhance build command with error handling and clone abacus-develop repository --- Dockerfile.intel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index da0cec5bb6..2eb179063b 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -76,7 +76,8 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null -RUN set -eux; source /opt/intel/oneapi/setvars.sh || true; \ +RUN set -ex; source /opt/intel/oneapi/setvars.sh || true; \ + set -eux; \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \ From 7fe731febe65f09770015b16a2a67198289023f9 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 14:23:44 +0800 Subject: [PATCH 18/92] Fix: Uncomment find_package for MKL to enable proper detection of MKL libraries --- cmake/FindMKL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index 26dece3b44..f9cddfcf74 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -4,7 +4,7 @@ # MKL_INCLUDE - where to find mkl.h, etc. # MKL_FOUND - True if mkl found. -# find_package(MKL NO_MODULE) # try using official module first +find_package(MKL NO_MODULE) # try using official module first if(NOT TARGET MKL::MKL) find_path(MKL_INCLUDE mkl_service.h HINTS ${MKLROOT}/include) From f4cfdf83434d3d1b6488a83d1cb517de529880ab Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 15:12:17 +0800 Subject: [PATCH 19/92] Fix: Update CMake configuration in Dockerfile.intel to disable SYCL support for compatibility --- Dockerfile.intel | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 2eb179063b..042af09ad3 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -80,7 +80,11 @@ RUN set -ex; source /opt/intel/oneapi/setvars.sh || true; \ set -eux; \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ - cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \ + cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON\ + -DMKL_ENABLE_SYCL=OFF \ + -DENABLE_SYCL=OFF \ + -DCMAKE_DISABLE_FIND_PACKAGE_SYCL=ON \ + -DCMAKE_BUILD_TYPE=Release && \ cmake --build build -j"$(nproc)" && \ cmake --install build && \ /usr/bin/abacus --version || true && \ From e6cf31535705b35fb89648446a97b893bb45d69d Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 16:11:06 +0800 Subject: [PATCH 20/92] Fix: Update abacus build process in Dockerfile.intel to set missing environment variables for SYCL compatibility --- Dockerfile.intel | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 042af09ad3..e5e3474e3b 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -76,19 +76,23 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null -RUN set -ex; source /opt/intel/oneapi/setvars.sh || true; \ - set -eux; \ +RUN set -eux; \ + export OCL_ICD_FILENAMES="" ; \ + # 关键修复:在source setvars.sh之前设置缺失的变量 + export mkl_sycl_distributed_dft_file="disabled" ; \ + source /opt/intel/oneapi/setvars.sh > /dev/null 2>&1 || true; \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ - cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON\ - -DMKL_ENABLE_SYCL=OFF \ - -DENABLE_SYCL=OFF \ - -DCMAKE_DISABLE_FIND_PACKAGE_SYCL=ON \ + cmake -B build \ + -DENABLE_MLALGO=ON \ + -DENABLE_LIBXC=ON \ + -DENABLE_LIBRI=ON \ + -DENABLE_RAPIDJSON=ON \ -DCMAKE_BUILD_TYPE=Release && \ cmake --build build -j"$(nproc)" && \ cmake --install build && \ - /usr/bin/abacus --version || true && \ - rm -rf /tmp/abacus-develop /tmp/abacus-develop.tar.gz + (/usr/bin/abacus --version || echo "ABACUS installed but version check failed") && \ + rm -rf /tmp/abacus-develop # Default entry CMD ["/bin/bash"] From 825ed001791515fc11d0c341370234e54ed39f95 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 18:31:21 +0800 Subject: [PATCH 21/92] Fix: Remove unnecessary environment variable settings before cloning abacus in Dockerfile.intel --- Dockerfile.intel | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e5e3474e3b..4106fa3f2b 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -76,12 +76,7 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null -RUN set -eux; \ - export OCL_ICD_FILENAMES="" ; \ - # 关键修复:在source setvars.sh之前设置缺失的变量 - export mkl_sycl_distributed_dft_file="disabled" ; \ - source /opt/intel/oneapi/setvars.sh > /dev/null 2>&1 || true; \ - cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ +RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ -DENABLE_MLALGO=ON \ From 38d1b065a07af9d93a10bf2240aece45159c53d1 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Thu, 30 Oct 2025 20:00:49 +0800 Subject: [PATCH 22/92] Fix: Comment out find_package for MKL to prevent conflicts with module detection --- cmake/FindMKL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index f9cddfcf74..26dece3b44 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -4,7 +4,7 @@ # MKL_INCLUDE - where to find mkl.h, etc. # MKL_FOUND - True if mkl found. -find_package(MKL NO_MODULE) # try using official module first +# find_package(MKL NO_MODULE) # try using official module first if(NOT TARGET MKL::MKL) find_path(MKL_INCLUDE mkl_service.h HINTS ${MKLROOT}/include) From 6b31fe21cd2ae1004a52a859a8c87ce3083c60a4 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:26:00 +0800 Subject: [PATCH 23/92] Enhance Dockerfile with libraries installation: PEXSI and its DEPs Added installation steps for GKlib, METIS, ParMETIS, SuperLU_DIST, and PEXSI to Dockerfile. --- Dockerfile.intel | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 4106fa3f2b..1895940c0c 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -74,6 +74,93 @@ RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared- unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} +###### PEXSI PART: pexsi\gklib\metis\parmetis\superlu_dist ###### +ENV GKLIB_VERSION="master" # Although that is not good in CI/CD... +ENV METIS_VERSION="master" # Although that is not good in CI/CD... +ENV PARMETIS_VERSION="main" # Although that is not good in CI/CD... +ENV SUPERLU_DIST_VERSION=7.2.0 +ENV PEXSI_VERSION=2.0.0 +ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} +ENV METIS32_ROOT=/usr/local/metis32-${METIS_VERSION} +ENV PARMETIS32_ROOT=/usr/local/parmetis32-${PARMETIS_VERSION} +ENV PEXSI32_ROOT=/usr/local/pexsi32-${PEXSI_VERSION} +ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} + +# 2. install GKlib +RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ + unzip GKlib-${GKLIB_VERSION}.zip && \ + cd GKlib-${GKLIB_VERSION} && \ + make config cc=mpiicc shared=1 prefix=${GKLIB_ROOT} openmp=set && \ + make -j$(nproc) && \ + make install && \ + cp ${GKLIB_ROOT}/lib64/*so ${GKLIB_ROOT}/lib/ \ #.so file CANNOT be found otherwise. + cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip + +# 2. install METIS +RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ + unzip METIS-${METIS_VERSION}.zip && \ + cd METIS-${METIS_VERSION} && \ + make config cc=mpiicc shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip + +# 3. install ParMETIS +RUN wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ + unzip ParMETIS-${PARMETIS_VERSION}.zip && \ + cd ParMETIS-${PARMETIS_VERSION} && \ + make config cc=mpiicc shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip + +# 4. install SuperLU_DIST +RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ + tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ + cd superlu_dist-${SUPERLU_DIST_VERSION} && \ + mkdir build && cd build && \ + cmake .. \ + -DTPL_ENABLE_PARMETISLIB=ON \ + -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ # Although that is not good in CI/CD... + -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ # Although that is not good in CI/CD... + -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ + -DTPL_ENABLE_LAPACKLIB=ON \ + -DTPL_ENABLE_COMBBLASLIB=OFF \ + -DTPL_ENABLE_CUDALIB=OFF \ + -DTPL_ENABLE_HIPLIB=OFF \ + -Denable_complex16=ON \ + -DXSDK_INDEX_SIZE=32 \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ + -DCMAKE_C_COMPILER=mpiicc \ + -DCMAKE_CXX_COMPILER=mpiicpc \ + -DCMAKE_C_FLAGS="-O3 -fopenmp" \ + -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ + -DXSDK_ENABLE_Fortran=ON \ + -DCMAKE_Fortran_COMPILER=mpif90 && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz + +### -DCMAKE_CUDA_COMPILER=nvcc \ + +# 5. install PEXSI +RUN wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ + tar -xzf v${PEXSI_VERSION}.tar.gz && \ + cd PEXSI-${PEXSI_VERSION} && \ + mkdir build && cd build && \ + cmake .. \ + -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ + -DPEXSI_ENABLE_OPENMP=ON \ + -DPEXSI_ENABLE_FORTRAN=ON \ + -DCMAKE_C_COMPILER=mpiicc \ + -DCMAKE_CXX_COMPILER=mpiicpc \ + -DCMAKE_FORTRAN_COMPILER=mpif90 && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz +###### END of PEXSI PART ###### + # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ From b8fcb701f8141ce499a1edbe0926db459727f666 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:32:39 +0800 Subject: [PATCH 24/92] Delete some #s to avoid errors --- Dockerfile.intel | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 1895940c0c..e0b3ab0066 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -74,10 +74,10 @@ RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared- unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} -###### PEXSI PART: pexsi\gklib\metis\parmetis\superlu_dist ###### -ENV GKLIB_VERSION="master" # Although that is not good in CI/CD... -ENV METIS_VERSION="master" # Although that is not good in CI/CD... -ENV PARMETIS_VERSION="main" # Although that is not good in CI/CD... +###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist +ENV GKLIB_VERSION="master" +ENV METIS_VERSION="master" +ENV PARMETIS_VERSION="main" ENV SUPERLU_DIST_VERSION=7.2.0 ENV PEXSI_VERSION=2.0.0 ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} @@ -159,7 +159,7 @@ RUN wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ make -j$(nproc) && \ make install && \ cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz -###### END of PEXSI PART ###### +###### END of PEXSI PART # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null From da23327a9c7927316ab7f26c1de8df3a25bb8f94 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 11:18:12 +0800 Subject: [PATCH 25/92] Fix Dockerfile to ensure .so files are copied correctly --- Dockerfile.intel | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e0b3ab0066..e3c6ba2958 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -93,9 +93,9 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER make config cc=mpiicc shared=1 prefix=${GKLIB_ROOT} openmp=set && \ make -j$(nproc) && \ make install && \ - cp ${GKLIB_ROOT}/lib64/*so ${GKLIB_ROOT}/lib/ \ #.so file CANNOT be found otherwise. + cp ${GKLIB_ROOT}/lib64/*so ${GKLIB_ROOT}/lib/ && \ cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip - + #.so file CANNOT be found otherwise. # 2. install METIS RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ unzip METIS-${METIS_VERSION}.zip && \ @@ -121,8 +121,8 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S mkdir build && cd build && \ cmake .. \ -DTPL_ENABLE_PARMETISLIB=ON \ - -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ # Although that is not good in CI/CD... - -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ # Although that is not good in CI/CD... + -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ + -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ -DTPL_ENABLE_LAPACKLIB=ON \ -DTPL_ENABLE_COMBBLASLIB=OFF \ From 2171daf9b5ffdcdbb5296ab94f9b61457cf6b893 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:36:47 +0800 Subject: [PATCH 26/92] Refactor Dockerfile to simplify build commands: No icc now Updated build commands in Dockerfile to remove specific compiler settings for MPI. --- Dockerfile.intel | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e3c6ba2958..e56a8319e2 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -90,7 +90,7 @@ ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ unzip GKlib-${GKLIB_VERSION}.zip && \ cd GKlib-${GKLIB_VERSION} && \ - make config cc=mpiicc shared=1 prefix=${GKLIB_ROOT} openmp=set && \ + make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ make -j$(nproc) && \ make install && \ cp ${GKLIB_ROOT}/lib64/*so ${GKLIB_ROOT}/lib/ && \ @@ -100,7 +100,7 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ unzip METIS-${METIS_VERSION}.zip && \ cd METIS-${METIS_VERSION} && \ - make config cc=mpiicc shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ + make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ make -j$(nproc) && \ make install && \ cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip @@ -109,7 +109,7 @@ RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VER RUN wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ unzip ParMETIS-${PARMETIS_VERSION}.zip && \ cd ParMETIS-${PARMETIS_VERSION} && \ - make config cc=mpiicc shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ + make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ make -j$(nproc) && \ make install && \ cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip @@ -132,8 +132,6 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S -DXSDK_INDEX_SIZE=32 \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ - -DCMAKE_C_COMPILER=mpiicc \ - -DCMAKE_CXX_COMPILER=mpiicpc \ -DCMAKE_C_FLAGS="-O3 -fopenmp" \ -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ -DXSDK_ENABLE_Fortran=ON \ @@ -142,6 +140,8 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S make install && \ cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz +### -DCMAKE_C_COMPILER=mpiicc \ +### -DCMAKE_CXX_COMPILER=mpiicpc \ ### -DCMAKE_CUDA_COMPILER=nvcc \ # 5. install PEXSI @@ -153,12 +153,13 @@ RUN wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ - -DCMAKE_C_COMPILER=mpiicc \ - -DCMAKE_CXX_COMPILER=mpiicpc \ -DCMAKE_FORTRAN_COMPILER=mpif90 && \ make -j$(nproc) && \ make install && \ cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz + +### -DCMAKE_C_COMPILER=mpiicc \ +### -DCMAKE_CXX_COMPILER=mpiicpc \ ###### END of PEXSI PART # Clone and build abacus (optional during image build; keep for CI image) From 98fc4f4c7db61a8b1e6dd52fd33b2b175a9e7e32 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:04:27 +0800 Subject: [PATCH 27/92] Remove copying of .so files in Dockerfile Removed the copying of shared object files to lib directory. --- Dockerfile.intel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e56a8319e2..bf1ae354d6 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -93,9 +93,8 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ make -j$(nproc) && \ make install && \ - cp ${GKLIB_ROOT}/lib64/*so ${GKLIB_ROOT}/lib/ && \ cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip - #.so file CANNOT be found otherwise. +#.so file CANNOT be found otherwise. # 2. install METIS RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ unzip METIS-${METIS_VERSION}.zip && \ From f135a015ac89450a75b03d6c38c3dce8c61ff9fb Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:36:15 +0800 Subject: [PATCH 28/92] Update Dockerfile to include library path exports --- Dockerfile.intel | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index bf1ae354d6..514a7e007a 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -96,7 +96,8 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip #.so file CANNOT be found otherwise. # 2. install METIS -RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ +RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ unzip METIS-${METIS_VERSION}.zip && \ cd METIS-${METIS_VERSION} && \ make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ @@ -105,7 +106,8 @@ RUN wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VER cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip # 3. install ParMETIS -RUN wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ +RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ unzip ParMETIS-${PARMETIS_VERSION}.zip && \ cd ParMETIS-${PARMETIS_VERSION} && \ make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ @@ -144,7 +146,8 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S ### -DCMAKE_CUDA_COMPILER=nvcc \ # 5. install PEXSI -RUN wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ +RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ tar -xzf v${PEXSI_VERSION}.tar.gz && \ cd PEXSI-${PEXSI_VERSION} && \ mkdir build && cd build && \ From c3f0e4731d6336965715558fe7627632ea31651b Mon Sep 17 00:00:00 2001 From: Liang Sun <50293369+sunliang98@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:30:41 +0800 Subject: [PATCH 29/92] Update Dockerfile.intel --- Dockerfile.intel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 514a7e007a..47baf413d4 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -93,6 +93,8 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ make -j$(nproc) && \ make install && \ + ls ${GKLIB_ROOT}/lib && \ + cp ${GKLIB_ROOT}/lib/libGKlib.so.5 ${GKLIB_ROOT}/lib/libGKlib.so && \ cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip #.so file CANNOT be found otherwise. # 2. install METIS From ed44e786eee0f46e6129a25a5ce82c823aa783d6 Mon Sep 17 00:00:00 2001 From: Liang Sun <50293369+sunliang98@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:43:42 +0800 Subject: [PATCH 30/92] Update Dockerfile.intel --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 47baf413d4..e229436145 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -94,7 +94,7 @@ RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VER make -j$(nproc) && \ make install && \ ls ${GKLIB_ROOT}/lib && \ - cp ${GKLIB_ROOT}/lib/libGKlib.so.5 ${GKLIB_ROOT}/lib/libGKlib.so && \ + cp ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so && \ cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip #.so file CANNOT be found otherwise. # 2. install METIS From ac64756efb3422461819e9072076df35d77feb26 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Mon, 3 Nov 2025 16:51:16 +0800 Subject: [PATCH 31/92] Modify FindMKL.cmake to add support for finding and importing the MKL_CORE library. --- cmake/FindMKL.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index 26dece3b44..e6ebc856f7 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -100,3 +100,17 @@ if(NOT TARGET MKL::MKL_SCALAPACK) ) endif() endif() + + +if(NOT TARGET MKL::CORE) + find_library(MKL_CORE NAMES mkl_core HINTS ${MKLROOT}/lib ${MKLROOT}/lib/intel64) + message(STATUS "Found MKL_CORE: ${MKL_CORE}") + if(MKL_CORE) + # create an IMPORTED target that points to the discovered library file + add_library(MKL::CORE UNKNOWN IMPORTED) + set_target_properties(MKL::CORE PROPERTIES + IMPORTED_LOCATION "${MKL_CORE}" + INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE}" + ) + endif() +endif() \ No newline at end of file From b7ecb82b6ad7fe292513522d9a734a285478c1cb Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Mon, 3 Nov 2025 16:57:11 +0800 Subject: [PATCH 32/92] Turn off PEXSI --- Dockerfile.intel | 182 +++++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e229436145..1d16727279 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -74,97 +74,97 @@ RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared- unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} -###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist -ENV GKLIB_VERSION="master" -ENV METIS_VERSION="master" -ENV PARMETIS_VERSION="main" -ENV SUPERLU_DIST_VERSION=7.2.0 -ENV PEXSI_VERSION=2.0.0 -ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} -ENV METIS32_ROOT=/usr/local/metis32-${METIS_VERSION} -ENV PARMETIS32_ROOT=/usr/local/parmetis32-${PARMETIS_VERSION} -ENV PEXSI32_ROOT=/usr/local/pexsi32-${PEXSI_VERSION} -ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} - -# 2. install GKlib -RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ - unzip GKlib-${GKLIB_VERSION}.zip && \ - cd GKlib-${GKLIB_VERSION} && \ - make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ - make -j$(nproc) && \ - make install && \ - ls ${GKLIB_ROOT}/lib && \ - cp ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so && \ - cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip -#.so file CANNOT be found otherwise. -# 2. install METIS -RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ - wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ - unzip METIS-${METIS_VERSION}.zip && \ - cd METIS-${METIS_VERSION} && \ - make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ - make -j$(nproc) && \ - make install && \ - cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip - -# 3. install ParMETIS -RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ - wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ - unzip ParMETIS-${PARMETIS_VERSION}.zip && \ - cd ParMETIS-${PARMETIS_VERSION} && \ - make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ - make -j$(nproc) && \ - make install && \ - cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip - -# 4. install SuperLU_DIST -RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ - tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ - cd superlu_dist-${SUPERLU_DIST_VERSION} && \ - mkdir build && cd build && \ - cmake .. \ - -DTPL_ENABLE_PARMETISLIB=ON \ - -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ - -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ - -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ - -DTPL_ENABLE_LAPACKLIB=ON \ - -DTPL_ENABLE_COMBBLASLIB=OFF \ - -DTPL_ENABLE_CUDALIB=OFF \ - -DTPL_ENABLE_HIPLIB=OFF \ - -Denable_complex16=ON \ - -DXSDK_INDEX_SIZE=32 \ - -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ - -DCMAKE_C_FLAGS="-O3 -fopenmp" \ - -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ - -DXSDK_ENABLE_Fortran=ON \ - -DCMAKE_Fortran_COMPILER=mpif90 && \ - make -j$(nproc) && \ - make install && \ - cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz - -### -DCMAKE_C_COMPILER=mpiicc \ -### -DCMAKE_CXX_COMPILER=mpiicpc \ -### -DCMAKE_CUDA_COMPILER=nvcc \ - -# 5. install PEXSI -RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ - wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ - tar -xzf v${PEXSI_VERSION}.tar.gz && \ - cd PEXSI-${PEXSI_VERSION} && \ - mkdir build && cd build && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ - -DPEXSI_ENABLE_OPENMP=ON \ - -DPEXSI_ENABLE_FORTRAN=ON \ - -DCMAKE_FORTRAN_COMPILER=mpif90 && \ - make -j$(nproc) && \ - make install && \ - cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz - -### -DCMAKE_C_COMPILER=mpiicc \ -### -DCMAKE_CXX_COMPILER=mpiicpc \ -###### END of PEXSI PART +# ###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist +# ENV GKLIB_VERSION="master" +# ENV METIS_VERSION="master" +# ENV PARMETIS_VERSION="main" +# ENV SUPERLU_DIST_VERSION=7.2.0 +# ENV PEXSI_VERSION=2.0.0 +# ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} +# ENV METIS32_ROOT=/usr/local/metis32-${METIS_VERSION} +# ENV PARMETIS32_ROOT=/usr/local/parmetis32-${PARMETIS_VERSION} +# ENV PEXSI32_ROOT=/usr/local/pexsi32-${PEXSI_VERSION} +# ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} + +# # 2. install GKlib +# RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ +# unzip GKlib-${GKLIB_VERSION}.zip && \ +# cd GKlib-${GKLIB_VERSION} && \ +# make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ +# make -j$(nproc) && \ +# make install && \ +# ls ${GKLIB_ROOT}/lib && \ +# cp ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so && \ +# cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip +# #.so file CANNOT be found otherwise. +# # 2. install METIS +# RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ +# wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ +# unzip METIS-${METIS_VERSION}.zip && \ +# cd METIS-${METIS_VERSION} && \ +# make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ +# make -j$(nproc) && \ +# make install && \ +# cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip + +# # 3. install ParMETIS +# RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ +# wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ +# unzip ParMETIS-${PARMETIS_VERSION}.zip && \ +# cd ParMETIS-${PARMETIS_VERSION} && \ +# make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ +# make -j$(nproc) && \ +# make install && \ +# cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip + +# # 4. install SuperLU_DIST +# RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ +# tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ +# cd superlu_dist-${SUPERLU_DIST_VERSION} && \ +# mkdir build && cd build && \ +# cmake .. \ +# -DTPL_ENABLE_PARMETISLIB=ON \ +# -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ +# -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ +# -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ +# -DTPL_ENABLE_LAPACKLIB=ON \ +# -DTPL_ENABLE_COMBBLASLIB=OFF \ +# -DTPL_ENABLE_CUDALIB=OFF \ +# -DTPL_ENABLE_HIPLIB=OFF \ +# -Denable_complex16=ON \ +# -DXSDK_INDEX_SIZE=32 \ +# -DBUILD_SHARED_LIBS=ON \ +# -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ +# -DCMAKE_C_FLAGS="-O3 -fopenmp" \ +# -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ +# -DXSDK_ENABLE_Fortran=ON \ +# -DCMAKE_Fortran_COMPILER=mpif90 && \ +# make -j$(nproc) && \ +# make install && \ +# cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz + +# ### -DCMAKE_C_COMPILER=mpiicc \ +# ### -DCMAKE_CXX_COMPILER=mpiicpc \ +# ### -DCMAKE_CUDA_COMPILER=nvcc \ + +# # 5. install PEXSI +# RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ +# wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ +# tar -xzf v${PEXSI_VERSION}.tar.gz && \ +# cd PEXSI-${PEXSI_VERSION} && \ +# mkdir build && cd build && \ +# cmake .. \ +# -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ +# -DPEXSI_ENABLE_OPENMP=ON \ +# -DPEXSI_ENABLE_FORTRAN=ON \ +# -DCMAKE_FORTRAN_COMPILER=mpif90 && \ +# make -j$(nproc) && \ +# make install && \ +# cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz + +# ### -DCMAKE_C_COMPILER=mpiicc \ +# ### -DCMAKE_CXX_COMPILER=mpiicpc \ +# ###### END of PEXSI PART # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null From 12d34786a2d0ef5efab980b0273cf2dcd38e11a7 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Mon, 3 Nov 2025 18:46:43 +0800 Subject: [PATCH 33/92] Update FindMKL.cmake and CMakeLists.txt --- CMakeLists.txt | 2 +- cmake/FindMKL.cmake | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e921dce23..0830d4d005 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -466,7 +466,7 @@ if(MKLROOT) find_package(MKL REQUIRED) add_definitions(-D__MKL) include_directories(${MKL_INCLUDE} ${MKL_INCLUDE}/fftw) - list(APPEND math_libs MKL::MKL MKL::MKL_SCALAPACK) + list(APPEND math_libs MKL::MKL) if(CMAKE_CXX_COMPILER_ID MATCHES Intel) list(APPEND math_libs ifcore) endif() diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index e6ebc856f7..ca1147a432 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -70,7 +70,9 @@ if(MKL_FOUND) set_property(TARGET MKL::MKL PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--start-group" - MKL::INTEL MKL::INTEL_THREAD MKL::CORE) + MKL::INTEL MKL::INTEL_THREAD MKL::CORE + "-Wl,--end-group" + ) endif() endif() From 350a78e1d803e4a0c16403f40e743fc61a201511 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:03:50 +0800 Subject: [PATCH 34/92] Update Dockerfile.intel --- Dockerfile.intel | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 1d16727279..2b1c4e61d5 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -171,6 +171,10 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ + -DMKL_SYCL=OFF \ + -DMKL_SYCL_INTERFACE_FULL=OFF \ + -DMKL_SYCL_DISTRIBUTED_DFT=OFF \ + -DMKL_SYCL_LINK=OFF \ -DENABLE_MLALGO=ON \ -DENABLE_LIBXC=ON \ -DENABLE_LIBRI=ON \ From 1df9d5370e51d041eb87d16ed34c6f96a4d8e02a Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 3 Nov 2025 22:07:04 +0800 Subject: [PATCH 35/92] Update ABACUS version check path in Dockerfile --- Dockerfile.intel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 2b1c4e61d5..c52e63a4e0 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -174,7 +174,6 @@ RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --de -DMKL_SYCL=OFF \ -DMKL_SYCL_INTERFACE_FULL=OFF \ -DMKL_SYCL_DISTRIBUTED_DFT=OFF \ - -DMKL_SYCL_LINK=OFF \ -DENABLE_MLALGO=ON \ -DENABLE_LIBXC=ON \ -DENABLE_LIBRI=ON \ @@ -182,7 +181,7 @@ RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --de -DCMAKE_BUILD_TYPE=Release && \ cmake --build build -j"$(nproc)" && \ cmake --install build && \ - (/usr/bin/abacus --version || echo "ABACUS installed but version check failed") && \ + (/usr/local/bin/abacus --version || echo "ABACUS installed but version check failed") && \ rm -rf /tmp/abacus-develop # Default entry From d37f51d3a094e601312eb3d6be83e9cdf8f7645a Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 12:33:43 +0800 Subject: [PATCH 36/92] Update library paths in Dockerfile.intel --- Dockerfile.intel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index c52e63a4e0..a8b3687713 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -30,8 +30,8 @@ ENV MKLROOT=${ONEAPI_ROOT}/mkl/latest ENV CMPLR_ROOT=${ONEAPI_ROOT}/compiler/latest # 设置库路径和包含路径 -ENV LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/intel64:${LIBRARY_PATH} -ENV LD_LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/intel64:${LD_LIBRARY_PATH} +ENV LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/:${LIBRARY_PATH} +ENV LD_LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/:${LD_LIBRARY_PATH} ENV PATH=${ONEAPI_ROOT}/vtune/latest/bin64:${ONEAPI_ROOT}/mpi/latest/bin:${MKLROOT}/bin/intel64:${ONEAPI_ROOT}/compiler/latest/bin:${PATH} ENV CPATH=${MKLROOT}/include:${ONEAPI_ROOT}/mpi/latest/include:${CPATH} ENV PKG_CONFIG_PATH=${MKLROOT}/lib/pkgconfig:${ONEAPI_ROOT}/mpi/latest/lib/pkgconfig:${PKG_CONFIG_PATH} From 6cbc62af51568b47b89de4bab0bed3b689f92485 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 13:17:37 +0800 Subject: [PATCH 37/92] Uncomment PEXSI installation steps in Dockerfile --- Dockerfile.intel | 190 ++++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 94 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index a8b3687713..def3edf257 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -74,107 +74,109 @@ RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared- unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} -# ###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist -# ENV GKLIB_VERSION="master" -# ENV METIS_VERSION="master" -# ENV PARMETIS_VERSION="main" -# ENV SUPERLU_DIST_VERSION=7.2.0 -# ENV PEXSI_VERSION=2.0.0 -# ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} -# ENV METIS32_ROOT=/usr/local/metis32-${METIS_VERSION} -# ENV PARMETIS32_ROOT=/usr/local/parmetis32-${PARMETIS_VERSION} -# ENV PEXSI32_ROOT=/usr/local/pexsi32-${PEXSI_VERSION} -# ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} - -# # 2. install GKlib -# RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ -# unzip GKlib-${GKLIB_VERSION}.zip && \ -# cd GKlib-${GKLIB_VERSION} && \ -# make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ -# make -j$(nproc) && \ -# make install && \ -# ls ${GKLIB_ROOT}/lib && \ -# cp ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so && \ -# cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip -# #.so file CANNOT be found otherwise. -# # 2. install METIS -# RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ -# wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ -# unzip METIS-${METIS_VERSION}.zip && \ -# cd METIS-${METIS_VERSION} && \ -# make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ -# make -j$(nproc) && \ -# make install && \ -# cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip - -# # 3. install ParMETIS -# RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ -# wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ -# unzip ParMETIS-${PARMETIS_VERSION}.zip && \ -# cd ParMETIS-${PARMETIS_VERSION} && \ -# make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ -# make -j$(nproc) && \ -# make install && \ -# cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip - -# # 4. install SuperLU_DIST -# RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ -# tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ -# cd superlu_dist-${SUPERLU_DIST_VERSION} && \ -# mkdir build && cd build && \ -# cmake .. \ -# -DTPL_ENABLE_PARMETISLIB=ON \ -# -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ -# -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -# -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ -# -DTPL_ENABLE_LAPACKLIB=ON \ -# -DTPL_ENABLE_COMBBLASLIB=OFF \ -# -DTPL_ENABLE_CUDALIB=OFF \ -# -DTPL_ENABLE_HIPLIB=OFF \ -# -Denable_complex16=ON \ -# -DXSDK_INDEX_SIZE=32 \ -# -DBUILD_SHARED_LIBS=ON \ -# -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ -# -DCMAKE_C_FLAGS="-O3 -fopenmp" \ -# -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ -# -DXSDK_ENABLE_Fortran=ON \ -# -DCMAKE_Fortran_COMPILER=mpif90 && \ -# make -j$(nproc) && \ -# make install && \ -# cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz - -# ### -DCMAKE_C_COMPILER=mpiicc \ -# ### -DCMAKE_CXX_COMPILER=mpiicpc \ -# ### -DCMAKE_CUDA_COMPILER=nvcc \ - -# # 5. install PEXSI -# RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ -# wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ -# tar -xzf v${PEXSI_VERSION}.tar.gz && \ -# cd PEXSI-${PEXSI_VERSION} && \ -# mkdir build && cd build && \ -# cmake .. \ -# -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -# -DPEXSI_ENABLE_OPENMP=ON \ -# -DPEXSI_ENABLE_FORTRAN=ON \ -# -DCMAKE_FORTRAN_COMPILER=mpif90 && \ -# make -j$(nproc) && \ -# make install && \ -# cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz - -# ### -DCMAKE_C_COMPILER=mpiicc \ -# ### -DCMAKE_CXX_COMPILER=mpiicpc \ -# ###### END of PEXSI PART +###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist +ENV GKLIB_VERSION="master" +ENV METIS_VERSION="master" +ENV PARMETIS_VERSION="main" +ENV SUPERLU_DIST_VERSION=7.2.0 +ENV PEXSI_VERSION=2.0.0 +ENV GKLIB_ROOT=/usr/local/gklib-${GKLIB_VERSION} +ENV METIS32_ROOT=/usr/local/metis32-${METIS_VERSION} +ENV PARMETIS32_ROOT=/usr/local/parmetis32-${PARMETIS_VERSION} +ENV PEXSI32_ROOT=/usr/local/pexsi32-${PEXSI_VERSION} +ENV SUPERLU_DIST32_ROOT=/usr/local/superlu_dist32-${SUPERLU_DIST_VERSION} + +# 2. install GKlib +RUN wget https://codeload.github.com/KarypisLab/GKlib/zip/refs/heads/${GKLIB_VERSION} -O GKlib-${GKLIB_VERSION}.zip && \ + unzip GKlib-${GKLIB_VERSION}.zip && \ + cd GKlib-${GKLIB_VERSION} && \ + make config shared=1 prefix=${GKLIB_ROOT} openmp=set && \ + make -j$(nproc) && \ + make install && \ + ls ${GKLIB_ROOT}/lib && \ + cp ${GKLIB_ROOT}/lib/libGKlib.so.0 ${GKLIB_ROOT}/lib/libGKlib.so && \ + cd / && rm -rf GKlib-${GKLIB_VERSION} GKlib-${GKLIB_VERSION}.zip +#.so file CANNOT be found otherwise. +# 2. install METIS +RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://codeload.github.com/KarypisLab/METIS/zip/refs/heads/${METIS_VERSION} -O METIS-${METIS_VERSION}.zip && \ + unzip METIS-${METIS_VERSION}.zip && \ + cd METIS-${METIS_VERSION} && \ + make config shared=1 prefix=${METIS32_ROOT} gklib_path=${GKLIB_ROOT} && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf METIS-${METIS_VERSION} METIS-${METIS_VERSION}.zip + +# 3. install ParMETIS +RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://codeload.github.com/KarypisLab/ParMETIS/zip/refs/heads/${PARMETIS_VERSION} -O ParMETIS-${PARMETIS_VERSION}.zip && \ + unzip ParMETIS-${PARMETIS_VERSION}.zip && \ + cd ParMETIS-${PARMETIS_VERSION} && \ + make config shared=1 prefix=${PARMETIS32_ROOT} gklib_path=${GKLIB_ROOT} metis_path=${METIS32_ROOT} && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip + +# 4. install SuperLU_DIST +RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ + tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ + cd superlu_dist-${SUPERLU_DIST_VERSION} && \ + mkdir build && cd build && \ + cmake .. \ + -DTPL_ENABLE_PARMETISLIB=ON \ + -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ + -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ + -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ + -DTPL_ENABLE_LAPACKLIB=ON \ + -DTPL_ENABLE_COMBBLASLIB=OFF \ + -DTPL_ENABLE_CUDALIB=OFF \ + -DTPL_ENABLE_HIPLIB=OFF \ + -Denable_complex16=ON \ + -DXSDK_INDEX_SIZE=32 \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX=${SUPERLU_DIST32_ROOT} \ + -DCMAKE_C_FLAGS="-O3 -fopenmp" \ + -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ + -DXSDK_ENABLE_Fortran=ON \ + -DCMAKE_Fortran_COMPILER=mpif90 && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz + +### -DCMAKE_C_COMPILER=mpiicc \ +### -DCMAKE_CXX_COMPILER=mpiicpc \ +### -DCMAKE_CUDA_COMPILER=nvcc \ + +# 5. install PEXSI +RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ + tar -xzf v${PEXSI_VERSION}.tar.gz && \ + cd PEXSI-${PEXSI_VERSION} && \ + mkdir build && cd build && \ + cmake .. \ + -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ + -DPEXSI_ENABLE_OPENMP=ON \ + -DPEXSI_ENABLE_FORTRAN=ON \ + -DCMAKE_FORTRAN_COMPILER=mpif90 && \ + make -j$(nproc) && \ + make install && \ + cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz + +### -DCMAKE_C_COMPILER=mpiicc \ +### -DCMAKE_CXX_COMPILER=mpiicpc \ +###### END of PEXSI PART + # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null -RUN cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ +RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ + export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ + cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ -DMKL_SYCL=OFF \ - -DMKL_SYCL_INTERFACE_FULL=OFF \ - -DMKL_SYCL_DISTRIBUTED_DFT=OFF \ -DENABLE_MLALGO=ON \ + -DENABLE_PEXSI=ON \ -DENABLE_LIBXC=ON \ -DENABLE_LIBRI=ON \ -DENABLE_RAPIDJSON=ON \ From e9f4086d441148ad6770207ecd0905da47b517ad Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 13:49:20 +0800 Subject: [PATCH 38/92] Change Fortran compiler from mpif90 to mpiifort --- Dockerfile.intel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index def3edf257..acb48ccb6f 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -138,7 +138,7 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S -DCMAKE_C_FLAGS="-O3 -fopenmp" \ -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ -DXSDK_ENABLE_Fortran=ON \ - -DCMAKE_Fortran_COMPILER=mpif90 && \ + -DCMAKE_Fortran_COMPILER=mpiifort && \ make -j$(nproc) && \ make install && \ cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz @@ -157,7 +157,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ - -DCMAKE_FORTRAN_COMPILER=mpif90 && \ + -DCMAKE_FORTRAN_COMPILER=mpiifort && \ make -j$(nproc) && \ make install && \ cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz From 8947be15b79b74ebf11077c0fcc439475102e9f9 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:18:54 +0800 Subject: [PATCH 39/92] source setvar.sh --- Dockerfile.intel | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index acb48ccb6f..9d8d91f941 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -118,7 +118,8 @@ RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PA cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip # 4. install SuperLU_DIST -RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ +RUN source ${ONEAPI_ROOT}/setvars.sh && \ + wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ cd superlu_dist-${SUPERLU_DIST_VERSION} && \ mkdir build && cd build && \ @@ -148,7 +149,8 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S ### -DCMAKE_CUDA_COMPILER=nvcc \ # 5. install PEXSI -RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ +RUN source ${ONEAPI_ROOT}/setvars.sh && \ + export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ tar -xzf v${PEXSI_VERSION}.tar.gz && \ cd PEXSI-${PEXSI_VERSION} && \ From 0ed15af44fc079fa9f8cea8f0c8813578d697262 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 18:01:47 +0800 Subject: [PATCH 40/92] Update Dockerfile to install SuperLU_DIST --- Dockerfile.intel | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 9d8d91f941..2752340174 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -119,6 +119,7 @@ RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PA # 4. install SuperLU_DIST RUN source ${ONEAPI_ROOT}/setvars.sh && \ + echo `which ifort` && \ wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ cd superlu_dist-${SUPERLU_DIST_VERSION} && \ From 221cd563ad4f6c3ea58285a2986cb50b1c36bd9c Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Tue, 4 Nov 2025 20:08:29 +0800 Subject: [PATCH 41/92] Update Dockerfile.intel --- Dockerfile.intel | 50 ++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 2752340174..1d40e7b632 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -55,25 +55,6 @@ RUN source ${ONEAPI_ROOT}/setvars.sh && \ echo "=== 验证MPI ===" && \ which mpirun && mpirun --version -# Build ELPA (example dependency) -RUN source /opt/intel/oneapi/setvars.sh && \ - cd /tmp && \ - ELPA_VER=2022.11.001 && \ - wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ - tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ - cd elpa-$ELPA_VER && mkdir build && cd build && \ - ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ - make -j$(nproc) && \ - make PREFIX=/usr/local install && \ - ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \ - cd /tmp && rm -rf elpa-$ELPA_VER - -# rapidjson and libtorch -RUN cd /tmp && git clone --depth 1 https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ && rm -rf rapidjson -RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \ - unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip -ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} - ###### PEXSI PART: pexsi and gklib and metis and parmetis and superlu_dist ENV GKLIB_VERSION="master" ENV METIS_VERSION="master" @@ -118,8 +99,13 @@ RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PA cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip # 4. install SuperLU_DIST -RUN source ${ONEAPI_ROOT}/setvars.sh && \ - echo `which ifort` && \ +RUN echo "--- 检查 ifort 是否已安装 ---" && \ + find /opt/intel -name "ifort" && \ + echo "--- 检查 ifort 是否在 PATH 中 ---" && \ + which ifort || echo "ifort 不在 PATH 中" && \ + source ${ONEAPI_ROOT}/setvars.sh && \ + echo "--- 激活后再次检查 ifort 是否在 PATH 中 ---" && \ + which ifort || echo "激活后 ifort 仍然不在 PATH 中" && \ wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ cd superlu_dist-${SUPERLU_DIST_VERSION} && \ @@ -170,6 +156,28 @@ RUN source ${ONEAPI_ROOT}/setvars.sh && \ ###### END of PEXSI PART +# Build ELPA (example dependency) +RUN source /opt/intel/oneapi/setvars.sh && \ + cd /tmp && \ + ELPA_VER=2022.11.001 && \ + wget -q https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/$ELPA_VER/elpa-$ELPA_VER.tar.gz && \ + tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \ + cd elpa-$ELPA_VER && mkdir build && cd build && \ + ../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \ + make -j$(nproc) && \ + make PREFIX=/usr/local install && \ + ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \ + cd /tmp && rm -rf elpa-$ELPA_VER + +# rapidjson and libtorch +RUN cd /tmp && git clone --depth 1 https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ && rm -rf rapidjson +RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \ + unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip +ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} + + + + # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ From 05bd604ffbe28a8106445cf9dd6e735dd8c02317 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 07:05:57 +0800 Subject: [PATCH 42/92] Update Fortran compiler from mpiifort to mpiifx --- Dockerfile.intel | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 1d40e7b632..a8154144c7 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -99,14 +99,7 @@ RUN export LD_LIBRARY_PATH=${METIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PA cd / && rm -rf ParMETIS-${PARMETIS_VERSION} ParMETIS-${PARMETIS_VERSION}.zip # 4. install SuperLU_DIST -RUN echo "--- 检查 ifort 是否已安装 ---" && \ - find /opt/intel -name "ifort" && \ - echo "--- 检查 ifort 是否在 PATH 中 ---" && \ - which ifort || echo "ifort 不在 PATH 中" && \ - source ${ONEAPI_ROOT}/setvars.sh && \ - echo "--- 激活后再次检查 ifort 是否在 PATH 中 ---" && \ - which ifort || echo "激活后 ifort 仍然不在 PATH 中" && \ - wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ +RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${SUPERLU_DIST_VERSION} -O v${SUPERLU_DIST_VERSION}.tar.gz && \ tar -xzf v${SUPERLU_DIST_VERSION}.tar.gz && \ cd superlu_dist-${SUPERLU_DIST_VERSION} && \ mkdir build && cd build && \ @@ -126,7 +119,7 @@ RUN echo "--- 检查 ifort 是否已安装 ---" && \ -DCMAKE_C_FLAGS="-O3 -fopenmp" \ -DCMAKE_CXX_FLAGS="-O3 -fopenmp" \ -DXSDK_ENABLE_Fortran=ON \ - -DCMAKE_Fortran_COMPILER=mpiifort && \ + -DCMAKE_Fortran_COMPILER=mpiifx && \ make -j$(nproc) && \ make install && \ cd / && rm -rf superlu_dist-${SUPERLU_DIST_VERSION} v${SUPERLU_DIST_VERSION}.tar.gz @@ -146,7 +139,7 @@ RUN source ${ONEAPI_ROOT}/setvars.sh && \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ - -DCMAKE_FORTRAN_COMPILER=mpiifort && \ + -DCMAKE_FORTRAN_COMPILER=mpiifx && \ make -j$(nproc) && \ make install && \ cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz From d9108e223a6c14cacdd310f26902b85194c30572 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 09:27:09 +0800 Subject: [PATCH 43/92] Fix library paths and RUN command in Dockerfile.intel Updated library paths for PARMETIS in Dockerfile and removed source command from RUN instruction. --- Dockerfile.intel | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index a8154144c7..a00c371de0 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -105,7 +105,7 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S mkdir build && cd build && \ cmake .. \ -DTPL_ENABLE_PARMETISLIB=ON \ - -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib64/libGKlib.so" \ + -DTPL_PARMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib/libGKlib.so" \ -DTPL_PARMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -DTPL_ENABLE_INTERNAL_BLASLIB=OFF \ -DTPL_ENABLE_LAPACKLIB=ON \ @@ -129,8 +129,7 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S ### -DCMAKE_CUDA_COMPILER=nvcc \ # 5. install PEXSI -RUN source ${ONEAPI_ROOT}/setvars.sh && \ - export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ +RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ tar -xzf v${PEXSI_VERSION}.tar.gz && \ cd PEXSI-${PEXSI_VERSION} && \ From c49741fb8f22ffcbf94ee1c8bf6eaa13c7cdc8b6 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 13:30:45 +0800 Subject: [PATCH 44/92] Update PEXSI download link and cleanup commands --- Dockerfile.intel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index a00c371de0..6980f5aa65 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -130,9 +130,9 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S # 5. install PEXSI RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ - wget https://github.com/ecrc/PEXSI/archive/v${PEXSI_VERSION}.tar.gz && \ + wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz -O v${PEXSI_VERSION}.tar.gz && \ tar -xzf v${PEXSI_VERSION}.tar.gz && \ - cd PEXSI-${PEXSI_VERSION} && \ + cd v${PEXSI_VERSION} && \ mkdir build && cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ @@ -141,7 +141,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM -DCMAKE_FORTRAN_COMPILER=mpiifx && \ make -j$(nproc) && \ make install && \ - cd / && rm -rf PEXSI-${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz + cd / && rm -rf v${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz ### -DCMAKE_C_COMPILER=mpiicc \ ### -DCMAKE_CXX_COMPILER=mpiicpc \ From d2fc1e8a9cbb5602bf5906fb01ac0142ffe4c60a Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 14:47:51 +0800 Subject: [PATCH 45/92] Fix download and extraction commands for PEXSI --- Dockerfile.intel | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 6980f5aa65..42bf862244 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -130,9 +130,9 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S # 5. install PEXSI RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ - wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz -O v${PEXSI_VERSION}.tar.gz && \ - tar -xzf v${PEXSI_VERSION}.tar.gz && \ - cd v${PEXSI_VERSION} && \ + wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ + tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ + cd pexsi_v${PEXSI_VERSION} && \ mkdir build && cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ @@ -141,7 +141,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM -DCMAKE_FORTRAN_COMPILER=mpiifx && \ make -j$(nproc) && \ make install && \ - cd / && rm -rf v${PEXSI_VERSION} v${PEXSI_VERSION}.tar.gz + cd / && rm -rf pexsi_v${PEXSI_VERSION} pexsi_v${PEXSI_VERSION}.tar.gz ### -DCMAKE_C_COMPILER=mpiicc \ ### -DCMAKE_CXX_COMPILER=mpiicpc \ From 67a7d2e9e7d380654ed96e3724fd31d53d0bce08 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:54:18 +0800 Subject: [PATCH 46/92] Add PEXSI installation to Dockerfile.intel Updated the Dockerfile to include PEXSI installation steps. --- Dockerfile.intel | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 42bf862244..10f355b173 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -130,12 +130,15 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S # 5. install PEXSI RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + export CPATH=${SUPERLU_DIST32_ROOT}/include:${PARMETIS32_ROOT}/include:${METIS32_ROOT}/include:${GKLIB_ROOT}/include:${CPATH} && \ wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ cd pexsi_v${PEXSI_VERSION} && \ mkdir build && cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ + -DMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib/libGKlib.so" \ + -DMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ -DCMAKE_FORTRAN_COMPILER=mpiifx && \ From a8a3d739d01c15d93b985855b223feda8fb8a5e2 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 16:35:49 +0800 Subject: [PATCH 47/92] Fix METIS_INCLUDE_DIRS to METIS_INCLUDE_DIR --- Dockerfile.intel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 10f355b173..e381a70475 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -138,7 +138,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -DMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib/libGKlib.so" \ - -DMETIS_INCLUDE_DIRS="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ + -DMETIS_INCLUDE_DIR="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ -DCMAKE_FORTRAN_COMPILER=mpiifx && \ From cd4984fb09c9ca5ce7cf03b2d5d82bf83a8750d4 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:04:52 +0800 Subject: [PATCH 48/92] Refactor CMake arguments in Dockerfile.intel Removed METIS_LIBRARIES and METIS_INCLUDE_DIR from CMake arguments. --- Dockerfile.intel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index e381a70475..c83c2fce94 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -130,6 +130,7 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S # 5. install PEXSI RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + export PKG_CONFIG_PATH=${SUPERLU_DIST32_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${GKLIB_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH} && \ export CPATH=${SUPERLU_DIST32_ROOT}/include:${PARMETIS32_ROOT}/include:${METIS32_ROOT}/include:${GKLIB_ROOT}/include:${CPATH} && \ wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ @@ -137,8 +138,6 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM mkdir build && cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ - -DMETIS_LIBRARIES="${PARMETIS32_ROOT}/lib/libparmetis.so;${METIS32_ROOT}/lib/libmetis.so;${GKLIB_ROOT}/lib/libGKlib.so" \ - -DMETIS_INCLUDE_DIR="${PARMETIS32_ROOT}/include;${METIS32_ROOT}/include;${GKLIB_ROOT}/include" \ -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ -DCMAKE_FORTRAN_COMPILER=mpiifx && \ From b141e1ae631b22200ec7efd782381890637cbc84 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:28:57 +0800 Subject: [PATCH 49/92] Add CMAKE_PREFIX_PATH --- Dockerfile.intel | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index c83c2fce94..8370532634 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -130,8 +130,10 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S # 5. install PEXSI RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LD_LIBRARY_PATH} && \ + export LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LIBRARY_PATH} && \ export PKG_CONFIG_PATH=${SUPERLU_DIST32_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${GKLIB_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH} && \ - export CPATH=${SUPERLU_DIST32_ROOT}/include:${PARMETIS32_ROOT}/include:${METIS32_ROOT}/include:${GKLIB_ROOT}/include:${CPATH} && \ + export CPATH=${SUPERLU_DIST32_ROOT}/include:${PARMETIS32_ROOT}/include:${METIS32_ROOT}/include:${GKLIB_ROOT}/include:${CMAKE_PREFIX_PATH} && \ + export CMAKE_PREFIX_PATH=${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CPATH} && \ wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ cd pexsi_v${PEXSI_VERSION} && \ From 08317d347adb077b19548c13c12c34f3ad32a9ad Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 21:31:39 +0800 Subject: [PATCH 50/92] Fix Dockerfile for Intel oneAPI and PEXSI build --- Dockerfile.intel | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 8370532634..810814819a 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -19,7 +19,8 @@ RUN apt-get update && \ intel-oneapi-compiler-fortran \ intel-oneapi-mkl-devel \ intel-oneapi-mpi-devel \ - intel-oneapi-vtune && \ + intel-oneapi-vtune \ + linux-headers-5.15.0-46-generic && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -111,7 +112,6 @@ RUN wget https://codeload.github.com/xiaoyeli/superlu_dist/tar.gz/refs/tags/v${S -DTPL_ENABLE_LAPACKLIB=ON \ -DTPL_ENABLE_COMBBLASLIB=OFF \ -DTPL_ENABLE_CUDALIB=OFF \ - -DTPL_ENABLE_HIPLIB=OFF \ -Denable_complex16=ON \ -DXSDK_INDEX_SIZE=32 \ -DBUILD_SHARED_LIBS=ON \ @@ -133,7 +133,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM export LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${GKLIB_ROOT}/lib:${LIBRARY_PATH} && \ export PKG_CONFIG_PATH=${SUPERLU_DIST32_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${GKLIB_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH} && \ export CPATH=${SUPERLU_DIST32_ROOT}/include:${PARMETIS32_ROOT}/include:${METIS32_ROOT}/include:${GKLIB_ROOT}/include:${CMAKE_PREFIX_PATH} && \ - export CMAKE_PREFIX_PATH=${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CPATH} && \ + export CMAKE_PREFIX_PATH=${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH} && \ wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ cd pexsi_v${PEXSI_VERSION} && \ @@ -143,7 +143,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM -DPEXSI_ENABLE_OPENMP=ON \ -DPEXSI_ENABLE_FORTRAN=ON \ -DCMAKE_FORTRAN_COMPILER=mpiifx && \ - make -j$(nproc) && \ + make pexsi -j$(nproc) && \ make install && \ cd / && rm -rf pexsi_v${PEXSI_VERSION} pexsi_v${PEXSI_VERSION}.tar.gz @@ -178,10 +178,12 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ + export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH} && \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ -DMKL_SYCL=OFF \ + -DMKL_SYCL_LINK=OFF \ -DENABLE_MLALGO=ON \ -DENABLE_PEXSI=ON \ -DENABLE_LIBXC=ON \ From 1eecf2337371092392fb114b1b41e9a4eb5363da Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Wed, 5 Nov 2025 22:25:46 +0800 Subject: [PATCH 51/92] Update Dockerfile.intel --- Dockerfile.intel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 810814819a..25d3170210 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -19,8 +19,7 @@ RUN apt-get update && \ intel-oneapi-compiler-fortran \ intel-oneapi-mkl-devel \ intel-oneapi-mpi-devel \ - intel-oneapi-vtune \ - linux-headers-5.15.0-46-generic && \ + intel-oneapi-vtune && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* From aa3fa474c6864d65fa5a7d9e3c1214483db464d1 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 06:57:59 +0800 Subject: [PATCH 52/92] Comment out add_executable in pexsi CMake files Comment out add_executable lines in CMakeLists.txt for pexsi. --- Dockerfile.intel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 25d3170210..c71ab96693 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -136,6 +136,8 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ cd pexsi_v${PEXSI_VERSION} && \ + sed -i 's/add_executable/# add_executable/g' fortran/CMakeLists.txt && \ + sed -i 's/add_executable/# add_executable/g' examples/CMakeLists.txt && \ mkdir build && cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ From 24388620543fa236d7588dfdc154ef90feead626 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:01:22 +0800 Subject: [PATCH 53/92] Disable Fortran support in Dockerfile.intel --- Dockerfile.intel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index c71ab96693..2275bf2103 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -142,8 +142,7 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM cmake .. \ -DCMAKE_INSTALL_PREFIX=${PEXSI32_ROOT} \ -DPEXSI_ENABLE_OPENMP=ON \ - -DPEXSI_ENABLE_FORTRAN=ON \ - -DCMAKE_FORTRAN_COMPILER=mpiifx && \ + -DPEXSI_ENABLE_FORTRAN=OFF && \ make pexsi -j$(nproc) && \ make install && \ cd / && rm -rf pexsi_v${PEXSI_VERSION} pexsi_v${PEXSI_VERSION}.tar.gz From c9cefbd5768a669b7a04b413fefab7afb304d6a7 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:38:28 +0800 Subject: [PATCH 54/92] Modify CMakeLists to comment out example executables Comment out example executable additions in CMakeLists. --- Dockerfile.intel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 2275bf2103..f98e64fe05 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -136,6 +136,8 @@ RUN export LD_LIBRARY_PATH=${SUPERLU_DIST32_ROOT}/lib:${METIS32_ROOT}/lib:${PARM wget https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v${PEXSI_VERSION}.tar.gz && \ tar -xzf pexsi_v${PEXSI_VERSION}.tar.gz && \ cd pexsi_v${PEXSI_VERSION} && \ + sed -i 's/^add_pexsi_f_example_exe/# add_pexsi_f_example_exe/g' fortran/CMakeLists.txt && \ + sed -i 's/^add_pexsi_example_exe/# add_pexsi_example_exe/g' examples/CMakeLists.txt && \ sed -i 's/add_executable/# add_executable/g' fortran/CMakeLists.txt && \ sed -i 's/add_executable/# add_executable/g' examples/CMakeLists.txt && \ mkdir build && cd build && \ From b2bdcd61dda038169cada257dd2c96a1e5da937d Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 19:01:54 +0800 Subject: [PATCH 55/92] Change abacus-develop retrieval method in Dockerfile Replaced git clone with wget and unzip for abacus-develop. --- Dockerfile.intel | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index f98e64fe05..c081ed861a 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -181,8 +181,9 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH} && \ - cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ - cd abacus-develop && \ + cd /tmp && wget https://github.com/deepmodeling/abacus-develop/archive/refs/tags/v3.9.0.17.zip -O abacus-develop-3.9.0.17.zip && \ + unzip abacus-develop-3.9.0.17.zip && \ + cd abacus-develop-3.9.0.17 && \ cmake -B build \ -DMKL_SYCL=OFF \ -DMKL_SYCL_LINK=OFF \ From a7c224594f02a8ebcc9f956964cba3d20931c9d5 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:01:56 +0800 Subject: [PATCH 56/92] Add include directive in edm.cpp for LCAO --- Dockerfile.intel | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index c081ed861a..d56ec53c5c 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -184,6 +184,7 @@ RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_RO cd /tmp && wget https://github.com/deepmodeling/abacus-develop/archive/refs/tags/v3.9.0.17.zip -O abacus-develop-3.9.0.17.zip && \ unzip abacus-develop-3.9.0.17.zip && \ cd abacus-develop-3.9.0.17 && \ + sed -i '3i\#include "source_estate/elecstate_lcao.h"' source/source_lcao/edm.cpp && \ cmake -B build \ -DMKL_SYCL=OFF \ -DMKL_SYCL_LINK=OFF \ From 95058348a1d2e7f7dcfa11cc0e87204f6456aafe Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:37:08 +0800 Subject: [PATCH 57/92] Update elecstate_lcao.cpp --- source/source_estate/elecstate_lcao.cpp | 34 +++++++++++-------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/source/source_estate/elecstate_lcao.cpp b/source/source_estate/elecstate_lcao.cpp index b0518d817e..a9578b228a 100644 --- a/source/source_estate/elecstate_lcao.cpp +++ b/source/source_estate/elecstate_lcao.cpp @@ -1,6 +1,5 @@ -#include "elecstate_lcao.h" - -#include "cal_dm.h" +#include "source_estate/elecstate_lcao.h" +#include "source_estate/cal_dm.h" #include "source_base/timer.h" #include "source_estate/module_dm/cal_dm_psi.h" #include "source_hamilt/module_xc/xc_functional.h" @@ -15,12 +14,6 @@ namespace elecstate { -template -void ElecStateLCAO::init_DM(const K_Vectors* kv, const Parallel_Orbitals* paraV, const int nspin) -{ - const int nspin_dm = nspin == 2 ? 2 : 1; - this->DM = new DensityMatrix(paraV, nspin_dm, kv->kvec_d, kv->get_nks() / nspin_dm); -} template <> double ElecStateLCAO::get_spin_constrain_energy() @@ -37,9 +30,10 @@ double ElecStateLCAO>::get_spin_constrain_energy() return sc.cal_escon(); } -#ifdef __PEXSI template <> -void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, std::vector pexsi_EDM) +void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, + std::vector pexsi_EDM, + DensityMatrix* dm) { ModuleBase::timer::tick("ElecStateLCAO", "dm2Rho"); @@ -49,13 +43,15 @@ void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, std::vectorget_DM()->pexsi_EDM = pexsi_EDM; +#ifdef __PEXSI + dm->pexsi_EDM = pexsi_EDM; +#endif for (int is = 0; is < nspin; is++) { - this->DM->set_DMK_pointer(is, pexsi_DM[is]); + dm->set_DMK_pointer(is, pexsi_DM[is]); } - DM->cal_DMR(); + dm->cal_DMR(); for (int is = 0; is < PARAM.inp.nspin; is++) { @@ -64,14 +60,14 @@ void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, std::vectorDM->get_DMR_vector(), PARAM.inp.nspin, this->charge->rho); + ModuleGint::cal_gint_rho(dm->get_DMR_vector(), PARAM.inp.nspin, this->charge->rho); if (XC_Functional::get_ked_flag()) { for (int is = 0; is < PARAM.inp.nspin; is++) { ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[0], this->charge->nrxx); } - ModuleGint::cal_gint_tau(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->kin_r); + ModuleGint::cal_gint_tau(dm->get_DMR_vector(), PARAM.inp.nspin, this->charge->kin_r); } this->charge->renormalize_rho(); @@ -81,13 +77,13 @@ void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, std::vector -void ElecStateLCAO>::dm2rho(std::vector*> pexsi_DM, - std::vector*> pexsi_EDM) +void ElecStateLCAO>::dm2Rho(std::vector*> pexsi_DM, + std::vector*> pexsi_EDM, + DensityMatrix, double>* dm) { ModuleBase::WARNING_QUIT("ElecStateLCAO", "pexsi is not completed for multi-k case"); } -#endif template class ElecStateLCAO; // Gamma_only case template class ElecStateLCAO>; // multi-k case From 14a698349601996d30ababc05a3d72fc694ed845 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:39:36 +0800 Subject: [PATCH 58/92] Update elecstate_lcao.h --- source/source_estate/elecstate_lcao.h | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/source/source_estate/elecstate_lcao.h b/source/source_estate/elecstate_lcao.h index e9bb3077a5..eafc1e0a0d 100644 --- a/source/source_estate/elecstate_lcao.h +++ b/source/source_estate/elecstate_lcao.h @@ -27,27 +27,16 @@ class ElecStateLCAO : public ElecState virtual ~ElecStateLCAO() { - if (this->DM != nullptr) - { - delete this->DM; - } } // update charge density for next scf step // void getNewRho() override; - // initial density matrix - void init_DM(const K_Vectors* kv, const Parallel_Orbitals* paraV, const int nspin); - DensityMatrix* get_DM() const - { - return const_cast*>(this->DM); - } static int out_wfc_lcao; static bool need_psi_grid; double get_spin_constrain_energy() override; -#ifdef __PEXSI // use for pexsi /** @@ -56,10 +45,9 @@ class ElecStateLCAO : public ElecState * @param pexsi_EDM: pointers of energy-weighed density matrix (EDMK) calculated by pexsi, needed by MD, will be * stored in DensityMatrix::pexsi_EDM */ - void dm2rho(std::vector pexsi_DM, std::vector pexsi_EDM); -#endif - - DensityMatrix* DM = nullptr; + void dm2Rho(std::vector pexsi_DM, + std::vector pexsi_EDM, + DensityMatrix* dm); }; From ee92dac7548ad07a03488db2926a707757f754bc Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:49:55 +0800 Subject: [PATCH 59/92] Update Dockerfile.intel --- Dockerfile.intel | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index d56ec53c5c..1a66c18b4f 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -181,10 +181,8 @@ ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/deve RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH} && \ - cd /tmp && wget https://github.com/deepmodeling/abacus-develop/archive/refs/tags/v3.9.0.17.zip -O abacus-develop-3.9.0.17.zip && \ - unzip abacus-develop-3.9.0.17.zip && \ - cd abacus-develop-3.9.0.17 && \ - sed -i '3i\#include "source_estate/elecstate_lcao.h"' source/source_lcao/edm.cpp && \ + cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ + cd abacus-develop && \ cmake -B build \ -DMKL_SYCL=OFF \ -DMKL_SYCL_LINK=OFF \ From 2cf0a8dd3d9e31a1550e0c813801d4394f81e463 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Fri, 7 Nov 2025 09:05:43 +0800 Subject: [PATCH 60/92] Update elecstate_lcao.cpp --- source/source_estate/elecstate_lcao.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/source_estate/elecstate_lcao.cpp b/source/source_estate/elecstate_lcao.cpp index a9578b228a..7bd32542ae 100644 --- a/source/source_estate/elecstate_lcao.cpp +++ b/source/source_estate/elecstate_lcao.cpp @@ -31,11 +31,11 @@ double ElecStateLCAO>::get_spin_constrain_energy() } template <> -void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, +void ElecStateLCAO::dm2rho(std::vector pexsi_DM, std::vector pexsi_EDM, DensityMatrix* dm) { - ModuleBase::timer::tick("ElecStateLCAO", "dm2Rho"); + ModuleBase::timer::tick("ElecStateLCAO", "dm2rho"); int nspin = PARAM.inp.nspin; if (PARAM.inp.nspin == 4) @@ -72,12 +72,12 @@ void ElecStateLCAO::dm2Rho(std::vector pexsi_DM, this->charge->renormalize_rho(); - ModuleBase::timer::tick("ElecStateLCAO", "dm2Rho"); + ModuleBase::timer::tick("ElecStateLCAO", "dm2rho"); return; } template <> -void ElecStateLCAO>::dm2Rho(std::vector*> pexsi_DM, +void ElecStateLCAO>::dm2rho(std::vector*> pexsi_DM, std::vector*> pexsi_EDM, DensityMatrix, double>* dm) { From 899bc92455b685f0c0f15dac0199e01636231931 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Fri, 7 Nov 2025 09:07:28 +0800 Subject: [PATCH 61/92] Update elecstate_lcao.h From c13df5ac4d1b6b220ba18e0cf0acc855133f775a Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Fri, 7 Nov 2025 14:07:00 +0800 Subject: [PATCH 62/92] Update Dockerfile.intel --- Dockerfile.intel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.intel b/Dockerfile.intel index 725dc40785..018bed6666 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -182,6 +182,8 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ + export CMAKE_PREFIX_PATH=${GKLIB_ROOT}:${METIS32_ROOT}:${PARMETIS32_ROOT}:${SUPERLU32_DIST_ROOT}:${PEXSI32_ROOT}:${CMAKE_PREFIX_PATH} && \ + cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ From d095f2f475cf6ac905407bf93b727474312de93d Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Fri, 7 Nov 2025 14:29:43 +0800 Subject: [PATCH 63/92] Update Dockerfile.intel --- Dockerfile.intel | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 018bed6666..1824cea2a3 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -184,7 +184,6 @@ RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_RO export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ export CMAKE_PREFIX_PATH=${GKLIB_ROOT}:${METIS32_ROOT}:${PARMETIS32_ROOT}:${SUPERLU32_DIST_ROOT}:${PEXSI32_ROOT}:${CMAKE_PREFIX_PATH} && \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ - cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ -DENABLE_MLALGO=ON \ From 4983b0da7f31848f9a52edad3b86b360ff387863 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:16:00 +0800 Subject: [PATCH 64/92] Update Dockerfile.intel --- Dockerfile.intel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.intel b/Dockerfile.intel index 1824cea2a3..a85a50f2a3 100644 --- a/Dockerfile.intel +++ b/Dockerfile.intel @@ -181,8 +181,9 @@ ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH} # Clone and build abacus (optional during image build; keep for CI image) ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \ + export PKG_CONFIG_PATH=${GKLIB_ROOT}/lib/pkgconfig:${METIS32_ROOT}/lib/pkgconfig:${PARMETIS32_ROOT}/lib/pkgconfig:${SUPERLU32_DIST_ROOT}/lib/pkgconfig:${PEXSI32_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH} && \ export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \ - export CMAKE_PREFIX_PATH=${GKLIB_ROOT}:${METIS32_ROOT}:${PARMETIS32_ROOT}:${SUPERLU32_DIST_ROOT}:${PEXSI32_ROOT}:${CMAKE_PREFIX_PATH} && \ + export CMAKE_PREFIX_PATH=${PEXSI32_ROOT}:${SUPERLU_DIST32_ROOT}:${PARMETIS32_ROOT}:${METIS32_ROOT}:${GKLIB_ROOT}:${CMAKE_PREFIX_PATH} && \ cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ cd abacus-develop && \ cmake -B build \ From fbfa87e588e6af4aeda679b18fccd2d1f0ca8f83 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 20:49:21 +0800 Subject: [PATCH 65/92] Update devcontainer.yml --- .github/workflows/devcontainer.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index d3ff39b69f..762b34e16e 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -1,9 +1,9 @@ name: Container on: - pull_request: # 当有 PR 指向 develop 分支时触发 - branches: - - develop + #pull_request: # 当有 PR 指向 develop 分支时触发 + #branches: + # - develop push: branches: - develop From 924e48e2e49ccd2154e2cfe42e0a6478c45f45f4 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 20:51:55 +0800 Subject: [PATCH 66/92] Update coverage.yml --- .github/workflows/coverage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index c664bf796c..eaeb96cabd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,6 +1,9 @@ name: Coverage Analysis on: + pull_request: # 当有 PR 指向 develop 分支时触发 + branches: + - develop workflow_dispatch: push: tags: From cafd6fa40b4902322e110263d21ece82a17c70d1 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 20:56:34 +0800 Subject: [PATCH 67/92] Update CMakeLists.txt --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac95e45fd..ef32d94268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,7 +156,8 @@ if(ENABLE_COVERAGE) include(FetchContent) FetchContent_Declare( cmakecodecov - URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip + # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip + URL https://github.com/RWTH-HPC/CMake-codecov.git ) FetchContent_Populate(cmakecodecov) list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) From 31d8de816ca3e51cbd778b4a54d170a86f636fec Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:08:56 +0800 Subject: [PATCH 68/92] Update coverage.yml --- .github/workflows/coverage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index eaeb96cabd..a2568a7d40 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,6 +19,8 @@ jobs: - name: Install Requirements for Coverage Testing run: | apt update && apt install -y lcov gpg curl jq ca-certificates + mkdir externals + git submodule add git://github.com/RWTH-HPC/CMake-codecov.git externals/CMake-codecov - name: Building run: | cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON From b1f0f68243015c79fe652539c07710d271335502 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:13:15 +0800 Subject: [PATCH 69/92] Update CMakeLists.txt --- CMakeLists.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef32d94268..511a3c3943 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,17 +151,18 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if(ENABLE_COVERAGE) - find_package(codecov) - if(NOT codecov_FOUND) - include(FetchContent) - FetchContent_Declare( - cmakecodecov + ##find_package(codecov) + ## if(NOT codecov_FOUND) + ## include(FetchContent) + ## FetchContent_Declare( + # cmakecodecov # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip - URL https://github.com/RWTH-HPC/CMake-codecov.git - ) - FetchContent_Populate(cmakecodecov) - list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) - find_package(codecov REQUIRED) + # URL https://github.com/RWTH-HPC/CMake-codecov.git + # ) + ## FetchContent_Populate(cmakecodecov) + ## list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) + ## find_package(codecov REQUIRED) + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/CMake-codecov/cmake" ${CMAKE_MODULE_PATH}) endif() endif() From a49b42f9cae7005c7e782a77daeb7b71d8ce5352 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:24:53 +0800 Subject: [PATCH 70/92] Update CMakeLists.txt --- CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 511a3c3943..3c46d6c86e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,18 +151,18 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if(ENABLE_COVERAGE) - ##find_package(codecov) - ## if(NOT codecov_FOUND) - ## include(FetchContent) - ## FetchContent_Declare( - # cmakecodecov + find_package(codecov) + if(NOT codecov_FOUND) + include(FetchContent) + FetchContent_Declare( + cmakecodecov # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip - # URL https://github.com/RWTH-HPC/CMake-codecov.git - # ) - ## FetchContent_Populate(cmakecodecov) - ## list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) - ## find_package(codecov REQUIRED) - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/CMake-codecov/cmake" ${CMAKE_MODULE_PATH}) + URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip + ) + FetchContent_Populate(cmakecodecov) + list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) + find_package(codecov REQUIRED) + ##set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/CMake-codecov/cmake" ${CMAKE_MODULE_PATH}) endif() endif() From e77fafb7a42e20961814a822e5369c79b04d3311 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:51:40 +0800 Subject: [PATCH 71/92] Update CMakeLists.txt --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c46d6c86e..41bef6a632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,7 +157,8 @@ if(ENABLE_COVERAGE) FetchContent_Declare( cmakecodecov # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip - URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip + # URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip + URL https://gitee.com/mirrors_rwth-elp/cmake-codecov/archive/refs/heads/master.zip ) FetchContent_Populate(cmakecodecov) list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) From c910946d41e0f0f0639c0251df693a25584dad86 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Sun, 9 Nov 2025 21:57:38 +0800 Subject: [PATCH 72/92] Update coverage.yml --- .github/workflows/coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a2568a7d40..af0ea88602 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,8 +19,8 @@ jobs: - name: Install Requirements for Coverage Testing run: | apt update && apt install -y lcov gpg curl jq ca-certificates - mkdir externals - git submodule add git://github.com/RWTH-HPC/CMake-codecov.git externals/CMake-codecov + # mkdir externals + # git submodule add git://github.com/RWTH-HPC/CMake-codecov.git externals/CMake-codecov - name: Building run: | cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON From 8832d99402d8ee9261c26218c6656fa34d17b5df Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 09:57:00 +0800 Subject: [PATCH 73/92] Update CMakeLists.txt --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41bef6a632..9b83fdbed6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,8 +157,8 @@ if(ENABLE_COVERAGE) FetchContent_Declare( cmakecodecov # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip - # URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip - URL https://gitee.com/mirrors_rwth-elp/cmake-codecov/archive/refs/heads/master.zip + URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip + # URL https://gitee.com/mirrors_rwth-elp/cmake-codecov/archive/refs/heads/master.zip ) FetchContent_Populate(cmakecodecov) list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) From 25b176919e675bbbc089aa06b791c0bab3c03439 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 10:27:56 +0800 Subject: [PATCH 74/92] Update CMakeLists.txt --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b83fdbed6..82a15f01d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,9 +156,13 @@ if(ENABLE_COVERAGE) include(FetchContent) FetchContent_Declare( cmakecodecov + GIT_REPOSITORY https://github.com/RWTH-HPC/CMake-codecov.git + GIT_TAG master # URL https://github.com/baixiaokuang/CMake-codecov/archive/refs/heads/master.zip - URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip + # URL https://github.com/RWTH-HPC/CMake-codecov/archive/refs/heads/master.zip # URL https://gitee.com/mirrors_rwth-elp/cmake-codecov/archive/refs/heads/master.zip + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE ) FetchContent_Populate(cmakecodecov) list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) From 273839c17e108c2f8dfe0e90ebfa08b7b01a1575 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 10:41:52 +0800 Subject: [PATCH 75/92] Update CMakeLists.txt --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82a15f01d3..8eaf9c8c9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,7 +151,7 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if(ENABLE_COVERAGE) - find_package(codecov) + find_package(codecov QUIET) if(NOT codecov_FOUND) include(FetchContent) FetchContent_Declare( @@ -166,6 +166,7 @@ if(ENABLE_COVERAGE) ) FetchContent_Populate(cmakecodecov) list(APPEND CMAKE_MODULE_PATH ${cmakecodecov_SOURCE_DIR}/cmake) + set(CMAKE_MODULE_PATH "${cmakecodecov_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) find_package(codecov REQUIRED) ##set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/CMake-codecov/cmake" ${CMAKE_MODULE_PATH}) endif() From 8d12b64c126f2985bd730e4ce190cb68507a787f Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 10:52:32 +0800 Subject: [PATCH 76/92] Create Findcodecov.cmake --- cmake/Findcodecov.cmake | 275 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 cmake/Findcodecov.cmake diff --git a/cmake/Findcodecov.cmake b/cmake/Findcodecov.cmake new file mode 100644 index 0000000000..004b086e70 --- /dev/null +++ b/cmake/Findcodecov.cmake @@ -0,0 +1,275 @@ +# This file is part of CMake-codecov. +# +# SPDX-FileCopyrightText: RWTH Aachen University, Federal Republic of Germany +# SPDX-FileContributor: Alexander Haase, alexander.haase@rwth-aachen.de +# +# SPDX-License-Identifier: BSD-3-Clause + + +# Add an option to choose, if coverage should be enabled or not. If enabled +# marked targets will be build with coverage support and appropriate targets +# will be added. If disabled coverage will be ignored for *ALL* targets. +option(ENABLE_COVERAGE "Enable coverage build." OFF) + +set(COVERAGE_FLAG_CANDIDATES + # gcc and clang + "-O0 -g -fprofile-arcs -ftest-coverage" + + # gcc and clang fallback + "-O0 -g --coverage" +) + + +# Add coverage support for target ${TNAME} and register target for coverage +# evaluation. If coverage is disabled or not supported, this function will +# simply do nothing. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (add_coverage TNAME) + # only add coverage for target, if coverage is support and enabled. + if (ENABLE_COVERAGE) + foreach (TNAME ${ARGV}) + add_coverage_target(${TNAME}) + endforeach () + endif () +endfunction (add_coverage) + + +# Add global target to gather coverage information after all targets have been +# added. Other evaluation functions could be added here, after checks for the +# specific module have been passed. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (coverage_evaluate) + # add lcov evaluation + if (LCOV_FOUND) + lcov_capture_initial() + lcov_capture() + endif (LCOV_FOUND) +endfunction () + + +# Exit this module, if coverage is disabled. add_coverage is defined before this +# return, so this module can be exited now safely without breaking any build- +# scripts. +if (NOT ENABLE_COVERAGE) + return() +endif () + + + + +# Find the required flags foreach language. +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY}) + +get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach (LANG ${ENABLED_LANGUAGES}) + if (NOT ${LANG} MATCHES "^(C|CXX|Fortran)$") + message(STATUS "Skipping coverage for unsupported language: ${LANG}") + continue() + endif () + + # Coverage flags are not dependent on language, but the used compiler. So + # instead of searching flags foreach language, search flags foreach compiler + # used. + set(COMPILER ${CMAKE_${LANG}_COMPILER_ID}) + if (NOT COVERAGE_${COMPILER}_FLAGS) + foreach (FLAG ${COVERAGE_FLAG_CANDIDATES}) + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try ${COMPILER} code coverage flag = [${FLAG}]") + endif() + + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(COVERAGE_FLAG_DETECTED CACHE) + + if (${LANG} STREQUAL "C") + include(CheckCCompilerFlag) + check_c_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED) + + elseif (${LANG} STREQUAL "CXX") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED) + + elseif (${LANG} STREQUAL "Fortran") + # CheckFortranCompilerFlag was introduced in CMake 3.x. To be + # compatible with older Cmake versions, we will check if this + # module is present before we use it. Otherwise we will define + # Fortran coverage support as not available. + include(CheckFortranCompilerFlag OPTIONAL + RESULT_VARIABLE INCLUDED) + if (INCLUDED) + check_fortran_compiler_flag("${FLAG}" + COVERAGE_FLAG_DETECTED) + elseif (NOT CMAKE_REQUIRED_QUIET) + message("-- Performing Test COVERAGE_FLAG_DETECTED") + message("-- Performing Test COVERAGE_FLAG_DETECTED - Failed" + " (Check not supported)") + endif () + endif() + + unset(CMAKE_REQUIRED_FLAGS) + + if (COVERAGE_FLAG_DETECTED) + set(COVERAGE_${COMPILER}_FLAGS "${FLAG}" + CACHE STRING "${COMPILER} flags for code coverage.") + mark_as_advanced(COVERAGE_${COMPILER}_FLAGS) + break() + elseif (NOT CMAKE_REQUIRED_QUIET) + message(WARNING "Code coverage is not available for ${COMPILER}" + " compiler. Targets using this compiler will be " + "compiled without it.") + endif () + endforeach () + endif () +endforeach () + +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + + + + +# Helper function to get the language of a source file. +function (codecov_lang_of_source FILE RETURN_VAR) + # Usually, only the last extension of the file should be checked, to avoid + # template files (i.e. *.t.cpp) are checked with the full file extension. + # However, this feature requires CMake 3.14 or later. + set(EXT_COMP "LAST_EXT") + if(${CMAKE_VERSION} VERSION_LESS "3.14.0") + set(EXT_COMP "EXT") + endif() + + get_filename_component(FILE_EXT "${FILE}" ${EXT_COMP}) + string(TOLOWER "${FILE_EXT}" FILE_EXT) + string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT) + + get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + foreach (LANG ${ENABLED_LANGUAGES}) + list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP) + if (NOT ${TEMP} EQUAL -1) + set(${RETURN_VAR} "${LANG}" PARENT_SCOPE) + return() + endif () + endforeach() + + set(${RETURN_VAR} "" PARENT_SCOPE) +endfunction () + + +# Helper function to get the relative path of the source file destination path. +# This path is needed by FindGcov and FindLcov cmake files to locate the +# captured data. +function (codecov_path_of_source FILE RETURN_VAR) + string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _source ${FILE}) + + # If expression was found, SOURCEFILE is a generator-expression for an + # object library. Currently we found no way to call this function automatic + # for the referenced target, so it must be called in the directoryso of the + # object library definition. + if (NOT "${_source}" STREQUAL "") + set(${RETURN_VAR} "" PARENT_SCOPE) + return() + endif () + + + string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" FILE "${FILE}") + if(IS_ABSOLUTE ${FILE}) + file(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE}) + endif() + + # get the right path for file + string(REPLACE ".." "__" PATH "${FILE}") + + set(${RETURN_VAR} "${PATH}" PARENT_SCOPE) +endfunction() + + + + +# Add coverage support for target ${TNAME} and register target for coverage +# evaluation. +function(add_coverage_target TNAME) + # Check if all sources for target use the same compiler. If a target uses + # e.g. C and Fortran mixed and uses different compilers (e.g. clang and + # gfortran) this can trigger huge problems, because different compilers may + # use different implementations for code coverage. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(TARGET_COMPILER "") + set(ADDITIONAL_FILES "") + foreach (FILE ${TSOURCES}) + # If expression was found, FILE is a generator-expression for an object + # library. Object libraries will be ignored. + string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE}) + if ("${_file}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (LANG) + list(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID}) + + list(APPEND ADDITIONAL_FILES "${FILE}.gcno") + list(APPEND ADDITIONAL_FILES "${FILE}.gcda") + endif () + endif () + endforeach () + + list(REMOVE_DUPLICATES TARGET_COMPILER) + list(LENGTH TARGET_COMPILER NUM_COMPILERS) + + if (NUM_COMPILERS GREATER 1) + message(WARNING "Can't use code coverage for target ${TNAME}, because " + "it will be compiled by incompatible compilers. Target will be " + "compiled without code coverage.") + return() + + elseif (NUM_COMPILERS EQUAL 0) + message(WARNING "Can't use code coverage for target ${TNAME}, because " + "it uses an unknown compiler. Target will be compiled without " + "code coverage.") + return() + + elseif (NOT DEFINED "COVERAGE_${TARGET_COMPILER}_FLAGS") + # A warning has been printed before, so just return if flags for this + # compiler aren't available. + return() + endif() + + + # enable coverage for target + set_property(TARGET ${TNAME} APPEND_STRING + PROPERTY COMPILE_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}") + set_property(TARGET ${TNAME} APPEND_STRING + PROPERTY LINK_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}") + + + # Add gcov files generated by compiler to clean target. + set(CLEAN_FILES "") + foreach (FILE ${ADDITIONAL_FILES}) + codecov_path_of_source(${FILE} FILE) + list(APPEND CLEAN_FILES "CMakeFiles/${TNAME}.dir/${FILE}") + endforeach() + + if(${CMAKE_VERSION} VERSION_LESS "3.15.0") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "${CLEAN_FILES}") + else() + set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES + "${CLEAN_FILES}") + endif() + + + add_gcov_target(${TNAME}) + add_lcov_target(${TNAME}) +endfunction(add_coverage_target) + + + + +# Include modules for parsing the collected data and output it in a readable +# format (like gcov and lcov). +find_package(Gcov) +find_package(Lcov) From 27f4dfc2fc46a3035740bc477e1db5abb20943af Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:13:17 +0800 Subject: [PATCH 77/92] Update CMakeLists.txt --- tests/integrate/CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/integrate/CMakeLists.txt b/tests/integrate/CMakeLists.txt index 8da79197aa..d4cf1b5160 100644 --- a/tests/integrate/CMakeLists.txt +++ b/tests/integrate/CMakeLists.txt @@ -1,5 +1,12 @@ find_program(BASH bash) find_package(Python3 REQUIRED) + +add_executable(sum_cube.exe ${ABACUS_TEST_DIR}/integrate/tools/sum_cube.cpp) +install(TARGETS sum_cube.exe DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/) +if(ENABLE_COVERAGE) + add_coverage(sum_cube.exe) +endif() + if(ENABLE_ASAN) add_test( NAME integrated_test_with_asan @@ -13,10 +20,4 @@ else() COMMAND ${BASH} Autotest.sh -a ${ABACUS_BIN_PATH} -n 4 WORKING_DIRECTORY ${ABACUS_TEST_DIR}/integrate ) - add_executable(sum_cube.exe ${ABACUS_TEST_DIR}/integrate/tools/sum_cube.cpp) - install(TARGETS sum_cube.exe DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/) - - if(ENABLE_COVERAGE) - add_coverage(sum_cube.exe) - endif() endif() From 05842bb8082eea0239ef541967af67d7a08f0247 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 12:16:02 +0800 Subject: [PATCH 78/92] Update CMakeLists.txt --- tests/integrate/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integrate/CMakeLists.txt b/tests/integrate/CMakeLists.txt index d4cf1b5160..106c179f90 100644 --- a/tests/integrate/CMakeLists.txt +++ b/tests/integrate/CMakeLists.txt @@ -1,10 +1,12 @@ find_program(BASH bash) find_package(Python3 REQUIRED) -add_executable(sum_cube.exe ${ABACUS_TEST_DIR}/integrate/tools/sum_cube.cpp) -install(TARGETS sum_cube.exe DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/) +add_executable(sum_cube ${ABACUS_TEST_DIR}/integrate/tools/sum_cube.cpp) +install(TARGETS sum_cube DESTINATION ${ABACUS_TEST_DIR}/integrate/tools/) +message(STATUS "Target sum_cube has been defined in ${CMAKE_CURRENT_SOURCE_DIR}") # 添加此行 + if(ENABLE_COVERAGE) - add_coverage(sum_cube.exe) + add_coverage(sum_cube) endif() if(ENABLE_ASAN) From bd30a0ad514f1ba72d1f25e264549f66200e33dd Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:03:41 +0800 Subject: [PATCH 79/92] Update CMakeLists.txt --- source/source_cell/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_cell/CMakeLists.txt b/source/source_cell/CMakeLists.txt index f9d4f0c535..ad3aefba42 100644 --- a/source/source_cell/CMakeLists.txt +++ b/source/source_cell/CMakeLists.txt @@ -3,7 +3,7 @@ add_subdirectory(module_neighbor) add_library( cell - OBJECT + STATIC atom_pseudo.cpp atom_spec.cpp pseudo.cpp From feab2b003afbf1e923be600337c810c17587552c Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:32:44 +0800 Subject: [PATCH 80/92] Update CMakeLists.txt --- source/source_lcao/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_lcao/CMakeLists.txt b/source/source_lcao/CMakeLists.txt index 5199625c41..5b7ad5e04a 100644 --- a/source/source_lcao/CMakeLists.txt +++ b/source/source_lcao/CMakeLists.txt @@ -54,7 +54,7 @@ if(ENABLE_LCAO) add_library( hamilt_lcao - OBJECT + STATIC ${objects} ) From 7fe71421e42b1f76ca104e0003fa7c280bcb9177 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:05:56 +0800 Subject: [PATCH 81/92] Update CMakeLists.txt --- source/source_lcao/module_hcontainer/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/source_lcao/module_hcontainer/CMakeLists.txt b/source/source_lcao/module_hcontainer/CMakeLists.txt index 65db746a84..e0a5efe23b 100644 --- a/source/source_lcao/module_hcontainer/CMakeLists.txt +++ b/source/source_lcao/module_hcontainer/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND objects add_library( hcontainer - OBJECT + STATIC ${objects} ) @@ -26,4 +26,4 @@ IF (BUILD_TESTING) endif() endif() -endif() \ No newline at end of file +endif() From 52d24d792e7b675a8222bed46a7b0d4312bb68f1 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:11:26 +0800 Subject: [PATCH 82/92] Update CMakeLists.txt --- source/source_lcao/module_rt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_lcao/module_rt/CMakeLists.txt b/source/source_lcao/module_rt/CMakeLists.txt index 58bc834a5f..4e794487db 100644 --- a/source/source_lcao/module_rt/CMakeLists.txt +++ b/source/source_lcao/module_rt/CMakeLists.txt @@ -19,7 +19,7 @@ if(ENABLE_LCAO) add_library( tddft - OBJECT + STATIC ${objects} ) From fd27fb3d3d037441a788477aee03d7ea2329680a Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:12:30 +0800 Subject: [PATCH 83/92] Update CMakeLists.txt --- source/source_lcao/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_lcao/CMakeLists.txt b/source/source_lcao/CMakeLists.txt index 5b7ad5e04a..5199625c41 100644 --- a/source/source_lcao/CMakeLists.txt +++ b/source/source_lcao/CMakeLists.txt @@ -54,7 +54,7 @@ if(ENABLE_LCAO) add_library( hamilt_lcao - STATIC + OBJECT ${objects} ) From 50284f68534be00f20a5aad492c97dbffb10ed19 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:27:49 +0800 Subject: [PATCH 84/92] Update CMakeLists.txt --- CMakeLists.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eaf9c8c9b..f2cddc863c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -814,5 +814,22 @@ install(PROGRAMS ${ABACUS_BIN_PATH} ) if(ENABLE_COVERAGE) - coverage_evaluate() + # coverage_evaluate() +# ... 在所有 add_subdirectory() 之后 ... + +if(ENABLE_COVERAGE) + ## coverage_evaluate() + add_custom_target(coverage + COMMAND ${CMAKE_COMMAND} -E echo "Capturing coverage data..." + COMMAND lcov --capture --directory ${CMAKE_BINARY_DIR} --output-file ${CMAKE_BINARY_DIR}/coverage.info + COMMAND ${CMAKE_COMMAND} -E echo "Filtering coverage data..." + + COMMAND lcov --remove ${CMAKE_BINARY_DIR}/coverage.info '/usr/*' '*/test/*' '*/gtest/*' '*/gmock/*' --output-file ${CMAKE_BINARY_DIR}/coverage.info + COMMAND ${CMAKE_COMMAND} -E echo "Generating HTML report..." + + COMMAND genhtml -o ${CMAKE_BINARY_DIR}/coverage_html ${CMAKE_BINARY_DIR}/coverage.info + COMMAND ${CMAKE_COMMAND} -E echo "Coverage report generated at: ${CMAKE_BINARY_DIR}/coverage_html/index.html" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating code coverage report with lcov" + ) endif() From ab10775cdadfe91af2d1f5db06bc90189e846876 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:31:39 +0800 Subject: [PATCH 85/92] Update coverage.yml --- .github/workflows/coverage.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index af0ea88602..6dbde0025c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,6 +23,8 @@ jobs: # git submodule add git://github.com/RWTH-HPC/CMake-codecov.git externals/CMake-codecov - name: Building run: | + rm -rf build/ + rm -f CMakeCache.txt cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON cmake --build build -j`nproc` cmake --install build @@ -31,6 +33,9 @@ jobs: OMP_NUM_THREADS: 1 run: | cmake --build build --target test ARGS="-V --timeout 21600" || exit 0 + - name: Generate Coverage Report + run: | + cmake --build build --target coverage - name: Upload Coverage to Codecov uses: codecov/codecov-action@v5 if: ${{ ! cancelled() }} From df1329a1cca945ab3b42d4135025a18ecad354c1 Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 17:02:27 +0800 Subject: [PATCH 86/92] Update CMakeLists.txt --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2cddc863c..235d44f7ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -813,10 +813,6 @@ install(PROGRAMS ${ABACUS_BIN_PATH} # DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(ENABLE_COVERAGE) - # coverage_evaluate() -# ... 在所有 add_subdirectory() 之后 ... - if(ENABLE_COVERAGE) ## coverage_evaluate() add_custom_target(coverage From d7257548c7bdf6186733d5ce4e2a7ce7b8c126fe Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 20:26:12 +0800 Subject: [PATCH 87/92] Create FindLcov.cmake --- cmake/FindLcov.cmake | 365 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 cmake/FindLcov.cmake diff --git a/cmake/FindLcov.cmake b/cmake/FindLcov.cmake new file mode 100644 index 0000000000..1d48b55149 --- /dev/null +++ b/cmake/FindLcov.cmake @@ -0,0 +1,365 @@ +# This file is part of CMake-codecov. +# +# SPDX-FileCopyrightText: RWTH Aachen University, Federal Republic of Germany +# SPDX-FileContributor: Alexander Haase, alexander.haase@rwth-aachen.de +# +# SPDX-License-Identifier: BSD-3-Clause + + +# configuration +set(LCOV_DATA_PATH "${CMAKE_BINARY_DIR}/lcov/data") +set(LCOV_DATA_PATH_INIT "${LCOV_DATA_PATH}/init") +set(LCOV_DATA_PATH_CAPTURE "${LCOV_DATA_PATH}/capture") +set(LCOV_HTML_PATH "${CMAKE_BINARY_DIR}/lcov/html") + +set(GENINFO_EXTRA_FLAGS "" CACHE STRING "Additional flags to pass to geninfo.") +string(REPLACE " " ";" GENINFO_EXTRA_FLAGS "${GENINFO_EXTRA_FLAGS}") +set(LCOV_EXTRA_FLAGS "" CACHE STRING "Additional flags to pass to lcov.") +string(REPLACE " " ";" LCOV_EXTRA_FLAGS "${LCOV_EXTRA_FLAGS}") + + +# Search for Gcov which is used by Lcov. +find_package(Gcov) + + + + +# This function will add lcov evaluation for target . Only sources of +# this target will be evaluated and no dependencies will be added. It will call +# geninfo on any source file of once and store the info file in the same +# directory. +# +# Note: This function is only a wrapper to define this function always, even if +# coverage is not supported by the compiler or disabled. This function must +# be defined here, because the module will be exited, if there is no coverage +# support by the compiler or it is disabled by the user. +function (add_lcov_target TNAME) + if (LCOV_FOUND) + # capture initial coverage data + lcov_capture_initial_tgt(${TNAME}) + + # capture coverage data after execution + lcov_capture_tgt(${TNAME}) + endif () +endfunction (add_lcov_target) + + + + +# include required Modules +include(FindPackageHandleStandardArgs) + +# Search for required lcov binaries. +find_program(LCOV_BIN lcov) +find_program(GENINFO_BIN geninfo) +find_program(GENHTML_BIN genhtml) +find_package_handle_standard_args(Lcov + REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN +) + +# enable genhtml C++ demangeling, if c++filt is found. +set(GENHTML_CPPFILT_FLAG "") +find_program(CPPFILT_BIN c++filt) +if (NOT CPPFILT_BIN STREQUAL "") + set(GENHTML_CPPFILT_FLAG "--demangle-cpp") +endif (NOT CPPFILT_BIN STREQUAL "") + +# enable no-external flag for lcov, if available. +if (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG) + set(FLAG "") + execute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP) + string(REGEX MATCH "external" GENINFO_RES "${GENINFO_HELP}") + if (GENINFO_RES) + set(FLAG "--no-external") + endif () + + set(GENINFO_EXTERN_FLAG "${FLAG}" + CACHE STRING "Geninfo flag to exclude system sources.") +endif () + +# If Lcov was not found, exit module now. +if (NOT LCOV_FOUND) + return() +endif (NOT LCOV_FOUND) + + + + +# Create directories to be used. +file(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT}) +file(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE}) + +set(LCOV_REMOVE_PATTERNS "") + +# This function will merge lcov files to a single target file. Additional lcov +# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function. +function (lcov_merge_files OUTFILE ...) + # Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files. + list(REMOVE_AT ARGV 0) + + # Generate merged file. + string(REPLACE "${CMAKE_BINARY_DIR}/" "" FILE_REL "${OUTFILE}") + add_custom_command(OUTPUT "${OUTFILE}.raw" + COMMAND cat ${ARGV} > ${OUTFILE}.raw + DEPENDS ${ARGV} + COMMENT "Generating ${FILE_REL}" + ) + + add_custom_command(OUTPUT "${OUTFILE}" + COMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE} + --base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS} + COMMAND ${LCOV_BIN} --quiet -r ${OUTFILE} ${LCOV_REMOVE_PATTERNS} + --output-file ${OUTFILE} ${LCOV_EXTRA_FLAGS} + DEPENDS ${OUTFILE}.raw + COMMENT "Post-processing ${FILE_REL}" + ) +endfunction () + + + + +# Add a new global target to generate initial coverage reports for all targets. +# This target will be used to generate the global initial info file, which is +# used to gather even empty report data. +if (NOT TARGET lcov-capture-init) + add_custom_target(lcov-capture-init) + set(LCOV_CAPTURE_INIT_FILES "" CACHE INTERNAL "") +endif (NOT TARGET lcov-capture-init) + + +# This function will add initial capture of coverage data for target , +# which is needed to get also data for objects, which were not loaded at +# execution time. It will call geninfo for every source file of once and +# store the info file in the same directory. +function (lcov_capture_initial_tgt TNAME) + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + + get_target_property(TBIN_DIR ${TNAME} BINARY_DIR) + set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir) + + set(GENINFO_FILES "") + foreach(FILE ${SOURCES}) + # generate empty coverage files + set(OUTFILE "${TDIR}/${FILE}.info.init") + list(APPEND GENINFO_FILES ${OUTFILE}) + + add_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN} + --quiet --base-directory ${PROJECT_SOURCE_DIR} --initial + --gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE} + ${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno + ${GENINFO_EXTRA_FLAGS} + DEPENDS ${TNAME} + COMMENT "Capturing initial coverage data for ${FILE}" + ) + endforeach() + + # Concatenate all files generated by geninfo to a single file per target. + set(OUTFILE "${LCOV_DATA_PATH_INIT}/${TNAME}.info") + list(APPEND LCOV_EXTRA_FLAGS "--initial") + lcov_merge_files("${OUTFILE}" ${GENINFO_FILES}) + add_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE}) + + # add geninfo file generation to global lcov-geninfo target + add_dependencies(lcov-capture-init ${TNAME}-capture-init) + set(LCOV_CAPTURE_INIT_FILES "${LCOV_CAPTURE_INIT_FILES}" + "${OUTFILE}" CACHE INTERNAL "" + ) +endfunction (lcov_capture_initial_tgt) + + +# This function will generate the global info file for all targets. It has to be +# called after all other CMake functions in the root CMakeLists.txt file, to get +# a full list of all targets that generate coverage data. +function (lcov_capture_initial) + # Skip this function (and do not create the following targets), if there are + # no input files. + if ("${LCOV_CAPTURE_INIT_FILES}" STREQUAL "") + return() + endif () + + # Add a new target to merge the files of all targets. + set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info") + lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES}) + add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE} + lcov-capture-init + ) +endfunction (lcov_capture_initial) + + + + +# Add a new global target to generate coverage reports for all targets. This +# target will be used to generate the global info file. +if (NOT TARGET lcov-capture) + add_custom_target(lcov-capture) + set(LCOV_CAPTURE_FILES "" CACHE INTERNAL "") +endif (NOT TARGET lcov-capture) + + +# This function will add capture of coverage data for target , which is +# needed to get also data for objects, which were not loaded at execution time. +# It will call geninfo for every source file of once and store the info +# file in the same directory. +function (lcov_capture_tgt TNAME) + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + get_target_property(TBIN_DIR ${TNAME} BINARY_DIR) + set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir) + + set(GENINFO_FILES "") + foreach(FILE ${SOURCES}) + # Generate coverage files. If no .gcda file was generated during + # execution, the empty coverage file will be used instead. + set(OUTFILE "${TDIR}/${FILE}.info") + list(APPEND GENINFO_FILES ${OUTFILE}) + + # Create an empty .gcda file, so the target capture file can have a dependency on it. + # The capture file will only use this .gcda if it has a non-zero size (test -s). + add_custom_command(OUTPUT "${TDIR}/${FILE}.gcda" + COMMAND "${CMAKE_COMMAND}" -E touch "${TDIR}/${FILE}.gcda" + ) + + add_custom_command(OUTPUT ${OUTFILE} + COMMAND test -s "${TDIR}/${FILE}.gcda" + && ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory + ${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN} + --output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG} + ${TDIR}/${FILE}.gcda ${GENINFO_EXTRA_FLAGS} + || cp ${OUTFILE}.init ${OUTFILE} + DEPENDS ${TNAME} ${TNAME}-capture-init "${TDIR}/${FILE}.gcda" + COMMENT "Capturing coverage data for ${FILE}" + ) + endforeach() + + # Concatenate all files generated by geninfo to a single file per target. + set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info") + lcov_merge_files("${OUTFILE}" ${GENINFO_FILES}) + add_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE}) + + # add geninfo file generation to global lcov-capture target + add_dependencies(lcov-capture ${TNAME}-geninfo) + set(LCOV_CAPTURE_FILES "${LCOV_CAPTURE_FILES}" "${OUTFILE}" CACHE INTERNAL + "" + ) + + # Add target for generating html output for this target only. + file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME}) + add_custom_target(${TNAME}-genhtml + COMMAND ${GENHTML_BIN} --quiet --sort ${GENHTML_CPPFILT_FLAG} + --prefix ${PROJECT_SOURCE_DIR} + --baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info + --output-directory ${LCOV_HTML_PATH}/${TNAME} + --title "${CMAKE_PROJECT_NAME} - target ${TNAME}" + ${OUTFILE} + DEPENDS ${TNAME}-geninfo ${TNAME}-capture-init + ) +endfunction (lcov_capture_tgt) + + +# This function will generate the global info file for all targets. It has to be +# called after all other CMake functions in the root CMakeLists.txt file, to get +# a full list of all targets that generate coverage data. +function (lcov_capture) + # Skip this function (and do not create the following targets), if there are + # no input files. + if ("${LCOV_CAPTURE_FILES}" STREQUAL "") + return() + endif () + + # Add a new target to merge the files of all targets. + set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info") + lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES}) + add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture) + + # Add a new global target for all lcov targets. This target could be used to + # generate the lcov html output for the whole project instead of calling + # -geninfo and -genhtml for each target. It will also be + # used to generate a html site for all project data together instead of one + # for each target. + if (NOT TARGET lcov) + file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets) + add_custom_target(lcov + COMMAND ${GENHTML_BIN} --quiet --sort ${GENHTML_CPPFILT_FLAG} + --baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info + --output-directory ${LCOV_HTML_PATH}/all_targets + --title "${CMAKE_PROJECT_NAME}" --prefix "${PROJECT_SOURCE_DIR}" + ${OUTFILE} + DEPENDS lcov-geninfo-init lcov-geninfo + ) + endif () +endfunction (lcov_capture) + + + + +# Add a new global target to generate the lcov html report for the whole project +# instead of calling -genhtml for each target (to create an own report +# for each target). Instead of the lcov target it does not require geninfo for +# all targets, so you have to call -geninfo to generate the info files +# the targets you'd like to have in your report or lcov-geninfo for generating +# info files for all targets before calling lcov-genhtml. +file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets) +if (NOT TARGET lcov-genhtml) + add_custom_target(lcov-genhtml + COMMAND ${GENHTML_BIN} + --quiet + --output-directory ${LCOV_HTML_PATH}/selected_targets + --title \"${CMAKE_PROJECT_NAME} - targets `find + ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name + \"all_targets.info\" -exec basename {} .info \\\;`\" + --prefix ${PROJECT_SOURCE_DIR} + --sort + ${GENHTML_CPPFILT_FLAG} + `find ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name + \"all_targets.info\"` + ) +endif (NOT TARGET lcov-genhtml) From d5b3fde5ca16815c663d26163c5fe9accdabdbcd Mon Sep 17 00:00:00 2001 From: Levi Zhou <31941107+ZhouXY-PKU@users.noreply.github.com> Date: Mon, 10 Nov 2025 20:28:33 +0800 Subject: [PATCH 88/92] Create FindGcov.cmake --- cmake/FindGcov.cmake | 160 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 cmake/FindGcov.cmake diff --git a/cmake/FindGcov.cmake b/cmake/FindGcov.cmake new file mode 100644 index 0000000000..a6ef6fd5c8 --- /dev/null +++ b/cmake/FindGcov.cmake @@ -0,0 +1,160 @@ +# This file is part of CMake-codecov. +# +# SPDX-FileCopyrightText: RWTH Aachen University, Federal Republic of Germany +# SPDX-FileContributor: Alexander Haase, alexander.haase@rwth-aachen.de +# +# SPDX-License-Identifier: BSD-3-Clause + +# include required Modules +include(FindPackageHandleStandardArgs) + + +# Search for gcov binary. +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY}) + +get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach (LANG ${ENABLED_LANGUAGES}) + # Gcov evaluation is dependent on the used compiler. Check gcov support for + # each compiler that is used. If gcov binary was already found for this + # compiler, do not try to find it again. + if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN) + get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH) + + if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU") + # Some distributions like OSX (homebrew) ship gcov with the compiler + # version appended as gcov-x. To find this binary we'll build the + # suggested binary name with the compiler version. + string(REGEX MATCH "^[0-9]+" GCC_VERSION + "${CMAKE_${LANG}_COMPILER_VERSION}") + + find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov + HINTS ${COMPILER_PATH}) + + elseif ("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "^(Apple)?Clang$") + # Some distributions like Debian ship llvm-cov with the compiler + # version appended as llvm-cov-x.y or just llvm-cov-x. To find this binary we'll build + # the suggested binary name with the compiler version. + string(REGEX MATCH "^[0-9]+\.[0-9]+" LLVM_FULL_VERSION + "${CMAKE_${LANG}_COMPILER_VERSION}") + string(REGEX MATCH "^[0-9]+" LLVM_MAJOR_VERSION + "${CMAKE_${LANG}_COMPILER_VERSION}") + + # llvm-cov prior version 3.5 seems to be not working with coverage + # evaluation tools, but these versions are compatible with the gcc + # gcov tool. + if(LLVM_FULL_VERSION VERSION_GREATER 3.4) + find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_FULL_VERSION}" "llvm-cov-${LLVM_MAJOR_VERSION}" + "llvm-cov" HINTS ${COMPILER_PATH}) + mark_as_advanced(LLVM_COV_BIN) + + if (LLVM_COV_BIN) + find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS + ${CMAKE_MODULE_PATH}) + if (LLVM_COV_WRAPPER) + set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "") + + # set additional parameters + set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV + "LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING + "Environment variables for llvm-cov-wrapper.") + mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV) + endif () + endif () + endif () + + if (NOT GCOV_BIN) + # Fall back to gcov binary if llvm-cov was not found or is + # incompatible. This is the default on OSX, but may crash on + # recent Linux versions. + find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH}) + endif () + endif () + + + if (GCOV_BIN) + set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING + "${LANG} gcov binary.") + + if (NOT CMAKE_REQUIRED_QUIET) + message("-- Found gcov evaluation for " + "${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}") + endif() + + unset(GCOV_BIN CACHE) + endif () + endif () +endforeach () + + + + +# Add a new global target for all gcov targets. This target could be used to +# generate the gcov files for the whole project instead of calling -gcov +# for each target. +if (NOT TARGET gcov) + add_custom_target(gcov) +endif (NOT TARGET gcov) + + + +# This function will add gcov evaluation for target . Only sources of +# this target will be evaluated and no dependencies will be added. It will call +# Gcov on any source file of once and store the gcov file in the same +# directory. +function (add_gcov_target TNAME) + get_target_property(TBIN_DIR ${TNAME} BINARY_DIR) + set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir) + + # We don't have to check, if the target has support for coverage, thus this + # will be checked by add_coverage_target in Findcoverage.cmake. Instead we + # have to determine which gcov binary to use. + get_target_property(TSOURCES ${TNAME} SOURCES) + set(SOURCES "") + set(TCOMPILER "") + foreach (FILE ${TSOURCES}) + codecov_path_of_source(${FILE} FILE) + if (NOT "${FILE}" STREQUAL "") + codecov_lang_of_source(${FILE} LANG) + if (NOT "${LANG}" STREQUAL "") + list(APPEND SOURCES "${FILE}") + set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID}) + endif () + endif () + endforeach () + + # If no gcov binary was found, coverage data can't be evaluated. + if (NOT GCOV_${TCOMPILER}_BIN) + message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.") + return() + endif () + + set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}") + set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}") + + + set(BUFFER "") + set(NULL_DEVICE "/dev/null") + if(WIN32) + set(NULL_DEVICE "NUL") + endif() + foreach(FILE ${SOURCES}) + get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH) + + # call gcov + add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov + COMMAND ${GCOV_ENV} ${GCOV_BIN} -p ${TDIR}/${FILE}.gcno > ${NULL_DEVICE} + DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + list(APPEND BUFFER ${TDIR}/${FILE}.gcov) + endforeach() + + + # add target for gcov evaluation of + add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER}) + + # add evaluation target to the global gcov target. + add_dependencies(gcov ${TNAME}-gcov) +endfunction (add_gcov_target) From 9f484f0f69323a0a2caffe3d996340ca515dc7d7 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 11 Nov 2025 16:04:48 +0800 Subject: [PATCH 89/92] Update coverage.yml --- .github/workflows/coverage.yml | 91 +++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 13 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6dbde0025c..e0d791e1cb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,7 +1,7 @@ name: Coverage Analysis on: - pull_request: # 当有 PR 指向 develop 分支时触发 + pull_request: branches: - develop workflow_dispatch: @@ -16,31 +16,96 @@ jobs: steps: - name: Checkout uses: actions/checkout@v5 + with: + submodules: recursive + - name: Install Requirements for Coverage Testing run: | - apt update && apt install -y lcov gpg curl jq ca-certificates - # mkdir externals - # git submodule add git://github.com/RWTH-HPC/CMake-codecov.git externals/CMake-codecov - - name: Building + apt update && apt install -y curl jq ca-certificates python3-pip + wget https://github.com/linux-test-project/lcov/releases/download/v2.0/lcov-2.0.tar.gz + tar xzf lcov-2.0.tar.gz + cd lcov-2.0 + make install + cd .. + lcov --version + pip3 install gcovr + + - name: Building with Coverage run: | rm -rf build/ rm -f CMakeCache.txt - cmake -B build -DENABLE_COVERAGE=ON -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON - cmake --build build -j`nproc` - cmake --install build + # 确保构建目录权限 + mkdir -p build + chmod -R 755 build/ + # 使用明确的覆盖率标志 + cmake -B build \ + -DENABLE_COVERAGE=ON \ + -DBUILD_TESTING=ON \ + -DENABLE_MLALGO=ON \ + -DENABLE_LIBXC=ON \ + -DENABLE_LIBRI=ON \ + -DENABLE_GOOGLEBENCH=ON \ + -DENABLE_RAPIDJSON=ON \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ + -DCMAKE_EXE_LINKER_FLAGS="--coverage" + cmake --build build -j`nproc` || echo "Some tests failed but continuing for coverage" + cmake --install build || echo "Some tests failed but continuing for coverage" + - name: Testing env: OMP_NUM_THREADS: 1 run: | - cmake --build build --target test ARGS="-V --timeout 21600" || exit 0 - - name: Generate Coverage Report + # 运行测试前确保权限 + chmod -R 755 build/ + cmake --build build --target test ARGS="-V --timeout 21600" || echo "Some tests failed but continuing for coverage" + + - name: Generate Coverage Data run: | - cmake --build build --target coverage + cd build + # 检查 .gcno 和 .gcda 文件是否存在 + echo "Checking for coverage files:" + find . -name "*.gcno" | head -10 + find . -name "*.gcda" | head -10 + + # 方法1: 使用更新后的 lcov + echo "Generating coverage with lcov..." + lcov --directory . --capture --output-file coverage.info || echo "lcov failed, will try gcovr" + + # 过滤覆盖率数据 + lcov --remove coverage.info '/usr/*' '*/test/*' '*/external/*' '*/build/*' --output-file coverage.filtered.info || echo "lcov filtering failed" + + # 生成HTML报告用于检查 + genhtml coverage.filtered.info --output-directory coverage-report || echo "genhtml failed" + + # # 方法2: 使用 gcovr 作为备用 + # echo "Generating coverage with gcovr..." + # gcovr -r .. --html --html-details -o coverage-gcovr.html --print-summary || echo "gcovr failed" + + # # 同时生成 gcovr 的 XML 格式,Codecov 更喜欢这种格式 + # gcovr -r .. --xml -o coverage.xml || echo "gcovr xml failed" + + cd .. + - name: Upload Coverage to Codecov uses: codecov/codecov-action@v5 if: ${{ ! cancelled() }} with: - fail_ci_if_error: true + fail_ci_if_error: false # 设置为 false 避免因覆盖率收集失败而整个 CI 失败 token: ${{ secrets.CODECOV_TOKEN }} - skip_validation: true + files: ./build/coverage.xml,./build/coverage.info # 提供多个文件选项 + directory: ./build/ + flags: unittests + name: codecov-umbrella verbose: true + + - name: Upload Coverage Report Artifact + uses: actions/upload-artifact@v4 + if: always() # 即使前面的步骤失败也上传,便于调试 + with: + name: coverage-report + path: | + build/coverage-report/ + build/coverage.info + build/coverage.xml + retention-days: 30 \ No newline at end of file From 138a17ea5ab20e4907031ebe38d750885cbe104c Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Tue, 11 Nov 2025 16:08:22 +0800 Subject: [PATCH 90/92] Update coverage.yml --- .github/workflows/coverage.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e0d791e1cb..f57bb892ae 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,15 +19,16 @@ jobs: with: submodules: recursive - - name: Install Requirements for Coverage Testing + - name: Install Perl Dependencies and Coverage Tools run: | apt update && apt install -y curl jq ca-certificates python3-pip - wget https://github.com/linux-test-project/lcov/releases/download/v2.0/lcov-2.0.tar.gz - tar xzf lcov-2.0.tar.gz - cd lcov-2.0 - make install - cd .. + # 首先安装系统版本的 lcov 和 Perl 依赖 + apt install -y lcov perl-modules + # 安装必要的 Perl 模块 + apt install -y libcapture-tiny-perl libdatetime-perl libjson-perl libperlio-gzip-perl + # 验证系统 lcov 是否工作 lcov --version + # 同时安装 gcovr 作为备用方案 pip3 install gcovr - name: Building with Coverage From f0b9b2ce18236ab47b6de0c94360dc9ad0d6b5a5 Mon Sep 17 00:00:00 2001 From: Liang Sun <50293369+sunliang98@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:12:53 +0800 Subject: [PATCH 91/92] Update source_lcao/module_operator_lcao/test/CMakeLists.txt --- .../source_lcao/module_operator_lcao/test/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt index e39a3dac19..7d48538c5c 100644 --- a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt +++ b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt @@ -9,8 +9,8 @@ AddTest( ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_basis/module_ao/ORB_atomic_lm.cpp tmp_mocks.cpp ../../../source_hamilt/operator.cpp - ../../../source_lcao/module_rt/td_info.cpp - ../../../source_lcao/module_rt/td_folding.cpp + ../../module_rt/td_info.cpp + ../../module_rt/td_folding.cpp ../../../source_estate/module_pot/H_TDDFT_pw.cpp ) @@ -22,8 +22,8 @@ AddTest( ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_basis/module_ao/ORB_atomic_lm.cpp tmp_mocks.cpp ../../../source_hamilt/operator.cpp - ../../../source_lcao/module_rt/td_info.cpp - ../../../source_lcao/module_rt/td_folding.cpp + ../../module_rt/td_info.cpp + ../../module_rt/td_folding.cpp ../../../source_estate/module_pot/H_TDDFT_pw.cpp ) From 353ffe70b061c0ba448b90894ef923d3da099529 Mon Sep 17 00:00:00 2001 From: Liang Sun <50293369+sunliang98@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:13:51 +0800 Subject: [PATCH 92/92] Fix path for print_cell.cpp in CMakeLists.txt --- source/source_cell/test_pw/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_cell/test_pw/CMakeLists.txt b/source/source_cell/test_pw/CMakeLists.txt index 68818a25ca..48893a14ae 100644 --- a/source/source_cell/test_pw/CMakeLists.txt +++ b/source/source_cell/test_pw/CMakeLists.txt @@ -15,7 +15,7 @@ AddTest( ../read_stru.cpp ../read_atom_species.cpp ../read_pp_vwr.cpp ../read_pp_blps.cpp ../../source_io/output.cpp ../../source_estate/read_pseudo.cpp ../../source_estate/cal_nelec_nband.cpp - ../../source_estate/read_orb.cpp ../../source_cell/print_cell.cpp + ../../source_estate/read_orb.cpp ../print_cell.cpp ../../source_estate/cal_wfc.cpp ../sep.cpp ../sep_cell.cpp )