Skip to content

Fix CUDA crash in GTO compute_rho when gradients not needed#78

Merged
joshkamm merged 1 commit intomainfrom
fix-gto-compute-rho-null-grad
Feb 21, 2026
Merged

Fix CUDA crash in GTO compute_rho when gradients not needed#78
joshkamm merged 1 commit intomainfrom
fix-gto-compute-rho-null-grad

Conversation

@joshkamm
Copy link
Member

@joshkamm joshkamm commented Feb 19, 2026

Summary

  • Add missing if (need_grad) guards before two val1g/val2g zero-initialization loops in the single-precision GTO compute_rho(bool, ...)
  • When called without density gradients (drho=NULL, e.g. for HF), these arrays are NULL, causing CUDA_ERROR_ILLEGAL_ADDRESS on the GPU
  • Matches the pattern already correctly used in the double-precision compute_rhodg()

Test plan

  • Reproduced crash with pixi run test-gaussian in ZEST (local path dependency pointing to unfixed SlaterGPU main)
  • Applied fix, rebuilt, and confirmed integrated total density: 4.00000006 (no crash)

Related to ZimmermanGroup/ZEST#62 (issue will be closed from the ZEST side once the updated SlaterGPU version is pulled in)

🤖 Generated with Claude Code

Add missing `if (need_grad)` guards before two val1g/val2g zero-initialization
loops in the single-precision GTO `compute_rho()`. When called without density
gradients (drho=NULL, e.g. HF), these arrays are NULL, causing
CUDA_ERROR_ILLEGAL_ADDRESS on the GPU. Matches the pattern already used in
the double-precision `compute_rhodg()`.

Fixes ZimmermanGroup/ZEST#62

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joshkamm joshkamm self-assigned this Feb 19, 2026
@joshkamm
Copy link
Member Author

@Vaibhav-Chemistry most of the context is in the linked Zest issue Samantha posted, but does this make sense / seem like the right way to address it to you?

@joshkamm
Copy link
Member Author

Discussed this with Paul in person and he gave the go-ahead to merge.

@joshkamm joshkamm merged commit 2ec41ea into main Feb 21, 2026
1 check passed
@joshkamm joshkamm deleted the fix-gto-compute-rho-null-grad branch February 21, 2026 17:22
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.

1 participant