Skip to content

Commit b32f74c

Browse files
njzjz-botOutisLi
andauthored
fix(lammps): register Kokkos plugin styles (#5988)
## Summary Backport `0004-register-lammps-kokkos-plugin-styles.patch` from `conda-forge/deepmd-kit-feedstock@d02138263b0b30629fe28c68c8bcecc2b8644513`. Runtime LAMMPS plugins do not consume the `PairStyle` declarations used by the built-in package machinery, so explicitly register: - `deepmd/kk` - `deepmd/kk/device` - `deepmd/kk/host` - `dpa4spin/kk` - `dpa4spin/kk/device` - `dpa4spin/kk/host` The newly registered Kokkos plugin styles are attributed to **Tiancheng Li** via `plugin.author`. ## Validation - Single-file change derived from the feedstock patch, with only the requested author attribution adjusted. - Existing non-Kokkos plugin author fields are unchanged. - Split from #5985 so plugin registration can be reviewed independently. - Full build/runtime validation is left to upstream CI. Agent: ChatGPT Model: GPT-5.6 Sol <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added Kokkos-enabled support for DeepMD and DPA-4Spin pair styles. - Added host and device runtime variants for improved compatibility across supported execution environments. - Registered additional pair-style aliases so these implementations can be selected through standard runtime configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Dependencies and follow-up validation Merge order: corrected #5987, then #5989, then this PR. The Kokkos registrations in this PR depend on the compatibility boundary from #5987 and the shared-runtime linkage from #5989. Validated the combined changes with `DEEPMD_LAMMPS_KOKKOS=ON`, `PKG_PLUGIN=ON`, and `PKG_KOKKOS=ON` against `stable_22Jul2025_update5`, `patch_10Sep2025`, and `patch_20Aug2026`. In every build, `plugin load` succeeded and `plugin list` reported all six aliases: `deepmd/kk`, `deepmd/kk/device`, `deepmd/kk/host`, `dpa4spin/kk`, `dpa4spin/kk/device`, and `dpa4spin/kk/host`. Coding agent: Codex Codex version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning effort: xhigh Co-authored-by: OutisLi <137472077+OutisLi@users.noreply.github.com>
1 parent 2bb3eed commit b32f74c

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

source/lmp/plugin/deepmdplugin.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include "deepmd_version.h"
88
#include "fix_dplr.h"
99
#include "lammpsplugin.h"
10+
#ifdef LMP_KOKKOS
11+
#include "pair_deepmd_kokkos.h"
12+
#include "pair_dpa4spin_kokkos.h"
13+
#endif
1014
#include "pair_deepmd.h"
1115
#include "pair_deepspin.h"
1216
#include "version.h"
@@ -19,6 +23,23 @@ using namespace LAMMPS_NS;
1923
static Pair* pairdeepmd(LAMMPS* lmp) { return new PairDeepMD(lmp); }
2024
static Pair* pairdeepspin(LAMMPS* lmp) { return new PairDeepSpin(lmp); }
2125

26+
#ifdef LMP_KOKKOS
27+
// Runtime plugins do not consume the PairStyle declarations used by LAMMPS'
28+
// built-in package machinery, so register each Kokkos alias explicitly.
29+
static Pair* pairdeepmdkokkosdevice(LAMMPS* lmp) {
30+
return new PairDeepMDKokkos<LMPDeviceType>(lmp);
31+
}
32+
static Pair* pairdeepmdkokkoshost(LAMMPS* lmp) {
33+
return new PairDeepMDKokkos<LMPHostType>(lmp);
34+
}
35+
static Pair* pairdpa4spinkokkosdevice(LAMMPS* lmp) {
36+
return new PairDPA4SpinKokkos<LMPDeviceType>(lmp);
37+
}
38+
static Pair* pairdpa4spinkokkoshost(LAMMPS* lmp) {
39+
return new PairDPA4SpinKokkos<LMPHostType>(lmp);
40+
}
41+
#endif
42+
2243
static Compute* computedeepmdtensoratom(LAMMPS* lmp, int narg, char** arg) {
2344
return new ComputeDeeptensorAtom(lmp, narg, arg);
2445
}
@@ -48,6 +69,37 @@ extern "C" void lammpsplugin_init(void* lmp, void* handle, void* regfunc) {
4869
plugin.handle = handle;
4970
(*register_plugin)(&plugin, lmp);
5071

72+
#ifdef LMP_KOKKOS
73+
plugin.version = LAMMPS_VERSION;
74+
plugin.style = "pair";
75+
plugin.name = "deepmd/kk";
76+
plugin.info = "deepmd Kokkos pair style " STR_GIT_SUMM;
77+
plugin.author = "Tiancheng Li";
78+
plugin.creator.v1 = (lammpsplugin_factory1*)&pairdeepmdkokkosdevice;
79+
plugin.handle = handle;
80+
(*register_plugin)(&plugin, lmp);
81+
82+
plugin.name = "deepmd/kk/device";
83+
(*register_plugin)(&plugin, lmp);
84+
85+
plugin.name = "deepmd/kk/host";
86+
plugin.creator.v1 = (lammpsplugin_factory1*)&pairdeepmdkokkoshost;
87+
(*register_plugin)(&plugin, lmp);
88+
89+
plugin.name = "dpa4spin/kk";
90+
plugin.info = "dpa4spin Kokkos pair style " STR_GIT_SUMM;
91+
plugin.author = "Tiancheng Li";
92+
plugin.creator.v1 = (lammpsplugin_factory1*)&pairdpa4spinkokkosdevice;
93+
(*register_plugin)(&plugin, lmp);
94+
95+
plugin.name = "dpa4spin/kk/device";
96+
(*register_plugin)(&plugin, lmp);
97+
98+
plugin.name = "dpa4spin/kk/host";
99+
plugin.creator.v1 = (lammpsplugin_factory1*)&pairdpa4spinkokkoshost;
100+
(*register_plugin)(&plugin, lmp);
101+
#endif
102+
51103
plugin.version = LAMMPS_VERSION;
52104
plugin.style = "pair";
53105
plugin.name = "deepspin";

0 commit comments

Comments
 (0)