Skip to content

Fix CUDA RF device data setup#453

Open
tamar-dewilde wants to merge 1 commit into
developfrom
tamar/issue451-cuda-rf-device-state
Open

Fix CUDA RF device data setup#453
tamar-dewilde wants to merge 1 commit into
developfrom
tamar/issue451-cuda-rf-device-state

Conversation

@tamar-dewilde

Copy link
Copy Markdown
Collaborator

Description

The KLU L and U factors were synchronized to the device without first allocating device storage. The solution produced by the initial KLU solve was also used by CUDA operations without being synchronized to the device.

This caused invalid residuals, CUDA copy errors, and a later segmentation fault.

Closes #451

@shakedregev

Proposed changes

  • Allocate device storage for the KLU L and U factors before synchronizing them.
  • Synchronize the KLU solution to the device after a successful solve.

Checklist

  • All tests pass (make test and make test_install per testing instructions). Code tested on
    • CPU backend
    • CUDA backend
    • HIP backend
  • I have manually run the non-experimental examples and verified that residuals are close to machine precision. (In your build directory run: ./examples/<your_example>.exe -h to get instructions how to run examples). Code tested on:
    • CPU backend
    • CUDA backend
    • HIP backend
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows Re::Solve style guidelines.
  • N/A: The existing gpuRefactor example reproduces the bug.
  • N/A: This fix does not add a new feature or public API that needs documentation.
  • The feature branch is rebased with respect to the target branch.
  • N/A: This is a small follow-up fix to the explicit memory management change already listed in CHANGELOG.md.

Further comments

gpuRefactor still reports repeated allocation messages after the first system. That separate issue is tracked in #445.

@tamar-dewilde tamar-dewilde self-assigned this Jul 14, 2026
@tamar-dewilde tamar-dewilde added the bug Something isn't working label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: CUDA gpuRefactor does not prepare KLU outputs for device use

1 participant