Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set UMFPACK control vector ? #383

Open
sjdaines opened this issue Oct 1, 2023 · 4 comments
Open

How to set UMFPACK control vector ? #383

sjdaines opened this issue Oct 1, 2023 · 4 comments
Labels
good first issue Good for newcomers

Comments

@sjdaines
Copy link

sjdaines commented Oct 1, 2023

Apologies if I've missed something, but I can't see how to set the UMFPACK control vector...

Would this be possible perhaps as a new control kwarg to UMFPACKFactorization ?

which could then be used eg to reenable iterative refinement:

import SparseArrays 

umfpack_control = SparseArrays.UMFPACK.get_umfpack_control(Float64, Int64) # get Julia defaults (NB: Julia modifies the UMFPACK default to switch off iterative refinement)
umfpack_control[SparseArrays.UMFPACK.JL_UMFPACK_IRSTEP] = 2.0 # reenable UMFPACK default max iterative refinement steps

UMFPACKFactorization(;reuse_symbolic=true, check_pattern=true, control=umfpack_control)

where this could perhaps be implemented as

Base.@kwdef struct UMFPACKFactorization <: AbstractFactorization
    reuse_symbolic::Bool = true
    check_pattern::Bool = true # Check factorization re-use
    control::Vector{Float64} = Float64[] # empty vector will be filled in with defaults from a call to SparseArrays.UMFPACK.get_umfpack_control
end
@ChrisRackauckas
Copy link
Member

I didn't know there was more controls here. Are they documented somewhere?

Instead of specifying the control vector, we should raise it to a higher level interface. UMFPACKFactorization(;max_iterative_refinement_steps = 2) or something.

@sjdaines
Copy link
Author

sjdaines commented Oct 2, 2023

I didn't know there was more controls here. Are they documented somewhere?

Just made a PR to add some more doc JuliaSparse/SparseArrays.jl#449

Full doc is the UMFPACK User Guide https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/UMFPACK/Doc/UMFPACK_UserGuide.pdf

@ChrisRackauckas
Copy link
Member

Cool thanks for sharing. I don't have a free hand right now to complete this, but would happily take a PR if anyone has a second.

@ChrisRackauckas ChrisRackauckas added the good first issue Good for newcomers label Oct 26, 2023
@PaoloBiolghini
Copy link

PaoloBiolghini commented Mar 15, 2024

I noticed in the SparseArrays code that they force the value of the control vector to zero when you want to change it.
image

So, in order to change the control parameters for LinearSolve, as you suggested, we have to modify the UMFPACKFactorization struct and also the solve function, adding the control vector as parameters to the lu function.

I'm going to open the PR and link it to these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants