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

Prevent the recalculation of permutation in lu_solve() #5826

Closed
ahoenselaar opened this issue Feb 24, 2021 · 3 comments
Closed

Prevent the recalculation of permutation in lu_solve() #5826

ahoenselaar opened this issue Feb 24, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@ahoenselaar
Copy link
Contributor

Use case: Repeated solution of a linear system based on LU decomposition.

Currently, the only exposed methods to make this possible are jax.scipy.linalg.lu_factor() in conjuction with jax.scipy.linalg.lu_solve(). However, to conform with SciPy's API, jax.scipy.linalg.lu_factor() drops the third output permutation provided by jax.lax.linalg.lu(). Hence, the permuation is recalculated in every invocation of jax.scipy.linalg.lu_solve() (code).

For reasons that should be investigated separately, lu_pivots_to_permutation() exhibits poor performance on GPU.

There are two possible solutions:

  • Add an optional argument to jax.scipy.linalg.lu_solve() that allows the user to pass in permutation. That would cause divergence from SciPy's API.
  • Expose jax.lax.linalg.lu_solve() directly to the user.
@ahoenselaar ahoenselaar added the enhancement New feature or request label Feb 24, 2021
@hawkinsp
Copy link
Collaborator

I'm curious if you think this is still worth solving, given that #5880 significantly improved the performance (thanks!). I doubt that the pivot to permutation conversion has more than a negligible time cost now?

The underlying jax.lax.linalg.lu_solve is accessible, should you want it.

What do you think?

@ahoenselaar
Copy link
Contributor Author

ahoenselaar commented May 19, 2021 via email

@hawkinsp
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants