Repository navigation
142 lines (142 loc) · 5.45 KB
/
Copy pathbuild_cc.yml
File metadata and controls
142 lines (142 loc) · 5.45 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
133
134
135
136
137
138
139
140
141
142
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: Build C++
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:
- variant: cpu
dp_variant: cpu
- variant: cuda120
dp_variant: cuda
- variant: rocm
dp_variant: rocm
- variant: clang
dp_variant: clang
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- uses: lukka/get-cmake@latest
- run: python -m pip install uv
- run: source/install/uv_with_retry.sh pip install --system --group pin_tensorflow_cpu --group pin_pytorch_cpu --torch-backend cpu
- 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-12-2 cuda-nvcc-12-2
if: matrix.variant == 'cuda120'
env:
DEBIAN_FRONTEND: noninteractive
- run: |
echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/6.3/ jammy main' | sudo tee /etc/apt/sources.list.d/rocm.list \
&& printf 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600 \
&& curl -s https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add - \
&& 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.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
env:
DP_VARIANT: cpu
DOWNLOAD_TENSORFLOW: "FALSE"
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 &&
test -f dp/lib/libdeepmd_cc.so &&
test -f dp/lib/libdeepmd_c.so &&
test -f dp/lib/libdeepmd_op.so &&
test -f dp/lib/libdeepmd_ipi.so &&
test -f dp/lib/libdeepmd_lmp.so &&
test -f dp/lib/libdeepmd.so
pass:
name: Pass building C++
needs: [buildcc]
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) }}