Skip to content

Commit 4acc858

Browse files
committed
fix: address installation skill review feedback
1 parent af14769 commit 4acc858

15 files changed

Lines changed: 939 additions & 151 deletions

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,12 @@ without directly linking every framework.
222222
> --skill deepmd-install -y
223223
> ```
224224
>
225-
> If direct GitHub access fails, use `gh-proxy.com` for a public, read-only
226-
> clone, then install from the local checkout. Do not send credentials or
227-
> private repository URLs through the proxy.
225+
> If direct GitHub access fails, clone the official Gitee mirror and install
226+
> from the local checkout:
228227
>
229228
> ```bash
230229
> git clone --depth 1 \
231-
> https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
230+
> https://gitee.com/deepmodeling/deepmd-kit.git \
232231
> deepmd-kit-skill-source
233232
> npx -y skills add ./deepmd-kit-skill-source/skills \
234233
> --skill deepmd-install -y

doc/agent-skills.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ npx -y skills add https://github.com/deepmodeling/deepmd-kit/tree/master/skills
7474
--skill '*' -y
7575
```
7676

77-
If direct GitHub access fails, use `gh-proxy.com` for a public, read-only clone
78-
and install from that checkout. Do not send credentials or private repository
79-
URLs through the proxy.
77+
If direct GitHub access fails, clone the official Gitee mirror and install from
78+
that checkout:
8079

8180
```bash
8281
git clone --depth 1 \
83-
https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
82+
https://gitee.com/deepmodeling/deepmd-kit.git \
8483
deepmd-kit-skill-source
8584
npx -y skills add ./deepmd-kit-skill-source/skills --skill '*' -y
8685
```

doc/install/install-with-agent.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ npx -y skills add https://github.com/deepmodeling/deepmd-kit/tree/master/skills
4040
--skill deepmd-install -y
4141
```
4242

43-
If direct GitHub access fails, use `gh-proxy.com` for a public, read-only clone
44-
and install from the local checkout. Do not send credentials or private
45-
repository URLs through the proxy.
43+
If direct GitHub access fails, clone the official Gitee mirror and install from
44+
the local checkout:
4645

