Skip to content

Commit 477b785

Browse files
Merge devel into master (#2871)
2 parents 6cf7544 + 218ff45 commit 477b785

File tree

286 files changed

+50281
-8806
lines changed

Some content is hidden

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

286 files changed

+50281
-8806
lines changed

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Python:
55
Docs: doc/**/*
66
Examples: examples/**/*
77
Core: source/lib/**/*
8-
CUDA: source/lib/src/cuda/**/*
9-
ROCM: source/lib/src/rocm/**/*
8+
CUDA: source/lib/src/gpu/**/*
9+
ROCM: source/lib/src/gpu/**/*
1010
OP: source/op/**/*
1111
C++: source/api_cc/**/*
1212
C: source/api_c/**/*

.github/workflows/build_cc.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ jobs:
2020
- variant: clang
2121
dp_variant: clang
2222
steps:
23-
- uses: actions/checkout@v3
24-
with:
25-
submodules: true
23+
- uses: actions/checkout@v4
2624
- uses: actions/setup-python@v4
2725
with:
2826
python-version: '3.11'
27+
cache: 'pip'
28+
- uses: lukka/get-cmake@latest
2929
- run: python -m pip install tensorflow
30-
- run: sudo apt-get update && sudo apt-get install -y nvidia-cuda-toolkit
30+
- run: |
31+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
32+
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
33+
&& sudo apt-get update \
34+
&& sudo apt-get -y install cuda-cudart-dev-11-8 cuda-nvcc-11-8
3135
if: matrix.variant == 'cuda'
3236
- run: |
3337
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
3438
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
3539
&& sudo apt-get update \
36-
&& sudo apt-get -y install cuda-12-0
40+
&& sudo apt-get -y install cuda-cudart-dev-12-0 cuda-nvcc-12-0
3741
if: matrix.variant == 'cuda120'
3842
env:
3943
DEBIAN_FRONTEND: noninteractive
@@ -44,19 +48,19 @@ jobs:
4448
&& sudo apt-get update \
4549
&& sudo apt-get install -y rocm-dev hipcub-dev
4650
if: matrix.variant == 'rocm'
47-
- run: sudo apt-get update && sudo apt-get install -y clang
48-
if: matrix.variant == 'clang'
4951
- run: source/install/build_cc.sh
5052
env:
5153
DP_VARIANT: ${{ matrix.dp_variant }}
5254
DOWNLOAD_TENSORFLOW: "FALSE"
55+
CMAKE_GENERATOR: Ninja
5356
if: matrix.variant != 'clang'
5457
- run: source/install/build_cc.sh
5558
env:
5659
DP_VARIANT: cpu
5760
DOWNLOAD_TENSORFLOW: "FALSE"
5861
CC: clang
5962
CXX: clang++
63+
CMAKE_GENERATOR: Ninja
6064
if: matrix.variant == 'clang'
6165
- name: Test files exist
6266
run: |

.github/workflows/build_wheel.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,24 @@ on:
55
pull_request:
66

77
jobs:
8+
determine-arm64-runner:
9+
runs-on: ubuntu-latest
10+
permissions: read-all
11+
outputs:
12+
runner: ${{ steps.set-runner.outputs.runner }}
13+
steps:
14+
- name: Determine which runner to use for ARM64 build
15+
id: set-runner
16+
run: |
17+
if [ "${{ github.repository_owner }}" == "deepmodeling" ]; then
18+
echo "runner=[\"Linux\",\"ARM64\"]" >> $GITHUB_OUTPUT
19+
else
20+
echo "runner=\"ubuntu-latest\"" >> $GITHUB_OUTPUT
21+
fi
22+
823
build_wheels:
924
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
25+
needs: determine-arm64-runner
1026
runs-on: ${{ matrix.os }}
1127
strategy:
1228
fail-fast: false
@@ -33,21 +49,20 @@ jobs:
3349
platform_id: win_amd64
3450
dp_variant: cpu
3551
# linux-aarch64
36-
- os: ubuntu-latest
52+
- os: ${{ fromJson(needs.determine-arm64-runner.outputs.runner) }}
3753
python: 310
3854
platform_id: manylinux_aarch64
3955
dp_variant: cpu
4056
steps:
41-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
4258
with:
43-
submodules: true
4459
# https://github.com/pypa/setuptools_scm/issues/480
4560
fetch-depth: 0
46-
- uses: docker/setup-qemu-action@v2
61+
- uses: docker/setup-qemu-action@v3
4762
name: Setup QEMU
48-
if: matrix.platform_id == 'manylinux_aarch64'
63+
if: matrix.platform_id == 'manylinux_aarch64' && matrix.os == 'ubuntu-latest'
4964
- name: Build wheels
50-
uses: pypa/cibuildwheel@v2.15
65+
uses: pypa/cibuildwheel@v2.16
5166
env:
5267
CIBW_BUILD_VERBOSITY: 1
5368
CIBW_ARCHS: all
@@ -60,13 +75,12 @@ jobs:
6075
name: Build source distribution
6176
runs-on: ubuntu-latest
6277
steps:
63-
- uses: actions/checkout@v3
64-
with:
65-
submodules: true
78+
- uses: actions/checkout@v4
6679
- uses: actions/setup-python@v4
6780
name: Install Python
6881
with:
6982
python-version: '3.11'
83+
cache: 'pip'
7084
- run: python -m pip install build
7185
- name: Build sdist
7286
run: python -m build --sdist
@@ -94,26 +108,26 @@ jobs:
94108
needs: [build_wheels]
95109
runs-on: ubuntu-latest
96110
steps:
97-
- uses: actions/checkout@v3
111+
- uses: actions/checkout@v4
98112
- uses: actions/download-artifact@v3
99113
with:
100114
name: artifact
101115
path: source/install/docker/dist
102116
- name: Log in to the Container registry
103-
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
117+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
104118
with:
105119
registry: ghcr.io
106120
username: ${{ github.actor }}
107121
password: ${{ secrets.GITHUB_TOKEN }}
108122

109123
- name: Extract metadata (tags, labels) for Docker
110124
id: meta
111-
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
125+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
112126
with:
113127
images: ghcr.io/deepmodeling/deepmd-kit
114128

115129
- name: Build and push Docker image
116-
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
130+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
117131
with:
118132
context: source/install/docker
119133
push: ${{ github.repository_owner == 'deepmodeling' && github.event_name == 'push' }}

.github/workflows/package_c.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Build C library
1010
runs-on: ubuntu-22.04
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: Package C library
1414
run: ./source/install/docker_package_c.sh
1515
# for download and debug
@@ -30,7 +30,7 @@ jobs:
3030
needs: [build_c]
3131
runs-on: ubuntu-22.04
3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
- name: Download artifact
3535
uses: actions/download-artifact@v3
3636
with:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
pull_request_target:
3+
types:
4+
- "labeled"
5+
name: Test CUDA
6+
jobs:
7+
remove_label:
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
# so one can re-trigger the workflow without manually removing the label
12+
runs-on: ubuntu-latest
13+
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA'
14+
steps:
15+
- uses: actions-ecosystem/action-remove-labels@v1
16+
with:
17+
labels: Test CUDA
18+
number: ${{ github.event.pull_request.number }}

.github/workflows/test_cc.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,24 @@ jobs:
77
name: Test C++
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- uses: actions/setup-python@v4
1212
with:
1313
python-version: '3.11'
14+
cache: 'pip'
1415
- name: Setup MPI
1516
uses: mpi4py/setup-mpi@v1
1617
with:
1718
mpi: mpich
19+
- uses: lukka/get-cmake@latest
1820
- run: python -m pip install tensorflow
1921
- run: source/install/test_cc_local.sh
2022
env:
2123
OMP_NUM_THREADS: 1
2224
TF_INTRA_OP_PARALLELISM_THREADS: 1
2325
TF_INTER_OP_PARALLELISM_THREADS: 1
2426
LMP_CXX11_ABI_0: 1
27+
CMAKE_GENERATOR: Ninja
2528
# test lammps
2629
# ASE issue: https://gitlab.com/ase/ase/-/merge_requests/2843
2730
# TODO: remove ase version when ase has new release

.github/workflows/test_cuda.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
# manually trigger
3+
workflow_dispatch:
4+
pull_request:
5+
types:
6+
- "labeled"
7+
name: Test CUDA
8+
jobs:
9+
test_cuda:
10+
name: Test Python and C++ on CUDA
11+
runs-on: nvidia
12+
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA' || github.event_name == 'workflow_dispatch'
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.11'
18+
cache: 'pip'
19+
- name: Setup MPI
20+
uses: mpi4py/setup-mpi@v1
21+
with:
22+
mpi: mpich
23+
- uses: lukka/get-cmake@latest
24+
- run: |
25+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
26+
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
27+
&& sudo apt-get update \
28+
&& sudo apt-get -y install cuda-11-8 libcudnn8=8.9.5.*-1+cuda11.8
29+
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
30+
- run: pip install -v -e .[gpu,test,lmp,cu11] "ase @ https://github.com/rosswhitfield/ase/archive/edd03571aff6944b77b4a4b055239f3c3e4eeb66.zip"
31+
env:
32+
DP_BUILD_TESTING: 1
33+
DP_VARIANT: cuda
34+
CUDA_PATH: /usr/local/cuda-11.8
35+
- run: dp --version
36+
- run: pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0
37+
- run: source/install/test_cc_local.sh
38+
env:
39+
OMP_NUM_THREADS: 1
40+
TF_INTRA_OP_PARALLELISM_THREADS: 1
41+
TF_INTER_OP_PARALLELISM_THREADS: 1
42+
LMP_CXX11_ABI_0: 1
43+
CMAKE_GENERATOR: Ninja
44+
DP_VARIANT: cuda
45+
DP_USE_MPICH2: 1
46+
CUDA_PATH: /usr/local/cuda-11.8
47+
- run: |
48+
export LD_LIBRARY_PATH=${{ github.workspace }}/dp_test/lib:$CUDA_PATH/lib64:$LD_LIBRARY_PATH
49+
export PATH=${{ github.workspace }}/dp_test/bin:$PATH
50+
pytest -s --cov=deepmd source/lmp/tests
51+
pytest -s --cov=deepmd source/ipi/tests
52+
env:
53+
OMP_NUM_THREADS: 1
54+
TF_INTRA_OP_PARALLELISM_THREADS: 1
55+
TF_INTER_OP_PARALLELISM_THREADS: 1
56+
LAMMPS_PLUGIN_PATH: ${{ github.workspace }}/dp_test/lib/deepmd_lmp
57+
CUDA_PATH: /usr/local/cuda-11.8
58+
- uses: codecov/codecov-action@v3
59+
with:
60+
gcov: true

.github/workflows/test_python.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,43 @@ name: Test Python
55
jobs:
66
testpython:
77
name: Test Python
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-22.04
99
strategy:
1010
matrix:
1111
include:
1212
- python: 3.7
13-
gcc: 5
14-
tf: 1.14
15-
- python: 3.7
16-
gcc: 6
17-
tf: 1.14
18-
- python: 3.7
19-
gcc: 7
20-
tf: 1.14
21-
- python: 3.7
22-
gcc: 8
2313
tf: 1.14
2414
- python: 3.8
25-
gcc: 8
2615
tf:
2716
- python: "3.11"
28-
gcc: 8
2917
tf:
3018

31-
container: ghcr.io/deepmodeling/deepmd-kit-test-environment:py${{ matrix.python }}-gcc${{ matrix.gcc }}-tf${{ matrix.tf }}
3219
steps:
33-
- name: work around permission issue
34-
run: git config --global --add safe.directory /__w/deepmd-kit/deepmd-kit
35-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python }}
24+
cache: 'pip'
25+
- uses: mpi4py/setup-mpi@v1
26+
if: ${{ matrix.tf == '' }}
27+
with:
28+
mpi: openmpi
3629
# https://github.com/pypa/pip/issues/11770
3730
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
3831
- run: pip install -e .[cpu,test]
3932
env:
40-
CC: gcc-${{ matrix.gcc }}
41-
CXX: g++-${{ matrix.gcc }}
4233
TENSORFLOW_VERSION: ${{ matrix.tf }}
4334
DP_BUILD_TESTING: 1
35+
- run: pip install horovod mpi4py
36+
if: ${{ matrix.tf == '' }}
37+
env:
38+
HOROVOD_WITH_TENSORFLOW: 1
39+
HOROVOD_WITHOUT_GLOO: 1
4440
- run: dp --version
4541
- run: pytest --cov=deepmd --cov=deepmd_cli source/tests --durations=0
4642
- uses: codecov/codecov-action@v3
4743
with:
4844
gcov: true
49-
gcov_executable: gcov-${{ matrix.gcc }}
5045
pass:
5146
name: Pass testing Python
5247
needs: [testpython]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _skbuild
2222
deepmd_kit.egg-info/
2323
dist
2424
.eggs
25-
_version.py
25+
/deepmd/_version.py
2626
venv*
2727
.vscode/**
2828
_build

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)