-
Notifications
You must be signed in to change notification settings - Fork 648
132 lines (132 loc) · 5.65 KB
/
Copy pathtest_cc.yml
File metadata and controls
132 lines (132 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
on:
push:
branches-ignore:
- "gh-readonly-queue/**"
- "copilot/**"
- "dependabot/**"
- "pre-commit-ci-update-config"
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
name: Test C++
jobs:
testcc:
name: Test C++
runs-on: ${{ matrix.check_memleak == false && github.repository_owner == 'deepmodeling' && 'cpu' || 'ubuntu-22.04' }}
# Paddle's external interface download is occasionally unavailable. Keep
# exercising these configurations without making that outage blocking.
continue-on-error: ${{ matrix.enable_paddle }}
strategy:
# An allowed Paddle failure must not cancel the other backend jobs.
fail-fast: false
matrix:
# Only regular jobs run the LAMMPS tests. Use self-hosted CPU runners
# for those jobs in deepmodeling, with a hosted fallback for forks.
include:
- check_memleak: true
enable_tensorflow: true
enable_pytorch: true
enable_paddle: false
- check_memleak: true
enable_tensorflow: false
enable_pytorch: false
enable_paddle: true
- check_memleak: false
enable_tensorflow: true
enable_pytorch: true
enable_paddle: false
- check_memleak: false
enable_tensorflow: false
enable_pytorch: false
enable_paddle: true
steps:
- uses: actions/checkout@v7
- name: Install GCC
run: |
sudo apt-get update
sudo apt-get install --yes build-essential
if: ${{ matrix.check_memleak == false && github.repository_owner == 'deepmodeling' }}
- uses: actions/setup-python@v7
with:
python-version: "3.11"
cache: "pip"
- uses: lukka/get-cmake@latest
- run: python -m pip install uv
- name: Install Python dependencies
run: |
source/install/uv_with_retry.sh pip install --system --group pin_tensorflow_cpu --group pin_pytorch_cpu --group pin_jax_cpu --torch-backend cpu
export TENSORFLOW_ROOT=$(python -c 'import importlib.util,pathlib;print(pathlib.Path(importlib.util.find_spec("tensorflow").origin).parent)')
export PYTORCH_ROOT=$(python -c 'import torch;print(torch.__path__[0])')
source/install/uv_with_retry.sh pip install --system -e .[cpu,test,lmp,jax,torch] mpi4py mpich
env:
DP_ENABLE_PYTORCH: 1
- name: Convert models
run: source/tests/infer/convert-models.sh
# https://github.com/actions/runner-images/issues/9491
- name: Fix kernel mmap rnd bits
run: sudo sysctl vm.mmap_rnd_bits=28
if: ${{ matrix.check_memleak }}
- run: |
source/install/test_cc_local.sh
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
CMAKE_GENERATOR: Ninja
CXXFLAGS: ${{ matrix.check_memleak && '-fsanitize=leak' || '' }}
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/workflows/suppr.txt
ENABLE_TENSORFLOW: ${{ matrix.enable_tensorflow && 'TRUE' || 'FALSE' }}
ENABLE_PYTORCH: ${{ matrix.enable_pytorch && 'TRUE' || 'FALSE' }}
ENABLE_PADDLE: ${{ matrix.enable_paddle && 'TRUE' || 'FALSE' }}
# test lammps
- run: |
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/paddle/lib/*.so ${{ github.workspace }}/dp_test/lib/
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/onednn/lib/* ${{ github.workspace }}/dp_test/lib/
cp ${{ github.workspace }}/source/build_tests/paddle_inference_install_dir/third_party/install/mklml/lib/* ${{ github.workspace }}/dp_test/lib/
if: matrix.enable_paddle
- run: |
export LD_LIBRARY_PATH=${{ github.workspace }}/dp_test/lib:$LD_LIBRARY_PATH
source/install/retry_on_sigterm.sh 3 pytest --cov=deepmd source/lmp/tests
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
LAMMPS_PLUGIN_PATH: ${{ github.workspace }}/dp_test/lib/deepmd_lmp
ENABLE_TENSORFLOW: ${{ matrix.enable_tensorflow && '1' || '0' }}
ENABLE_PYTORCH: ${{ matrix.enable_pytorch && '1' || '0' }}
ENABLE_JAX: ${{ matrix.enable_tensorflow && '1' || '0' }}
ENABLE_PADDLE: ${{ matrix.enable_paddle && '1' || '0' }}
if: ${{ !matrix.check_memleak }}
# test ipi
- run: |
export PATH=${{ github.workspace }}/dp_test/bin:$PATH
pytest --cov=deepmd source/ipi/tests
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
LD_LIBRARY_PATH: ${{ github.workspace }}/dp_test/lib
ENABLE_TENSORFLOW: ${{ matrix.enable_tensorflow && '1' || '0' }}
ENABLE_PYTORCH: ${{ matrix.enable_pytorch && '1' || '0' }}
ENABLE_JAX: ${{ matrix.enable_tensorflow && '1' || '0' }}
ENABLE_PADDLE: ${{ matrix.enable_paddle && '1' || '0' }}
if: ${{ !matrix.check_memleak }}
- name: Upload coverage to Codecov (non-blocking)
uses: codecov/codecov-action@v7
continue-on-error: true
with:
use_oidc: true
permissions:
id-token: write
pass:
name: Pass testing C++
needs: [testcc]
runs-on: ubuntu-slim
if: always()
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}