4746
```bash
4847
git clone --depth 1 \
49-
https://gh-proxy.com/https://github.com/deepmodeling/deepmd-kit.git \
48+
https://gitee.com/deepmodeling/deepmd-kit.git \
5049
deepmd-kit-skill-source
5150
npx -y skills add ./deepmd-kit-skill-source/skills \
5251
--skill deepmd-install -y

skills/deepmd-install/SKILL.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: deepmd-install
3-
description: Install or rebuild DeePMD-kit with conda, pip, dp1s, offline packages, Docker, or a source checkout. Use for CPU, NVIDIA CUDA, or ROCm environments; PyTorch, TensorFlow, JAX, or Paddle backends; the C/C++ interface; and DeePMD-enabled LAMMPS, including Kokkos pair styles for DPA4 and DPA4C.
3+
description: Install or rebuild DeePMD-kit with conda, pip, dp1s, offline packages, Docker, or a source checkout. Use for CPU, NVIDIA CUDA, or ROCm environments; PyTorch, TensorFlow, JAX, or Paddle backends; backend-enabled C/C++ interfaces; and DeePMD-enabled LAMMPS, including Kokkos pair styles for DPA4 and DPA4C.
44
---
55

66
# Install DeePMD-kit
@@ -21,6 +21,10 @@ and verify the requested public interface rather than package presence alone.
2121
| source LAMMPS Kokkos CUDA | PyTorch graph artifacts: `deepmd/kk` for DPA4/SeZM and `dpa4spin/kk` for DPA4C |
2222
| ROCm source, Windows source, LAMMPS plugin mode | Follow the version-matched documentation in the selected checkout |
2323

24+
Backend-neutral C/C++ libraries with `ALLOW_NO_BACKEND=ON` are outside the
25+
automated plan. Follow `doc/install/install-from-source.md` in the selected
26+
checkout for that layout.
27+
2428
## Hard rules
2529

2630
1. Resolve the absolute directory containing this `SKILL.md` as `SKILL_ROOT`.
@@ -36,7 +40,8 @@ and verify the requested public interface rather than package presence alone.
3640
`conda activate` from a previous agent tool call.
3741
1. Render commands with concrete plan values. Stop if a plan placeholder,
3842
empty required value, unexpected path, or shell variable not assigned
39-
earlier in the same command block remains.
43+
earlier in the same command block remains. Keep each plan string in the
44+
quoted argument position shown by the selected reference.
4045
1. Never run `git reset --hard`, `git clean`, recursively remove an install
4146
prefix, or edit shell rc files as part of this workflow. Use a new build
4247
directory or versioned install prefix instead.
@@ -106,7 +111,7 @@ cannot leak across calls.
106111

107112
| Gate | Required evidence |
108113
| ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
109-
| Plan | `validate_plan.py` exits zero and prints the normalized plan |
114+
| Plan | `validate_plan.py` exits zero and prints a validation summary |
110115
| Environment | The selected package manager and absolute interpreter target the planned environment |
111116
| Python | `verify_python.py` passes for the selected backend and accelerator; source builds also match the expected build variant |
112117
| C/C++ | Expected libraries and headers exist, dynamic dependencies resolve, and the build cache records the requested accelerator/backend |

skills/deepmd-install/references/easy-install.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Do not mix conda, pip, offline, and `dp1s` installations in one prefix. Reuse
2222
an environment only when the user selected it and the probe found no conflicting
2323
DeePMD-kit install.
2424

25+
ROCm installations use the source workflow. Packaged LAMMPS and i-PI support
26+
TensorFlow, PyTorch, and JAX; do not add either extra to a Paddle environment.
27+
2528
For a new venv, create it first, resolve its absolute interpreter, update the
2629
plan, and re-run `validate_plan.py` before installing packages:
2730

@@ -112,30 +115,43 @@ printf '%s %s\n' "<sha256>" "<absolute-download-path>" | sha256sum --check -
112115
bash "<absolute-download-path>"
113116
```
114117

118+
For `package.artifact_path`, skip curl and verify the local file directly:
119+
120+
```bash
121+
printf '%s %s\n' "<sha256>" "<absolute-artifact-path>" | sha256sum --check -
122+
bash "<absolute-artifact-path>"
123+
```
124+
115125
Use `shasum -a 256` on systems without `sha256sum`. When a release is split,
116126
verify each part before concatenating it into a new file. Never execute an HTML
117127
error page or an artifact whose checksum is unknown.
118128

119129
## Docker
120130

121-
Pull the exact image reference from the plan and verify it in a disposable
122-
container:
131+
Pull the exact image reference from the plan:
123132

124133
```bash
125134
docker pull "<registry/image:tag-or-digest>"
126-
docker run --rm "<registry/image:tag-or-digest>" dp --version
127135
```
128136

129-
For CUDA, bind the physical GPU selected for the smoke test:
137+
Mount the verifier read-only and invoke the backend and accelerator selected by
138+
the plan:
130139

131140
```bash
132-
docker run --rm --gpus 'device=<physical-index>' \
141+
docker run --rm \
142+
--mount \
143+
type=bind,src="<absolute-skill-root>/scripts/verify_python.py",dst=/opt/deepmd-install/verify_python.py,readonly \
133144
"<registry/image:tag-or-digest>" \
134-
python -c "import torch; print(torch.cuda.get_device_name(0))"
145+
python /opt/deepmd-install/verify_python.py \
146+
--backend "<pytorch|tensorflow|jax|paddle>" \
147+
--accelerator "<cpu|cuda>" \
148+
--expected-version "<deepmd-version>"
135149
```
136150

137-
Add only user-selected volume mounts and working directories. Do not mount a
138-
home directory or source tree read-write merely for version verification.
151+
For CUDA, add `--gpus 'device=<physical-index>'` from the plan before the
152+
read-only mount. Omit `--expected-version` when the plan does not pin one. Add
153+
only user-selected volume mounts and working directories; never mount a home
154+
directory or source tree read-write for verification.
139155

