Skip to content

Commit b494a0d

Browse files
authored
merge devel to master (v3.1.0) (#4798)
2 parents e695a91 + a6042c6 commit b494a0d

File tree

563 files changed

+105452
-1732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

563 files changed

+105452
-1732
lines changed

.devcontainer/build_cxx.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mkdir -p ${SCRIPT_PATH}/../buildcxx/
1111
cd ${SCRIPT_PATH}/../buildcxx/
1212
cmake -D ENABLE_TENSORFLOW=ON \
1313
-D ENABLE_PYTORCH=ON \
14+
-D ENABLE_PADDLE=ON \
1415
-D CMAKE_INSTALL_PREFIX=${SCRIPT_PATH}/../dp/ \
1516
-D LAMMPS_VERSION=stable_29Aug2024_update1 \
1617
-D CMAKE_BUILD_TYPE=Debug \

.devcontainer/download_libtorch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set -ev
44
SCRIPT_PATH=$(dirname $(realpath -s $0))
55
cd ${SCRIPT_PATH}/..
66

7-
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.5.0%2Bcpu.zip -O ~/libtorch.zip
7+
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcpu.zip -O ~/libtorch.zip
88
unzip ~/libtorch.zip

.github/workflows/build_cc.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ jobs:
3333
- uses: lukka/get-cmake@latest
3434
- run: python -m pip install uv
3535
- run: source/install/uv_with_retry.sh pip install --system tensorflow
36-
- name: Download libtorch
37-
run: |
38-
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.2%2Bcpu.zip -O libtorch.zip
39-
unzip libtorch.zip
36+
- run: source/install/uv_with_retry.sh pip install --system 'torch==2.7' --index-url https://download.pytorch.org/whl/cpu
4037
- run: |
4138
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
4239
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
@@ -52,22 +49,20 @@ jobs:
5249
env:
5350
DEBIAN_FRONTEND: noninteractive
5451
- run: |
55-
echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/5.3/ jammy main' | sudo tee /etc/apt/sources.list.d/rocm.list \
52+
echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/6.3/ jammy main' | sudo tee /etc/apt/sources.list.d/rocm.list \
5653
&& printf 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600 \
5754
&& curl -s https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add - \
5855
&& sudo apt-get update \
5956
&& sudo apt-get install -y rocm-dev hipcub-dev
6057
if: matrix.variant == 'rocm'
6158
- run: |
62-
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/libtorch
6359
source/install/build_cc.sh
6460
env:
6561
DP_VARIANT: ${{ matrix.dp_variant }}
6662
DOWNLOAD_TENSORFLOW: "FALSE"
6763
CMAKE_GENERATOR: Ninja
6864
if: matrix.variant != 'clang'
6965
- run: |
70-
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/libtorch
7166
source/install/build_cc.sh
7267
env:
7368
DP_VARIANT: cpu

.github/workflows/build_wheel.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,8 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
determine-arm64-runner:
18-
runs-on: ubuntu-latest
19-
permissions: read-all
20-
outputs:
21-
runner: ${{ steps.set-runner.outputs.runner }}
22-
steps:
23-
- name: Determine which runner to use for ARM64 build
24-
id: set-runner
25-
run: |
26-
if [ "${{ github.repository_owner }}" == "deepmodeling" ]; then
27-
echo "runner=[\"Linux\",\"ARM64\"]" >> $GITHUB_OUTPUT
28-
else
29-
echo "runner=\"ubuntu-latest\"" >> $GITHUB_OUTPUT
30-
fi
31-
3217
build_wheels:
3318
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
34-
needs: determine-arm64-runner
3519
runs-on: ${{ matrix.os }}
3620
strategy:
3721
fail-fast: false
@@ -60,12 +44,12 @@ jobs:
6044
platform_id: macosx_arm64
6145
dp_variant: cpu
6246
# win-64
63-
- os: windows-2019
47+
- os: windows-2022
6448
python: 311
6549
platform_id: win_amd64
6650
dp_variant: cpu
6751
# linux-aarch64
68-
- os: ${{ fromJson(needs.determine-arm64-runner.outputs.runner) }}
52+
- os: ubuntu-24.04-arm
6953
python: 310
7054
platform_id: manylinux_aarch64
7155
dp_variant: cpu
@@ -86,7 +70,7 @@ jobs:
8670
rm -rf .git
8771
if: matrix.dp_pkg_name == 'deepmd-kit-cu11'
8872
- name: Build wheels
89-
uses: pypa/cibuildwheel@v2.21
73+
uses: pypa/cibuildwheel@v2.23
9074
env:
9175
CIBW_BUILD_VERBOSITY: 1
9276
CIBW_ARCHS: all

.github/workflows/codeql.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ jobs:
4141
&& sudo apt-get update \
4242
&& sudo apt-get -y install cuda-cudart-dev-12-2 cuda-nvcc-12-2
4343
python -m pip install tensorflow
44-
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.2%2Bcpu.zip -O libtorch.zip
45-
unzip libtorch.zip
44+
python -m pip install 'torch==2.7' --index-url https://download.pytorch.org/whl/cpu
4645
env:
4746
DEBIAN_FRONTEND: noninteractive
4847
# Initializes the CodeQL tools for scanning.
@@ -53,7 +52,6 @@ jobs:
5352
queries: security-extended,security-and-quality
5453
- name: "Run, Build Application using script"
5554
run: |
56-
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/libtorch
5755
source/install/build_cc.sh
5856
env:
5957
DP_VARIANT: cuda

.github/workflows/suppr.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leak:libpaddle_inference

.github/workflows/test_cc.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,17 @@ jobs:
2929
- run: python -m pip install uv
3030
- name: Install Python dependencies
3131
run: |
32-
source/install/uv_with_retry.sh pip install --system tensorflow-cpu
32+
source/install/uv_with_retry.sh pip install --system tensorflow-cpu~=2.18.0 jax==0.5.0
3333
export TENSORFLOW_ROOT=$(python -c 'import importlib,pathlib;print(pathlib.Path(importlib.util.find_spec("tensorflow").origin).parent)')
3434
source/install/uv_with_retry.sh pip install --system -e .[cpu,test,lmp,jax] mpi4py
35+
source/install/uv_with_retry.sh pip install --system 'torch==2.7' --index-url https://download.pytorch.org/whl/cpu
3536
- name: Convert models
3637
run: source/tests/infer/convert-models.sh
37-
- name: Download libtorch
38-
run: |
39-
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.2%2Bcpu.zip -O libtorch.zip
40-
unzip libtorch.zip
4138
# https://github.com/actions/runner-images/issues/9491
4239
- name: Fix kernel mmap rnd bits
4340
run: sudo sysctl vm.mmap_rnd_bits=28
4441
if: ${{ matrix.check_memleak }}
4542
- run: |
46-
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/libtorch
4743
source/install/test_cc_local.sh
4844
env:
4945
OMP_NUM_THREADS: 1
@@ -52,23 +48,32 @@ jobs:
5248
LMP_CXX11_ABI_0: 1
5349
CMAKE_GENERATOR: Ninja
5450
CXXFLAGS: ${{ matrix.check_memleak && '-fsanitize=leak' || '' }}
51+
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/workflows/suppr.txt
5552
# test lammps
56-
- run: pytest --cov=deepmd source/lmp/tests
53+
- run: |
54+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/paddle/lib/*.so ${{ github.workspace }}/dp_test/lib/
55+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/onednn/lib/* ${{ github.workspace }}/dp_test/lib/
56+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/mklml/lib/* ${{ github.workspace }}/dp_test/lib/
57+
pytest --cov=deepmd source/lmp/tests
5758
env:
5859
OMP_NUM_THREADS: 1
5960
TF_INTRA_OP_PARALLELISM_THREADS: 1
6061
TF_INTER_OP_PARALLELISM_THREADS: 1
6162
LAMMPS_PLUGIN_PATH: ${{ github.workspace }}/dp_test/lib/deepmd_lmp
62-
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib:${{ github.workspace }}/libtorch/lib
63+
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib
6364
if: ${{ !matrix.check_memleak }}
6465
# test ipi
65-
- run: pytest --cov=deepmd source/ipi/tests
66+
- run: |
67+
export PATH=${{ github.workspace }}/dp_test/bin:$PATH
68+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/paddle/lib/*.so ${{ github.workspace }}/dp_test/lib/
69+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/onednn/lib/* ${{ github.workspace }}/dp_test/lib/
70+
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/mklml/lib/* ${{ github.workspace }}/dp_test/lib/
71+
pytest --cov=deepmd source/ipi/tests
6672
env:
6773
OMP_NUM_THREADS: 1
6874
TF_INTRA_OP_PARALLELISM_THREADS: 1
6975
TF_INTER_OP_PARALLELISM_THREADS: 1
70-
PATH: ${{ github.workspace }}/dp_test/bin:$PATH
71-
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib:${{ github.workspace }}/libtorch/lib
76+
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib
7277
if: ${{ !matrix.check_memleak }}
7378
- uses: codecov/codecov-action@v5
7479
env:

.github/workflows/test_cuda.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,27 @@ jobs:
4747
&& sudo apt-get -y install cuda-12-3 libcudnn8=8.9.5.*-1+cuda12.3
4848
if: false # skip as we use nvidia image
4949
- run: python -m pip install -U uv
50-
- run: source/install/uv_with_retry.sh pip install --system "tensorflow~=2.18.0rc2" "torch~=2.5.0" "jax[cuda12]"
50+
- run: source/install/uv_with_retry.sh pip install --system "tensorflow~=2.18.0rc2" "torch~=2.7.0" "jax[cuda12]==0.5.0"
5151
- run: |
5252
export PYTORCH_ROOT=$(python -c 'import torch;print(torch.__path__[0])')
5353
export TENSORFLOW_ROOT=$(python -c 'import importlib,pathlib;print(pathlib.Path(importlib.util.find_spec("tensorflow").origin).parent)')
54-
source/install/uv_with_retry.sh pip install --system -v -e .[gpu,test,lmp,cu12,torch,jax] mpi4py
54+
pip install "paddlepaddle-gpu==3.0.0" -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
55+
source/install/uv_with_retry.sh pip install --system -v -e .[gpu,test,lmp,cu12,torch,jax] mpi4py --reinstall-package deepmd-kit
5556
env:
5657
DP_VARIANT: cuda
5758
DP_ENABLE_NATIVE_OPTIMIZATION: 1
5859
DP_ENABLE_PYTORCH: 1
5960
- run: dp --version
60-
- run: python -m pytest source/tests --durations=0
61+
- run: python -m pytest source/tests
6162
env:
6263
NUM_WORKERS: 0
6364
CUDA_VISIBLE_DEVICES: 0
6465
# See https://jax.readthedocs.io/en/latest/gpu_memory_allocation.html
6566
XLA_PYTHON_CLIENT_PREALLOCATE: false
67+
XLA_PYTHON_CLIENT_ALLOCATOR: platform
6668
- name: Convert models
6769
run: source/tests/infer/convert-models.sh
68-
- name: Download libtorch
69-
run: |
70-
wget https://download.pytorch.org/libtorch/cu124/libtorch-cxx11-abi-shared-with-deps-2.5.0%2Bcu124.zip -O libtorch.zip
71-
unzip libtorch.zip
7270
- run: |
73-
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/libtorch
7471
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
7572
source/install/test_cc_local.sh
7673
env:
@@ -82,8 +79,11 @@ jobs:
8279
DP_VARIANT: cuda
8380
DP_USE_MPICH2: 1
8481
- run: |
85-
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:/usr/lib/x86_64-linux-gnu/:$GITHUB_WORKSPACE/dp_test/lib:$GITHUB_WORKSPACE/libtorch/lib:$LD_LIBRARY_PATH
82+
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:/usr/lib/x86_64-linux-gnu/:$GITHUB_WORKSPACE/dp_test/lib:$LD_LIBRARY_PATH
8683
export PATH=$GITHUB_WORKSPACE/dp_test/bin:$PATH
84+
cp $GITHUB_WORKSPACE/source/build_tests/paddle_inference_install_dir/paddle/lib/* $GITHUB_WORKSPACE/dp_test/lib/
85+
cp $GITHUB_WORKSPACE/source/build_tests/paddle_inference_install_dir/third_party/install/onednn/lib/* $GITHUB_WORKSPACE/dp_test/lib/
86+
cp $GITHUB_WORKSPACE/source/build_tests/paddle_inference_install_dir/third_party/install/mklml/lib/* $GITHUB_WORKSPACE/dp_test/lib/
8787
python -m pytest -s source/lmp/tests || (cat log.lammps && exit 1)
8888
python -m pytest source/ipi/tests
8989
env:

.github/workflows/test_python.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ jobs:
2525
python-version: ${{ matrix.python }}
2626
- run: python -m pip install -U uv
2727
- run: |
28-
source/install/uv_with_retry.sh pip install --system openmpi tensorflow-cpu
28+
source/install/uv_with_retry.sh pip install --system openmpi tensorflow-cpu~=2.18.0
2929
source/install/uv_with_retry.sh pip install --system torch -i https://download.pytorch.org/whl/cpu
3030
export TENSORFLOW_ROOT=$(python -c 'import tensorflow;print(tensorflow.__path__[0])')
3131
export PYTORCH_ROOT=$(python -c 'import torch;print(torch.__path__[0])')
32-
source/install/uv_with_retry.sh pip install --system -e .[test,jax] mpi4py
32+
source/install/uv_with_retry.sh pip install --system -e .[test,jax] mpi4py "jax==0.5.0;python_version>='3.10'"
33+
source/install/uv_with_retry.sh pip install --system -U setuptools
3334
source/install/uv_with_retry.sh pip install --system horovod --no-build-isolation
35+
source/install/uv_with_retry.sh pip install --system --pre "paddlepaddle==3.0.0" -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
3436
env:
3537
# Please note that uv has some issues with finding
3638
# existing TensorFlow package. Currently, it uses
@@ -42,6 +44,8 @@ jobs:
4244
HOROVOD_WITH_TENSORFLOW: 1
4345
HOROVOD_WITHOUT_PYTORCH: 1
4446
HOROVOD_WITH_MPI: 1
47+
# https://cmake.org/cmake/help/latest/variable/CMAKE_POLICY_VERSION_MINIMUM.html
48+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
4549
- run: dp --version
4650
- name: Get durations from cache
4751
uses: actions/cache@v4
@@ -54,11 +58,11 @@ jobs:
5458
restore-keys: |
5559
test2-durations-combined-${{ matrix.python }}-${{ github.sha }}
5660
test2-durations-combined-${{ matrix.python }}
57-
- run: pytest --cov=deepmd source/tests --durations=0 --splits 6 --group ${{ matrix.group }} --store-durations --clean-durations --durations-path=.test_durations --splitting-algorithm least_duration
61+
- run: pytest --cov=deepmd source/tests --splits 6 --group ${{ matrix.group }} --store-durations --clean-durations --durations-path=.test_durations --splitting-algorithm least_duration
5862
env:
5963
NUM_WORKERS: 0
6064
- name: Test TF2 eager mode
61-
run: pytest --cov=deepmd --cov-append source/tests/consistent/io/test_io.py source/jax2tf_tests --durations=0
65+
run: pytest --cov=deepmd --cov-append source/tests/consistent/io/test_io.py source/jax2tf_tests
6266
env:
6367
NUM_WORKERS: 0
6468
DP_TEST_TF2_ONLY: 1

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88
exclude: "^.+\\.pbtxt$"
99
- id: end-of-file-fixer
10-
exclude: "^.+\\.pbtxt$"
10+
exclude: "^.+\\.pbtxt$|deeppot_sea.*\\.json$"
1111
- id: check-yaml
1212
- id: check-json
1313
- id: check-added-large-files
@@ -22,14 +22,14 @@ repos:
2222
- id: check-toml
2323
# Python
2424
- repo: https://github.com/PyCQA/isort
25-
rev: 5.13.2
25+
rev: 6.0.1
2626
hooks:
2727
- id: isort
2828
files: \.py$
2929
exclude: ^source/3rdparty
3030
- repo: https://github.com/astral-sh/ruff-pre-commit
3131
# Ruff version.
32-
rev: v0.7.4
32+
rev: v0.11.13
3333
hooks:
3434
- id: ruff
3535
args: ["--fix"]
@@ -40,7 +40,7 @@ repos:
4040
types_or: [python, pyi, jupyter]
4141
- repo: https://github.com/pycqa/flake8
4242
# flake8 cannot autofix
43-
rev: "7.1.1"
43+
rev: "7.2.0"
4444
hooks:
4545
- id: flake8
4646
additional_dependencies:
@@ -60,10 +60,10 @@ repos:
6060
- id: blacken-docs
6161
# C++
6262
- repo: https://github.com/pre-commit/mirrors-clang-format
63-
rev: v19.1.3
63+
rev: v20.1.5
6464
hooks:
6565
- id: clang-format
66-
exclude: ^(source/3rdparty|source/lib/src/gpu/cudart/.+\.inc|.+\.ipynb$)
66+
exclude: ^(source/3rdparty|source/lib/src/gpu/cudart/.+\.inc|.+\.ipynb$|.+\.json$)
6767
# markdown, yaml, CSS, javascript
6868
- repo: https://github.com/pre-commit/mirrors-prettier
6969
rev: v4.0.0-alpha.8
@@ -74,7 +74,7 @@ repos:
7474
exclude: ^(source/3rdparty|\.github/workflows|\.clang-format)
7575
# Shell
7676
- repo: https://github.com/scop/pre-commit-shfmt
77-
rev: v3.10.0-1
77+
rev: v3.11.0-1
7878
hooks:
7979
- id: shfmt
8080
# CMake
@@ -154,7 +154,7 @@ repos:
154154
exclude: .pre-commit-config.yaml|source/lmp
155155
# customized pylint rules
156156
- repo: https://github.com/pylint-dev/pylint/
157-
rev: v3.3.1
157+
rev: v3.3.7
158158
hooks:
159159
- id: pylint
160160
entry: env PYTHONPATH=source/checker pylint

.readthedocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ build:
1010
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install -r doc/requirements.txt
1111
apt_packages:
1212
- inkscape
13+
sphinx:
14+
configuration: doc/conf.py
1315
formats:
1416
- pdf

0 commit comments

Comments
 (0)