Repository navigation
Conversation
Preserve the default precession convention and expose Cartesian -dE/dS for native-spin integrators. Replace algebra-only checks with mandatory LAMMPS adapter finite differences, zero/tiny-moment, scaling and parser regressions. Scope the PyTorch CPU SIMD workaround to the test fixture. Based on the implementation in deepmodeling#6078. Co-authored-by: OutisLi-Bot <44916828+OutisLi-Bot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Add a separate compressed canonical fixture and explicit /kk integration coverage for zero, tiny and finite moments, one/two MPI ranks, scaling and overlay accumulation. Build matching CUDA Kokkos LAMMPS/plugin in the opt-in CUDA job and require all test prerequisites. Keep the repository's one-shot CUDA label trigger unchanged. GPU runtime and finite-difference acceptance remain for the CUDA runner.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6084 +/- ##
==========================================
+ Coverage 77.79% 77.83% +0.03%
==========================================
Files 1171 1171
Lines 141562 141607 +45
Branches 5066 5072 +6
==========================================
+ Hits 110135 110216 +81
+ Misses 29550 29454 -96
- Partials 1877 1937 +60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Implements #6077 and supersedes #6078. This revision builds on the original implementation by @OutisLi-Bot (credited in the commit), rebases it onto current master, and replaces the weak/optional regression checks with tests of the actual LAMMPS adapter.
magnetic_force precessionremains the default and preserves the existing moment/hbarconversion.magnetic_force cartesianstores-dE/dSwith the energy-per-model-spin conversion, including zero moments; currently requiresunits metal.Pair::extract("fm_cartesian_force", dim)exposes a scalar integer (dim == 0, precession = 0, Cartesian = 1).Regression coverage and CI repair
The new adapter tests check all three Cartesian components against energy finite differences at zero, tiny (
1e-8), and finite moments; default/explicit precession equivalence; nonmagnetic atoms; unchanged mechanical force/energy; pair scaling and repeated compute; extraction; invalid/missing/duplicate options; and non-metal rejection. PyTorch-enabled LAMMPS CI explicitly requires the model fixture, bindings, and plugin registration instead of silently skipping them.The previous C++ CI failure was reproduced with PyTorch 2.11 and
OMP_NUM_THREADS=1: CPU SIMD gather codegen references an undeclaredtmp42. Disabling loop-tail vectorization still fails. A scopedcpp.simdlen=1context around this small test-fixture export only avoids the defect. Production export settings and CUDA device selection are unchanged, and the setting is restored afterward.CUDA Kokkos regression
The CUDA C++ job uses the same Python-prefix MPICH distribution for mpi4py, DeePMD, LAMMPS, plugins, and launcher. Ubuntu 24.04's MPICH package can start independent singleton worlds (upstream report); avoiding it also removes its leaked host-LTO compiler flags, so the earlier job-local NVCC workaround is no longer needed. An early two-rank probe checks communicator size, rank gathering, and actual MPI library paths before the long model/build stages. The integration runner also checks the requested rank count against both mpi4py and native LAMMPS.
The CUDA job now separately builds matching Kokkos-enabled LAMMPS and plugin libraries, exports a compressed float32 canonical native-spin archive, and runs explicit
atom_style spin/kk,pair_style dpa4spin/kk, andrun_style verlet/kkwith Kokkos enabled. The required test mode fails on missing CUDA, MPI, fixture, or plugin prerequisites. The ordinary host test suite does not silently substitute for this test.The new regression compares the same canonical archive through the host adapter and one-/two-rank GPU adapters: all atom-ID-ordered magnetic forces, mechanical forces, and total energy; convention extraction; default/explicit precession; zero, tiny, and finite moments; repeated compute, pair scaling, and two-style hybrid/overlay accumulation. The two-rank system has interacting atoms on both sides of its domain boundary. Tiny-moment precession is normalized before comparison, and a live zero-moment Cartesian gradient makes a forced-precession kernel fail. Communication is host-staged, so this does not require or claim CUDA-aware MPI coverage.
Validation
stable_22Jul2025_update2built with SPIN/KSPACE/EXTRA-FIX/MOLECULE/PLUGIN.pytest -q source/lmp/tests/test_dpa4spin_magnetic_force_convention.py: 10 passed, using the default generated artifact and mandatory-test mode; independently rerun.hybrid/overlaycontributions add correctly in both conventions.c985896e.c985896esuccessfully built the actual CUDA Kokkos LAMMPS/plugin and exported the canonical GPU fixture. The new integration runner then exposed a missing explicitrun_style verlet/kk; the corrected runner also checks the active integrator and finalizes Kokkos on exceptions. A real Kokkos Serial execution reproduced the setup failure and verified the correction, repeated computes, and overlay accumulation. On94596308, the real single-rank GPU convention comparisons and three overlay cases ran successfully; the requested two-rank runs instead reported singleton worlds and correctly failed the rank-count assertion. The unified-MPI revision is awaiting full GPU/MPI CI.git diff --checkpassed.Coverage limits
This development environment has no GPU and cannot run two-rank communication. GitHub CI has now exercised real single-rank CUDA Kokkos numerics, but genuine two-rank GPU/MPI validation is still pending after correcting the MPI installation. The dedicated CUDA job is triggered for the latest commit using the repository's one-shot
Test CUDAlabel; its result is pending. Kokkos Serial compilation is not GPU runtime validation. GPU energy finite differences are not claimed by the new adapter-equivalence tests. The six-atom MPI regression is not a large-system communication-buffer stress test. The full multi-backend CI matrix remains for GitHub CI.Fixes #6077
Summary by CodeRabbit
dpa4spinhost and Kokkos pair styles support an optionalmagnetic_force cartesiansetting, which uses the raw energy gradient with respect to spin. Cartesian mode requiresunits metal; precession remains the default.fm_cartesian_forceextraction value.dpa4spinpair style is available as a LAMMPS runtime plugin.