Skip to content

Fix device OneDFT gradient#215

Open
tvogels wants to merge 1 commit into
wavefunction91:skalafrom
tvogels:fix-gradient-bug
Open

Fix device OneDFT gradient#215
tvogels wants to merge 1 commit into
wavefunction91:skalafrom
tvogels:fix-gradient-bug

Conversation

@tvogels

@tvogels tvogels commented Jun 25, 2026

Copy link
Copy Markdown

The OneDFT GPU gradients gave incorrect results due to a mismatch in task ordering.

GauXC splits grid points in batches (tasks). The OneDFT code path sorts these by atom, because the neural network treats atomic grids as units that belong together.

When computing nuclear gradients, we use pytorch to compute gradients w.r.t. model input features (density, kinetic energy density, ...) and combine them with gradients of those input features w.r.t. the coordinates. When those are combined, the ordering still needs to match up.

So this PR restores correct ordering + adds a test comparing host gradients to device gradients. This test failed before this PR.

The OneDFT GPU gradients gave incorrect results due to a mismatch in
task ordering.

GauXC splits grid points in batches (tasks). The OneDFT code path sorts
these by atom, because the neural network treats atomic grids as units
that belong together.

When computing nuclear gradients, we use pytorch to compute gradients
w.r.t. model input features (density, kinetic energy density, ...) and
combine them with gradients of those input features w.r.t. the
coordinates. When those are combined, the ordering still needs to match
up.

So this PR restores correct ordering + adds a test comparing host
gradients to device gradients. This test failed before this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants