Skip to content

Fix GPU MPI coords device pointer bug#186

Merged
awvwgk merged 1 commit intowavefunction91:skalafrom
tvogels:thijs/fix-device-pointer
Mar 16, 2026
Merged

Fix GPU MPI coords device pointer bug#186
awvwgk merged 1 commit intowavefunction91:skalafrom
tvogels:thijs/fix-device-pointer

Conversation

@tvogels
Copy link

@tvogels tvogels commented Mar 16, 2026

In the multi-rank MPI path, prepare_onedft_features was called with CPU TensorOptions but passed device_data_ptr->coords_device_data(), which is a GPU pointer. This is undefined behavior — a CPU tensor wrapping device memory.

This fix builds host_coords from the Molecule object (already on the host) instead of using the device pointer.

We probably missed this because the multi-rank case is not as well-covered by tests as the single rank path?

In the multi-rank MPI path, prepare_onedft_features was called with CPU
TensorOptions but passed device_data_ptr->coords_device_data(), which is
a GPU pointer. This is undefined behavior — a CPU tensor wrapping device
memory.

Build host_coords from the Molecule object instead, which is already
available on the host and contains the same atomic coordinates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tvogels tvogels marked this pull request as ready for review March 16, 2026 11:54
@awvwgk awvwgk added the Skala Related to the Skala exchange-correlation functional label Mar 16, 2026
Copy link
Collaborator

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

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

Good catch, thank you.

@awvwgk awvwgk merged commit 27d9dea into wavefunction91:skala Mar 16, 2026
2 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skala Related to the Skala exchange-correlation functional

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants