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 BLAS.trsm! instead of LAPACK.trtrs! in left-triangular solves #1194

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dkarrasch
Copy link
Member

We have used that in right-triangular solves already.

@dkarrasch
Copy link
Member Author

@nanosoldier runbenchmarks("linalg"; vs=":master")

@dkarrasch
Copy link
Member Author

In a manual 1000x1000 test, I see slight to no improvement, but certainly no regression.

@dkarrasch
Copy link
Member Author

It turns out that the LAPACK function is calling the BLAS function internally (https://netlib.org/lapack/explore-html/d4/dc1/group__trtrs_gab0b6a7438a7eb98fe2ab28e6c4d84b21.html), but checks for exact singularity upfront, nothing else. It seems we could rather switch to the "augmented" LAPACK functions throughout instead?

@jishnub @andreasnoack @amontoison

@dkarrasch
Copy link
Member Author

Nevermind, there is no triangular right-solve in LAPACK.

@dkarrasch dkarrasch closed this Feb 4, 2025
@amontoison
Copy link
Contributor

@dkarrasch I was thinking of LBT if we switch the backend, like BLIS. Sometimes, we only have the BLAS routine available.

@dkarrasch
Copy link
Member Author

Ok, we can of course switch, but then we should perhaps add the exact singularity check?

@dkarrasch dkarrasch reopened this Feb 4, 2025
@amontoison
Copy link
Contributor

Yes, and we can do that for both trsv! and trsm! such that it is consistent.
Using trsv! for one right-hand and trtrs! for multiple ones have a different behaviour if the triangular matrix is singular.

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.86%. Comparing base (e7da19f) to head (f8850f0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1194      +/-   ##
==========================================
- Coverage   91.89%   91.86%   -0.03%     
==========================================
  Files          34       34              
  Lines       15360    15371      +11     
==========================================
+ Hits        14115    14121       +6     
- Misses       1245     1250       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants