Skip to content

fix(lammps): support 2025 Kokkos API - #5987

Merged
OutisLi merged 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/lammps-2025-kokkos-api
Aug 28, 2026
Merged

fix(lammps): support 2025 Kokkos API#5987
OutisLi merged 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/lammps-2025-kokkos-api

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport 0002-support-lammps-2025-kokkos-api.patch from conda-forge/deepmd-kit-feedstock@d02138263b0b30629fe28c68c8bcecc2b8644513.

Support both the LAMMPS 22Jul2025 Kokkos API and newer LAMMPS releases by selecting the appropriate reverse-communication buffer and per-atom energy accumulator types from LAMMPS_VERSION_NUMBER.

Validation

Agent: ChatGPT
Model: GPT-5.6 Sol

Summary by CodeRabbit

  • Compatibility

    • Improved support across multiple LAMMPS versions for Kokkos-based DeepMD and DPA-4-spin simulations.
    • Updated reverse communication and per-atom energy handling to use version-compatible data formats.
  • Bug Fixes

    • Resolved compatibility issues that could affect reverse communication and energy accumulation across LAMMPS releases.
    • Preserved existing force, magnetic-force, and virial calculation behavior.

Backport conda-forge/deepmd-kit-feedstock patch 0002 at d02138263b0b30629fe28c68c8bcecc2b8644513.

Agent: ChatGPT
Model: GPT-5.6 Sol
@njzjz
njzjz requested a review from OutisLi August 22, 2026 19:16
@njzjz
njzjz marked this pull request as ready for review August 22, 2026 19:16
Copilot AI lite review requested due to automatic review settings August 22, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6de0aa4-9468-4e7e-8381-76e52b2a54b7

📥 Commits

Reviewing files that changed from the base of the PR and between a119bd0 and 044d75b.

📒 Files selected for processing (2)
  • source/lmp/pair_deepmd_kokkos.h
  • source/lmp/pair_dpa4spin_kokkos.h

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Kokkos compatibility updates

Layer / File(s) Summary
DeepMD compatibility types and methods
source/lmp/pair_deepmd_kokkos.h, source/lmp/pair_deepmd_kokkos.cpp
DeepMD selects communication-buffer and per-atom energy accumulator types by LAMMPS version. Reverse-communication declarations and definitions use the buffer alias.
DPA4Spin compatibility types and methods
source/lmp/pair_dpa4spin_kokkos.h, source/lmp/pair_dpa4spin_kokkos.cpp
DPA4Spin selects communication-buffer and per-atom energy accumulator types by LAMMPS version. Reverse-communication definitions use the buffer alias.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 044d7

This PR updates LAMMPS Kokkos compatibility in a localized set of files without any identified merge-blocking correctness, security, availability, or deployment risk; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: outisli

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for the 2025 LAMMPS Kokkos API.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.84%. Comparing base (8cfd46e) to head (044d75b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5987      +/-   ##
==========================================
- Coverage   79.10%   78.84%   -0.26%     
==========================================
  Files        1105     1105              
  Lines      130981   130981              
  Branches     4771     4765       -6     
==========================================
- Hits       103609   103271     -338     
- Misses      25686    26027     +341     
+ Partials     1686     1683       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutisLi OutisLi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compatibility cutoff is incorrect. Both headers select the legacy tdual_xfloat_1d reverse-communication signature and legacy energy accumulator types for every LAMMPS version before 20260704, but the official patch_10Sep2025 release already uses DAT::tdual_double_1d in KokkosBase and provides ttransform_kkacc_1d / t_kkacc_1d; the same APIs remain in patch_10Dec2025, patch_11Feb2026, and patch_30Mar2026. Consequently those releases take the wrong branch, and the override declarations do not match the base virtual functions, causing compilation to fail for both deepmd/kk and dpa4spin/kk. Please use the actual API-introduction boundary (the released-tag evidence points to 20250910) and validate at least stable_22Jul2025_update5, patch_10Sep2025, and the current LAMMPS release.

Use the 10Sep2025 release as the boundary for the double reverse-communication buffer and transformed energy accumulator APIs.

Coding-Agent: Codex
Codex-Version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@njzjz

njzjz commented Aug 23, 2026

Copy link
Copy Markdown
Member

Addressed in 044d75b4e. Both Kokkos compatibility checks now use the actual API boundary, LAMMPS_VERSION_NUMBER < 20250910, so stable_22Jul2025_update5 selects the legacy buffer/accumulator types while patch_10Sep2025 and newer select DAT::tdual_double_1d, ttransform_kkacc_1d, and t_kkacc_1d.

I validated the combined #5987, #5989, and #5988 changes with PKG_PLUGIN=ON, PKG_KOKKOS=ON, and DEEPMD_LAMMPS_KOKKOS=ON against:

  • stable_22Jul2025_update5
  • patch_10Sep2025
  • patch_20Aug2026 (current tag; its LAMMPS version header reports 4 Jul 2026)

Both pair_deepmd_kokkos.cpp and pair_dpa4spin_kokkos.cpp compiled successfully in all three builds. Each resulting plugin also loaded successfully under Kokkos and plugin list reported all six Kokkos aliases.

Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

@njzjz
njzjz requested a review from OutisLi August 23, 2026 13:46
@OutisLi
OutisLi added this pull request to the merge queue Aug 28, 2026
Merged via the queue into deepmodeling:master with commit 2bb3eed Aug 28, 2026
58 checks passed
pull Bot pushed a commit to ishandutta2007/deepmd-kit that referenced this pull request Aug 29, 2026
## 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 deepmodeling#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 deepmodeling#5987, then deepmodeling#5989, then this PR. The Kokkos
registrations in this PR depend on the compatibility boundary from deepmodeling#5987
and the shared-runtime linkage from deepmodeling#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants