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

refactor: Use matrix-matrix interface in LAPACK solve #3234

Merged
merged 9 commits into from
Aug 26, 2024

Conversation

dkachuma
Copy link
Contributor

@dkachuma dkachuma commented Jul 23, 2024

This PR replaces multiple matrix-vector solves with a single matrix-matrix solve following PR3173. This also uses a version of the LAPACK call the destroys the coefficient matrix and rhs matrix to avoid further allocation in BlasLapackLA.

@dkachuma dkachuma changed the title Use matrix interface in Lapack solve Use matrix-matrix interface in LAPACK solve Jul 23, 2024
@dkachuma dkachuma self-assigned this Jul 23, 2024
@dkachuma dkachuma changed the title Use matrix-matrix interface in LAPACK solve refactor: Use matrix-matrix interface in LAPACK solve Jul 23, 2024
@dkachuma dkachuma added the type: cleanup / refactor Non-functional change (NFC) label Jul 23, 2024
@dkachuma dkachuma marked this pull request as ready for review July 23, 2024 01:12
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.01%. Comparing base (ececf78) to head (bdf0c0d).
Report is 92 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3234      +/-   ##
===========================================
- Coverage    56.02%   56.01%   -0.01%     
===========================================
  Files         1053     1053              
  Lines        89123    89115       -8     
===========================================
- Hits         49927    49917      -10     
- Misses       39196    39198       +2     

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


🚨 Try these New Features:

@dkachuma dkachuma added flag: ready for review ci: run CUDA builds Allows to triggers (costly) CUDA jobs labels Aug 8, 2024
static bool solveLinearSystem( arraySlice2d< real64 const > const & A,
arraySlice1d< real64 const > const & b,
arraySlice1d< real64 > const & x )
static bool solveLinearSystem( arraySlice2d< real64, USD > const & A,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally preferred having the rhs and the solution into two separate arrays. I am guessing that this is the lapack interface though... We could keep the separation on the GEOS side though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The separate rhs/solution interface on BlasLapackLA still exists. This change destroys the rhs but avoids having to allocate extra space for solution and rhs knowing that we are not going to need the rhs or the matrix after the solve.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the allocation the same? A single array2d instead of 2 array1d?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake. The allocation was on the matrix. With the previous interface, everytime we call the solve, additional space had to be allocated for the LU factors of the matrix. This way there is no extra space allocated since it's a single solve and the space allocated for the matrix is used for the LU factors (destroying the matrix but once we have solved we don't care anymore).

With the single column by column solve it would have been nice to factorize the matrix and then use the LU factors on each column but we don't have that interface. Instead I added an interface where you can do an in-place matrix-matrix solve.

@dkachuma dkachuma added the flag: no rebaseline Does not require rebaseline label Aug 16, 2024
@CusiniM CusiniM added the ci: run integrated tests Allows to run the integrated tests in GEOS CI label Aug 25, 2024
@CusiniM CusiniM merged commit f6caac7 into develop Aug 26, 2024
22 checks passed
@CusiniM CusiniM deleted the refactor/dkachuma/use-lapack-matrix-matrix-interface branch August 26, 2024 16:19
@dkachuma dkachuma mentioned this pull request Aug 28, 2024
24 tasks
rrsettgast pushed a commit that referenced this pull request Sep 17, 2024
* Use matrix interface

* uncrustify

* Remove unrelated changes

* Remove unncessesary assignment

---------

Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com>
rrsettgast pushed a commit that referenced this pull request Sep 17, 2024
* Use matrix interface

* uncrustify

* Remove unrelated changes

* Remove unncessesary assignment

---------

Co-authored-by: Matteo Cusini <49037133+CusiniM@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: no rebaseline Does not require rebaseline flag: ready for review type: cleanup / refactor Non-functional change (NFC)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants