Define LU factorization for JLArray - #757
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
ChrisRackauckas
approved these changes
Aug 9, 2026
Member
|
It was effectively doing this before the pointer conversion was removed |
Member
|
Brother what is this PR description |
Member
|
ehh have your llm summarize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ignore this PR until reviewed by @ChrisRackauckas.\n\n## Summary\n\nJLArrays now defines LinearAlgebra.lu for JLArray matrices by explicitly copying to the host representation before calling host LU. Matching ldiv! methods copy right-hand sides through host memory so the returned factorization can be used by solver code without triggering JLArray to Ptr conversion.\n\nThis addresses the regression described in SciML/OrdinaryDiffEq.jl#4179. JLArrays 0.3.2 intentionally rejects implicit CPU pointer conversion, while the generic LinearAlgebra LU path still reaches LAPACK with a JLArray.\n\n## Verification\n\nBefore the fix, on the unmodified branch:\n\n julia --project=test --startup-file=no -e 'using JLArrays, LinearAlgebra; A = jl([2.0 1.0; 1.0 3.0]); lu(A; check = false)'\n\nfailed with:\n\n ERROR: Illegal conversion of a JLArray to a Ptr\n [3] getrf!(A::JLArray{Float64, 2}, ipiv::JLArray{Int64, 1}; check::Bool)\n @ LinearAlgebra.LAPACK .../LinearAlgebra/src/lapack.jl:587\n\nWith this patch:\n\n julia --project=test --startup-file=no test/jlarrays_lu.jl\n\npassed:\n\n Test Summary: | Pass Total Time\n JLArray LU | 3 3 1.3s\n\nThe OrdinaryDiffEq reproduction also passed for both TRBDF2 and Rodas5P:\n\n (SciMLBase.ReturnCode.Success, SciMLBase.ReturnCode.Success, [0.04713496106370036, 0.04713496106370036, 0.04713496106370036])\n\nThe full GPUArrays suite passed:\n\n Test Summary: | Pass Total Time\n Overall | 21022 21022 16m23.0s\n SUCCESS\n Testing GPUArrays tests passed\n\nAlso ran typos on the changed files and git diff --check. GPU-specific backends and downstream packages were not tested.