140156
## Verification
141157

@@ -144,16 +160,20 @@ Run the backend-aware verifier with the absolute installed interpreter:
144160
```bash
145161
"<absolute-python>" "<absolute-skill-root>/scripts/verify_python.py" \
146162
--backend "<pytorch|tensorflow|jax|paddle>" \
147-
--accelerator "<cpu|cuda|rocm>"
163+
--accelerator "<cpu|cuda>" \
164+
--expected-version "<deepmd-version>" \
165+
--expected-prefix "<absolute-environment-prefix>"
148166
```
149167

168+
Omit `--expected-version` when `package.deepmd_version` is null.
169+
150170
For packaged host LAMMPS, resolve the executable and require the conventional
151171
host pair style:
152172

153173
```bash
154174
"<absolute-python>" "<absolute-skill-root>/scripts/verify_lammps.py" \
155175
--binary "<absolute-lammps-binary>" \
156-
--model-family conventional \
176+
--model-family "<package.lammps_model_family>" \
157177
--flavor host
158178
```
159179

skills/deepmd-install/references/failure-modes.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ current directory:
6565
test -f "<absolute-skill-root>/scripts/probe_env.py"
6666
test -f "<absolute-skill-root>/scripts/verify_python.py"
6767
test -f "<absolute-skill-root>/scripts/verify_lammps.py"
68+
test -f "<absolute-skill-root>/scripts/verify_native.py"
6869
```
6970

7071
Resolve the directory containing `SKILL.md`; do not search for a same-named
@@ -77,12 +78,27 @@ Use the backend-aware verifier and retain its complete output:
7778
```bash
7879
"<absolute-python>" "<absolute-skill-root>/scripts/verify_python.py" \
7980
--backend "<backend>" \
80-
--accelerator "<accelerator>"
81+
--accelerator "<accelerator>" \
82+
--expected-version "<deepmd-version>" \
83+
--expected-prefix "<absolute-environment-prefix>"
8184
```
8285

86+
Omit `--expected-version` when the plan does not pin a release.
87+
8388
Check visibility masks from the probe before replacing packages. A false GPU
8489
availability result may come from `CUDA_VISIBLE_DEVICES`,
8590
`HIP_VISIBLE_DEVICES`, a driver/runtime mismatch, or a CPU backend package.
91+
For a ROCm smoke test, inspect occupancy with `rocm-smi`, then bind the planned
92+
physical index in the same command:
93+
94+
```bash
95+
HIP_VISIBLE_DEVICES="<physical-index>" \
96+
ROCR_VISIBLE_DEVICES="<physical-index>" \
97+
"<absolute-python>" "<absolute-skill-root>/scripts/verify_python.py" \
98+
--backend "<backend>" \
99+
--accelerator rocm \
100+
--expected-prefix "<absolute-environment-prefix>"
101+
```
86102

87103
## Wrong compiled variant
88104

@@ -153,7 +169,10 @@ git -C "<absolute-source-directory>" rev-parse HEAD
153169
```
154170

155171
Use a separate clone when `HEAD`, remote, or local changes do not match the
156-
plan. Do not reset, clean, or rewrite the existing checkout.
172+
plan. Store the resolved SHA in `source.commit`, revalidate with
173+
`--require-resolved-source`, and pass the same SHA to
174+
`verify_python.py --expected-source-commit`. Do not reset, clean, or rewrite
175+
the existing checkout.
157176

158177
## Stale build directory
159178

