|
| 1 | +--- |
| 2 | +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. |
| 4 | +--- |
| 5 | + |
| 6 | +# Install DeePMD-kit |
| 7 | + |
| 8 | +Install the smallest runtime that satisfies the user's goal. Probe first, keep |
| 9 | +all decisions in a validated plan, execute one self-contained gate at a time, |
| 10 | +and verify the requested public interface rather than package presence alone. |
| 11 | + |
| 12 | +## Supported workflows |
| 13 | + |
| 14 | +| Path | Scope | |
| 15 | +| ----------------------------------------------- | ---------------------------------------------------------------------------------------------- | |
| 16 | +| conda, pip | Stable Python installs for PyTorch, TensorFlow, JAX, and Paddle; optional packaged host LAMMPS | |
| 17 | +| `dp1s`, offline package, Docker | Official release artifacts selected by the user or matching documentation | |
| 18 | +| source Python | PyTorch, TensorFlow, JAX, and Paddle with backend-specific dependencies and verification | |
| 19 | +| source C/C++ | Backend-enabled C/C++ libraries installed into a dedicated prefix | |
| 20 | +| source LAMMPS host | Built-in DeePMD module with exact pair-style verification | |
| 21 | +| source LAMMPS Kokkos CUDA | PyTorch graph artifacts: `deepmd/kk` for DPA4/SeZM and `dpa4spin/kk` for DPA4C | |
| 22 | +| ROCm source, Windows source, LAMMPS plugin mode | Follow the version-matched documentation in the selected checkout | |
| 23 | + |
| 24 | +## Hard rules |
| 25 | + |
| 26 | +1. Resolve the absolute directory containing this `SKILL.md` as `SKILL_ROOT`. |
| 27 | + Invoke every bundled script through that absolute path. |
| 28 | +1. Run the read-only probe before choosing versions, paths, or accelerators. |
| 29 | +1. Ask only for a missing value that changes the selected path. Do not ask |
| 30 | + source, compiler, CUDA, or LAMMPS questions for an unrelated easy install. |
| 31 | +1. Record all decisions in `install-plan.json` and validate it before an |
| 32 | + install, checkout, compile, download, or environment modification. |
| 33 | +1. Use the plan's absolute Python executable. Never substitute a bare |
| 34 | + `python`, `pip`, or an assumed conda activation. |
| 35 | +1. Make every shell call self-contained. Do not rely on an `export`, `cd`, or |
| 36 | + `conda activate` from a previous agent tool call. |
| 37 | +1. Render commands with concrete plan values. Stop if a plan placeholder, |
| 38 | + empty required value, unexpected path, or shell variable not assigned |
| 39 | + earlier in the same command block remains. |
| 40 | +1. Never run `git reset --hard`, `git clean`, recursively remove an install |
| 41 | + prefix, or edit shell rc files as part of this workflow. Use a new build |
| 42 | + directory or versioned install prefix instead. |
| 43 | +1. Use documentation from the selected checkout for version-sensitive source |
| 44 | + options. Do not apply `latest` documentation blindly to an older ref. |
| 45 | +1. Confirm before piping a remote script to a shell. Use fail-on-HTTP-error |
| 46 | + downloads and verify a checksum whenever the plan contains one. |
| 47 | +1. Check GPU occupancy and bind the confirmed physical device explicitly |
| 48 | + before a GPU smoke test. |
| 49 | +1. On failure, stop the current gate and read |
| 50 | + [`references/failure-modes.md`](references/failure-modes.md). Do not restart |
| 51 | + the entire install or wipe caches. |
| 52 | + |
| 53 | +## Workflow |
| 54 | + |
| 55 | +### 0. Probe |
| 56 | + |
| 57 | +Run with an available Python 3.10+ interpreter: |
| 58 | + |
| 59 | +```bash |
| 60 | +"<absolute-python>" "<absolute-skill-root>/scripts/probe_env.py" --json |
| 61 | +``` |
| 62 | + |
| 63 | +Use the report to identify the OS, libc, Python environments, compilers, |
| 64 | +toolkits, driver, GPU compute capabilities and visibility mask, disk/RAM, and |
| 65 | +existing DeePMD-kit/PyTorch installs. The probe does not select versions. |
| 66 | + |
| 67 | +### 1. Select one path |
| 68 | + |
| 69 | +- Prefer an easy method for a stable release without local source changes, |
| 70 | + custom C/C++ libraries, or Kokkos device pair styles. |
| 71 | +- Use source Python for a branch/fork, unreleased feature, local toolkit build, |
| 72 | + or customized OPs. |
| 73 | +- Add source C/C++ only when a C/C++ client, source-built LAMMPS, or i-PI needs |
| 74 | + it. |
| 75 | +- Add source LAMMPS only after the C/C++ gate passes. |
| 76 | + |
| 77 | +### 2. Create and validate the plan |
| 78 | + |
| 79 | +Read [`references/plan-schema.md`](references/plan-schema.md), write the plan to |
| 80 | +a stable scratch path outside the source/build trees, and validate it: |
| 81 | + |
| 82 | +```bash |
| 83 | +"<absolute-python>" "<absolute-skill-root>/scripts/validate_plan.py" \ |
| 84 | + "<absolute-plan-path>" |
| 85 | +``` |
| 86 | + |
| 87 | +Present a concise summary only when the request or probe leaves a meaningful |
| 88 | +choice unresolved. If the user already specified the method, backend, version, |
| 89 | +and target, proceed without asking them to reconfirm their own request. |
| 90 | + |
| 91 | +### 3. Execute the selected references |
| 92 | + |
| 93 | +| Selection | Read | |
| 94 | +| ----------------------------------- | ------------------------------------------------------------ | |
| 95 | +| conda, pip, `dp1s`, offline, Docker | [`references/easy-install.md`](references/easy-install.md) | |
| 96 | +| source Python | [`references/source-python.md`](references/source-python.md) | |
| 97 | +| source C/C++ | [`references/source-cpp.md`](references/source-cpp.md) | |
| 98 | +| source LAMMPS | [`references/source-lammps.md`](references/source-lammps.md) | |
| 99 | +| failed gate | [`references/failure-modes.md`](references/failure-modes.md) | |
| 100 | + |
| 101 | +Read only the references required by the plan. Within each gate, render one |
| 102 | +command block with absolute values so that directory and environment state |
| 103 | +cannot leak across calls. |
| 104 | + |
| 105 | +### 4. Enforce the gates |
| 106 | + |
| 107 | +| Gate | Required evidence | |
| 108 | +| ----------- | --------------------------------------------------------------------------------------------------------------------------------- | |
| 109 | +| Plan | `validate_plan.py` exits zero and prints the normalized plan | |
| 110 | +| Environment | The selected package manager and absolute interpreter target the planned environment | |
| 111 | +| Python | `verify_python.py` passes for the selected backend and accelerator; source builds also match the expected build variant | |
| 112 | +| C/C++ | Expected libraries and headers exist, dynamic dependencies resolve, and the build cache records the requested accelerator/backend | |
| 113 | +| LAMMPS | `verify_lammps.py` finds the exact pair styles required by the model family and no unresolved dynamic dependency | |
| 114 | +| Smoke | The selected short example finishes on the explicitly bound device and emits its documented success signal | |
| 115 | + |
| 116 | +For PyTorch source builds, install the intended PyTorch before DeePMD-kit and |
| 117 | +use `--no-build-isolation`. Set both `DP_ENABLE_PYTORCH` and |
| 118 | +`DP_ENABLE_TENSORFLOW` explicitly in the same command that invokes pip. |
| 119 | + |
| 120 | +## LAMMPS model contract |
| 121 | + |
| 122 | +| Model/runtime | Host pair style | Kokkos CUDA pair style | Artifact requirement | |
| 123 | +| ------------------- | --------------- | ----------------------------------------------------------- | --------------------------------------------------------- | |
| 124 | +| conventional models | `deepmd` | `deepmd/kk` when the model supports device edge/graph input | Compatible frozen model; `/kk` requires edge/graph `.pt2` | |
| 125 | +| DPA4 / SeZM | `deepmd` | `deepmd/kk` | Target-specific graph `.pt2` | |
| 126 | +| DPA4C native spin | `dpa4spin` | `dpa4spin/kk` | `atom_style spin` and compact canonical graph `.pt2` | |
| 127 | + |
| 128 | +Do not accept `deepmd/kk` as proof that DPA4C is available. Do not substitute |
| 129 | +LAMMPS `PKG_GPU` for Kokkos. |
| 130 | + |
| 131 | +## Completion report |
| 132 | + |
| 133 | +Report: |
| 134 | + |
| 135 | +- plan path and resolved source commit, when applicable; |
| 136 | +- environment activation or absolute Python path; |
| 137 | +- installed DeePMD-kit/backend versions and accelerator visibility; |
| 138 | +- C/C++ prefix and LAMMPS binary, when applicable; |
| 139 | +- each gate command and observed result; |
| 140 | +- any validation gate that was not run and the concrete reason; |
| 141 | +- no claim of success beyond the gates that actually passed. |
0 commit comments