Skip to content

Switch from inverse to linalg_inv_ex to avoid sync#487

Merged
matthewdcong merged 1 commit into
openvdb:mainfrom
matthewdcong:fix_inverse_cpu_gpu_sync
Mar 2, 2026
Merged

Switch from inverse to linalg_inv_ex to avoid sync#487
matthewdcong merged 1 commit into
openvdb:mainfrom
matthewdcong:fix_inverse_cpu_gpu_sync

Conversation

@matthewdcong

Copy link
Copy Markdown
Contributor

torch::inverse, an alias for torch::linalg_inv, synchronizes the host with the device after computing the inverse in order to inspect error codes. To avoid this, we switch to torch::linalg_inv_ex (as suggested by the PyTorch documentation) which exposes a check_errors=False parameter. This lets us avoid the synchronization by default but also enable it for debugging if needed.

Signed-off-by: Matthew Cong <mcong@nvidia.com>
@matthewdcong matthewdcong requested a review from a team as a code owner March 2, 2026 10:17
@matthewdcong matthewdcong merged commit 5e5cfe6 into openvdb:main Mar 2, 2026
35 checks passed
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