Skip to content

Commit

Permalink
add refined code
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Nov 7, 2023
2 parents fc78e6d + a40dcaa commit 91a4df2
Show file tree
Hide file tree
Showing 787 changed files with 107,206 additions and 202,853 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
BasedOnStyle: Google
BinPackParameters: false
InsertBraces: true
...
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# do not show up detailed difference on GitHub
source/3rdparty/* linguist-generated=true
5 changes: 3 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Python:
- deepmd/**/*
- deepmd_cli/**/*
- source/tests/**/*
Docs: doc/**/*
Examples: examples/**/*
Core: source/lib/**/*
CUDA: source/lib/src/cuda/**/*
ROCM: source/lib/src/rocm/**/*
CUDA: source/lib/src/gpu/**/*
ROCM: source/lib/src/gpu/**/*
OP: source/op/**/*
C++: source/api_cc/**/*
C: source/api_c/**/*
Expand Down
34 changes: 34 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
changelog:
exclude:
authors:
- app/pre-commit-ci
- app/dependabot
categories:
- title: Breaking Changes
labels:
- "breaking change"
- title: New Features
labels:
- "new feature"
- title: Enhancement
labels:
- enhancement
- title: Documentation
labels:
# automatically added
- Docs
# for docs outside the doc directory
- "other docs"
exclude:
labels:
- build
- bug
- title: Build and release
labels:
- build
- title: Bug fixings
labels:
- bug
- title: Other Changes
labels:
- "*"
18 changes: 11 additions & 7 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,24 @@ jobs:
- variant: clang
dp_variant: clang
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: sudo apt-get update && sudo apt-get install -y nvidia-cuda-toolkit
- run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
&& sudo apt-get update \
&& sudo apt-get -y install cuda-cudart-dev-11-8 cuda-nvcc-11-8
if: matrix.variant == 'cuda'
- run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
&& sudo apt-get update \
&& sudo apt-get -y install cuda-12-0
&& sudo apt-get -y install cuda-cudart-dev-12-0 cuda-nvcc-12-0
if: matrix.variant == 'cuda120'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -44,19 +48,19 @@ jobs:
&& sudo apt-get update \
&& sudo apt-get install -y rocm-dev hipcub-dev
if: matrix.variant == 'rocm'
- run: sudo apt-get update && sudo apt-get install -y clang
if: matrix.variant == 'clang'
- run: source/install/build_cc.sh
env:
DP_VARIANT: ${{ matrix.dp_variant }}
DOWNLOAD_TENSORFLOW: "FALSE"
CMAKE_GENERATOR: Ninja
if: matrix.variant != 'clang'
- run: source/install/build_cc.sh
env:
DP_VARIANT: cpu
DOWNLOAD_TENSORFLOW: "FALSE"
CC: clang
CXX: clang++
CMAKE_GENERATOR: Ninja
if: matrix.variant == 'clang'
- name: Test files exist
run: |
Expand Down
80 changes: 68 additions & 12 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@ on:
pull_request:

jobs:
determine-arm64-runner:
runs-on: ubuntu-latest
permissions: read-all
outputs:
runner: ${{ steps.set-runner.outputs.runner }}
steps:
- name: Determine which runner to use for ARM64 build
id: set-runner
run: |
if [ "${{ github.repository_owner }}" == "deepmodeling" ]; then
echo "runner=[\"Linux\",\"ARM64\"]" >> $GITHUB_OUTPUT
else
echo "runner=\"ubuntu-latest\"" >> $GITHUB_OUTPUT
fi
build_wheels:
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
needs: determine-arm64-runner
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -22,27 +38,31 @@ jobs:
python: 311
platform_id: macosx_x86_64
dp_variant: cpu
# macos-arm64
- os: macos-latest
python: 311
platform_id: macosx_arm64
dp_variant: cpu
# win-64
- os: windows-2019
python: 311
platform_id: win_amd64
dp_variant: cpu
# linux-aarch64
- os: ubuntu-latest
- os: ${{ fromJson(needs.determine-arm64-runner.outputs.runner) }}
python: 310
platform_id: manylinux_aarch64
dp_variant: cpu
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
# https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
name: Setup QEMU
if: matrix.platform_id == 'manylinux_aarch64'
if: matrix.platform_id == 'manylinux_aarch64' && matrix.os == 'ubuntu-latest'
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.3
uses: pypa/cibuildwheel@v2.16
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: all
Expand All @@ -55,13 +75,14 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
cache: 'pip'
- run: python -m pip install build
- name: Build sdist
run: python -m build --sdist
Expand Down Expand Up @@ -89,32 +110,67 @@ jobs:
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: artifact
path: source/install/docker/dist
- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ghcr.io/deepmodeling/deepmd-kit

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: source/install/docker
push: ${{ github.repository_owner == 'deepmodeling' && github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build_pypi_index:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist/packages
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- run: pip install dumb-pypi
- run: |
ls dist/packages > package_list.txt
dumb-pypi --output-dir dist --packages-url ../../packages --package-list package_list.txt --title "DeePMD-kit Developed Packages"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: dist
deploy_pypi_index:
needs: build_pypi_index
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/devel' && github.repository_owner == 'deepmodeling'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

pass:
name: Pass testing build wheels
needs: [build_wheels, build_sdist]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Build C library
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Package C library
run: ./source/install/docker_package_c.sh
# for download and debug
Expand All @@ -30,7 +30,7 @@ jobs:
needs: [build_c]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/remove_test_cuda_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
pull_request_target:
types:
- "labeled"
name: Test CUDA
jobs:
remove_label:
permissions:
contents: read
pull-requests: write
# so one can re-trigger the workflow without manually removing the label
runs-on: ubuntu-latest
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA'
steps:
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: Test CUDA
number: ${{ github.event.pull_request.number }}
17 changes: 15 additions & 2 deletions .github/workflows/test_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ jobs:
name: Test C++
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: mpich
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: source/install/test_cc_local.sh
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
LMP_CXX11_ABI_0: 1
CMAKE_GENERATOR: Ninja
# test lammps
# ASE issue: https://gitlab.com/ase/ase/-/merge_requests/2843
# TODO: remove ase version when ase has new release
- run: |
python -m pip install -U pip
python -m pip install -e .[cpu,test,lmp]
python -m pip install -e .[cpu,test,lmp] "ase @ https://gitlab.com/ase/ase/-/archive/8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f/ase-8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f.tar.gz"
env:
DP_BUILD_TESTING: 1
- run: pytest --cov=deepmd source/lmp/tests
Expand All @@ -35,6 +40,14 @@ jobs:
TF_INTER_OP_PARALLELISM_THREADS: 1
LAMMPS_PLUGIN_PATH: ${{ github.workspace }}/dp_test/lib/deepmd_lmp
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib
# test ipi
- run: pytest --cov=deepmd source/ipi/tests
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
PATH: ${{ github.workspace }}/dp_test/bin:$PATH
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib
- uses: codecov/codecov-action@v3
with:
gcov: true
Expand Down
Loading

0 comments on commit 91a4df2

Please sign in to comment.