diff --git a/.github/workflows/build_cc.yml b/.github/workflows/build_cc.yml index 71db83fff9..ba9f581dca 100644 --- a/.github/workflows/build_cc.yml +++ b/.github/workflows/build_cc.yml @@ -15,6 +15,15 @@ jobs: buildcc: name: Build C++ runs-on: ubuntu-22.04 + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_BASEDIR: ${{ github.workspace }} + CCACHE_COMPILERCHECK: content + CCACHE_MAXSIZE: 1G + CCACHE_COMPRESS: "true" + CCACHE_VERSION: "4.14" + LAMMPS_VERSION: stable_22Jul2025_update2 + LAMMPS_SOURCE_DIR: ${{ github.workspace }}/.cache/lammps/stable_22Jul2025_update2 strategy: matrix: include: @@ -49,12 +58,52 @@ jobs: && sudo apt-get update \ && sudo apt-get install -y rocm-dev hipcub-dev if: matrix.variant == 'rocm' + - name: Restore LAMMPS source + id: lammps-cache + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ env.LAMMPS_SOURCE_DIR }} + key: lammps-source-${{ env.LAMMPS_VERSION }}-v1 + - name: Fetch LAMMPS source + if: steps.lammps-cache.outputs.cache-hit != 'true' + shell: bash + run: | + rm -rf "$LAMMPS_SOURCE_DIR" + git clone --depth 1 --branch "$LAMMPS_VERSION" \ + https://github.com/lammps/lammps "$LAMMPS_SOURCE_DIR" + - name: Install ccache + shell: bash + run: | + CCACHE_ARCHIVE="ccache-${CCACHE_VERSION}-linux-x86_64-musl-static.tar.xz" + curl -L --fail --retry 3 \ + "https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/${CCACHE_ARCHIVE}" \ + -o "$RUNNER_TEMP/$CCACHE_ARCHIVE" + echo "888eaf9697919d6eba77be797e9d9c9e40e734d11d67d25a79b075c3f79f6c77 $RUNNER_TEMP/$CCACHE_ARCHIVE" | sha256sum -c - + tar -xJf "$RUNNER_TEMP/$CCACHE_ARCHIVE" -C "$RUNNER_TEMP" + echo "$RUNNER_TEMP/ccache-${CCACHE_VERSION}-linux-x86_64-musl-static" >> "$GITHUB_PATH" + - name: Restore ccache + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ env.CCACHE_DIR }} + key: ccache-build-cc-${{ matrix.variant }}-v${{ env.CCACHE_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + ccache-build-cc-${{ matrix.variant }}-v${{ env.CCACHE_VERSION }}- + - name: Reset ccache statistics + run: | + ccache --version + ccache --zero-stats - run: | source/install/build_cc.sh env: DP_VARIANT: ${{ matrix.dp_variant }} DOWNLOAD_TENSORFLOW: "FALSE" CMAKE_GENERATOR: Ninja + CMAKE_ARGS: "-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON" + LAMMPS_SOURCE_ROOT: ${{ env.LAMMPS_SOURCE_DIR }} + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_CUDA_COMPILER_LAUNCHER: ccache + CMAKE_HIP_COMPILER_LAUNCHER: ccache if: matrix.variant != 'clang' - run: | source/install/build_cc.sh @@ -64,7 +113,14 @@ jobs: CC: clang CXX: clang++ CMAKE_GENERATOR: Ninja + CMAKE_ARGS: "-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON" + LAMMPS_SOURCE_ROOT: ${{ env.LAMMPS_SOURCE_DIR }} + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache if: matrix.variant == 'clang' + - name: Show ccache statistics + if: always() + run: ccache --show-stats - name: Test files exist run: | test -f dp/bin/dp_ipi && diff --git a/doc/conf.py b/doc/conf.py index 5753b2afed..78b3bc2a85 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -142,6 +142,10 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +# External inventories are optional cross-reference metadata. Limit connection +# and read-inactivity waits so Sphinx can warn and continue if a host stalls. +# This is not a deadline for the full download or documentation build. +intersphinx_timeout = 30 intersphinx_mapping = { "numpy": ("https://docs.scipy.org/doc/numpy/", None), "python": ("https://docs.python.org/", None), diff --git a/source/api_cc/src/DataModifierTF.cc b/source/api_cc/src/DataModifierTF.cc index bce80f9606..d35f365ef4 100644 --- a/source/api_cc/src/DataModifierTF.cc +++ b/source/api_cc/src/DataModifierTF.cc @@ -3,6 +3,7 @@ #include "DataModifierTF.h" #include "common.h" +#include "device.h" using namespace deepmd; using namespace tensorflow; diff --git a/source/api_cc/src/DeepTensorTF.cc b/source/api_cc/src/DeepTensorTF.cc index 12bfc15eaf..bc7c191974 100644 --- a/source/api_cc/src/DeepTensorTF.cc +++ b/source/api_cc/src/DeepTensorTF.cc @@ -2,6 +2,8 @@ #ifdef BUILD_TENSORFLOW #include "DeepTensorTF.h" +#include "device.h" + using namespace deepmd; using namespace tensorflow; diff --git a/source/install/build_cc.sh b/source/install/build_cc.sh index 56c50e92f5..3cd499d137 100755 --- a/source/install/build_cc.sh +++ b/source/install/build_cc.sh @@ -5,6 +5,11 @@ if [ "$DP_VARIANT" = "cuda" ]; then elif [ "$DP_VARIANT" = "rocm" ]; then CUDA_ARGS="-DUSE_ROCM_TOOLKIT=TRUE" fi +if [ -n "${LAMMPS_SOURCE_ROOT:-}" ]; then + LAMMPS_ARGS="-D LAMMPS_SOURCE_ROOT=${LAMMPS_SOURCE_ROOT}" +else + LAMMPS_ARGS="-D LAMMPS_VERSION=stable_22Jul2025_update2" +fi #------------------ SCRIPT_PATH=$(dirname $(realpath -s $0)) @@ -26,7 +31,8 @@ cmake -D ENABLE_TENSORFLOW=ON \ -D USE_TF_PYTHON_LIBS=TRUE \ -D USE_PT_PYTHON_LIBS=TRUE \ ${CUDA_ARGS} \ - -D LAMMPS_VERSION=stable_22Jul2025_update2 \ + ${LAMMPS_ARGS} \ + ${CMAKE_ARGS:-} \ .. cmake --build . -j${NPROC} cmake --install .