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

Use block_gmres for batched linear solves #129

Open
thorek1 opened this issue Dec 8, 2023 · 4 comments
Open

Use block_gmres for batched linear solves #129

thorek1 opened this issue Dec 8, 2023 · 4 comments
Labels
performance Improve performance or stability

Comments

@thorek1
Copy link
Contributor

thorek1 commented Dec 8, 2023

The latest Krylov.jl version has a block-gmres version which I think can simplify/speed-up some parts of the code.

@thorek1 thorek1 changed the title Consider block-gmres block-gmres Dec 8, 2023
@gdalle
Copy link
Collaborator

gdalle commented Dec 12, 2023

Thanks for the idea. I don't have much time to work on this at the moment though

@mohamed82008
Copy link
Collaborator

how can block-gmres help ID.jl?

@thorek1
Copy link
Contributor Author

thorek1 commented Dec 12, 2023

for example here:

    dy = ntuple(Val(N)) do k
        dₖx = partials.(x_and_dx, k)
        dₖx_vec = vec(dₖx)
        dₖc_vec = similar(y_vec)
        mul!(dₖc_vec, B_vec, dₖx_vec)
        dₖy_vec = solve(implicit.linear_solver, A_vec_presolved, -dₖc_vec)
        reshape(dₖy_vec, size(y))
    end

    y_and_dy = map(eachindex(IndexCartesian(), y)) do i
        Dual{T}(y[i], Partials(ntuple(k -> dy[k][i], Val(N))))
    end

instead of solving with gmres for each slice you could use block-gmres once. I didn't check the block-gmres implementation but I think it is worth testing whether this speeds up computation and this might also allow to solve #118

@gdalle gdalle added the performance Improve performance or stability label Feb 21, 2024
@gdalle
Copy link
Collaborator

gdalle commented Apr 10, 2024

This is implemented in #135 but it still requires JuliaSmoothOptimizers/Krylov.jl#854 to be fixed

@gdalle gdalle changed the title block-gmres Use block_gmres for batched linear solves Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Improve performance or stability
Projects
None yet
Development

No branches or pull requests

3 participants