@@ -181,7 +200,7 @@ from pathlib import Path
181200
import torch
182201
183202
print(Path(torch.__file__).resolve().parent / "lib")
184-
spec = find_spec("nvidia.nccl")
203+
spec = find_spec("nvidia.nccl") if find_spec("nvidia") is not None else None
185204
if spec is not None:
186205
for root in spec.submodule_search_locations or ():
187206
candidate = Path(root) / "lib"
@@ -277,3 +296,6 @@ printf '%s %s\n' "<sha256>" "<absolute-download-path>" | sha256sum --check -
277296
An HTML response, truncated split archive, unexpected top-level directory, or
278297
checksum mismatch requires a fresh artifact from the planned URL; it is not a
279298
reason to disable verification.
299+
300+
For `package.artifact_path`, skip curl and run the same file-type and checksum
301+
checks directly on the absolute local path.

skills/deepmd-install/references/plan-schema.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ Use `null` for an inapplicable object. Do not add undeclared keys.
8282
"install_lammps": false,
8383
"install_ipi": false,
8484
"artifact_url": null,
85+
"artifact_path": null,
8586
"sha256": null,
86-
"docker_image": null
87+
"docker_image": null,
88+
"lammps_model_family": null
8789
}
8890
```
8991

@@ -92,8 +94,11 @@ Use `null` for an inapplicable object. Do not add undeclared keys.
9294
- Keep the two DeePMD-kit index fields null for the default package index.
9395
Record a user-selected mirror or the documented pre-release index explicitly.
9496
- Keep `backend_index_url` null when the default package index is intended.
95-
- Require `artifact_url` and `sha256` for `offline`.
97+
- Package indexes and download URLs use HTTPS.
98+
- Require exactly one of HTTPS `artifact_url` or absolute `artifact_path`, plus
99+
`sha256`, for `offline`.
96100
- Require an immutable image reference or user-selected tag for `docker`.
101+
- Require `lammps_model_family` for packaged LAMMPS verification.
97102

98103
### `source`
99104

@@ -102,12 +107,14 @@ Use `null` for an inapplicable object. Do not add undeclared keys.
102107
"directory": "/absolute/path/to/deepmd-kit",
103108
"remote": "https://github.com/deepmodeling/deepmd-kit.git",
104109
"ref": "master",
110+
"commit": null,
105111
"editable": false
106112
}
107113
```
108114

109-
Treat `ref` as an opaque Git ref. Resolve it to a commit and record that commit
110-
in the completion report. Do not reset or clean an existing checkout.
115+
Treat `ref` as an opaque Git ref. Resolve it to a commit, store the SHA in
116+
`commit`, and revalidate the plan before building. Do not reset or clean an
117+
existing checkout.
111118

112119
### `build`
113120

@@ -178,9 +185,9 @@ For a JAX C++ backend, provide either `tensorflow_root` or
178185
}
179186
```
180187

181-
Require a physical GPU index for a CUDA smoke test. Keep `gpu` null for CPU.
182-
The example path must belong to the selected source checkout or be explicitly
183-
provided by the user.
188+
Require a physical GPU index for CUDA and ROCm smoke tests. Keep `gpu` null for
189+
CPU. The example path must belong to the selected source checkout or be
190+
explicitly provided by the user.
184191

185192
## Validation rules
186193

@@ -192,8 +199,11 @@ The validator enforces these invariants:
192199
and a CUDA build.
193200
1. DPA4C maps to `dpa4spin`/`dpa4spin/kk`; other families map to
194201
`deepmd`/`deepmd/kk`.
195-
1. Source directories, build directories, and install prefixes are distinct.
202+
1. DeePMD, C/C++, and LAMMPS source/build/install paths are distinct.
196203
1. Checksums contain exactly 64 hexadecimal characters.
204+
1. Easy-install methods reject ROCm and Paddle packaged LAMMPS/i-PI.
205+
1. Embedded placeholders, control characters, and POSIX-template escape
206+
characters fail before command rendering.
197207
1. Unknown keys and unsupported combinations fail before any state change.
198208

199209
## Examples
@@ -224,8 +234,10 @@ The validator enforces these invariants:
224234
"install_lammps": false,
225235
"install_ipi": false,
226236
"artifact_url": null,
237+
"artifact_path": null,
227238
"sha256": null,
228-
"docker_image": null
239+
"docker_image": null,
240+
"lammps_model_family": null
229241
},
230242
"source": null,
231243
"build": null,
@@ -265,13 +277,16 @@ The validator enforces these invariants:
265277
"install_lammps": false,
266278
"install_ipi": false,
267279
"artifact_url": null,
280+
"artifact_path": null,
268281
"sha256": null,
269-
"docker_image": null
282+
"docker_image": null,
283+
"lammps_model_family": null
270284
},
271285
"source": {
272286
"directory": "/work/deepmd-kit",
273287
"remote": "https://github.com/deepmodeling/deepmd-kit.git",
274288
"ref": "master",
289+
"commit": null,
275290
"editable": false
276291
},
277292
"build": {

skills/deepmd-install/references/source-cpp.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Build the C/C++ interface only after the Python/backend gate passes. Use
55
CMake options supported by that ref. The published documentation is
66
<https://docs.deepmodeling.com/projects/deepmd/en/latest/install/install-from-source.html>.
77

8+
This workflow builds a backend-enabled C/C++ interface. For backend-neutral
9+
`libdeepmd_cc`/`libdeepmd_c`, follow the checkout documentation and its explicit
10+
`ALLOW_NO_BACKEND=ON` contract.
11+
812
## Contents
913

1014
- [Build-directory gate](#build-directory-gate)
@@ -131,9 +135,9 @@ Use the platform library suffix on macOS or Windows. On Linux, fail if any
131135
installed DeePMD library has an unresolved dynamic dependency:
132136

133137
```bash
134-
for library in "<absolute-prefix>"/lib/libdeepmd*.so; do
135-
ldd "$library"
136-
done
138+
"<absolute-python>" "<absolute-skill-root>/scripts/verify_native.py" \
139+
--directory "<absolute-prefix>/lib" \
140+
--pattern 'libdeepmd*.so*'
137141
```
138142

139143
Finally compile and run a public C++ API probe inside the build directory:

skills/deepmd-install/references/source-lammps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ from pathlib import Path
135135
import torch
136136
137137
paths = [Path(torch.__file__).resolve().parent / "lib"]
138-
spec = find_spec("nvidia.nccl")
138+
spec = find_spec("nvidia.nccl") if find_spec("nvidia") is not None else None
139139
if spec is not None:
140140
for root in spec.submodule_search_locations or ():
141141
candidate = Path(root) / "lib"

skills/deepmd-install/references/source-python.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ git -C "<absolute-source-directory>" checkout --detach \
2828
git -C "<absolute-source-directory>" rev-parse HEAD
2929
```
3030

31+
Store the resolved SHA in `source.commit` and re-run `validate_plan.py` with
32+
`--require-resolved-source` before installing backend packages or building
33+
DeePMD-kit.
34+
3135
For an existing checkout, inspect it without changing its branch, remotes, or
3236
working tree:
3337

@@ -177,9 +181,12 @@ cd "<absolute-neutral-directory>" &&
177181
"<absolute-python>" "<absolute-skill-root>/scripts/verify_python.py" \
178182
--backend "<pytorch|tensorflow|jax|paddle>" \
179183
--accelerator "<cpu|cuda|rocm>" \
184+
--expected-prefix "<absolute-environment-prefix>" \
185+
--expected-source-commit "<resolved-source-commit>" \
180186
--expected-build-variant "<cpu|cuda|rocm>"
181187
```
182188

183-
Add `--expect-custom-op` for a PyTorch source build. Add `--expect-nv` and
184-
`--expect-vesin` only when their platform markers and the plan require them.
185-
Do not continue to the C/C++ gate until every requested check passes.
189+
Add `--expected-version "<deepmd-version>"` when the plan pins a release. Add
190+
`--expect-custom-op` for a PyTorch source build. Add `--expect-nv` and
191+
`--expect-vesin` only when their platform markers and the plan require them. Do
192+
not continue to the C/C++ gate until every requested check passes.

0 commit comments

Comments
 (0)