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

add a LUSOL functionality test #164

Closed
wants to merge 18 commits into from
Closed

Conversation

superwhiskers
Copy link
Collaborator

@superwhiskers superwhiskers commented Jun 14, 2024

this pull request adds a functionality test for LUSOL. there is one thing that needs to be worked out before this can actually be merged:

@superwhiskers superwhiskers added enhancement New feature or request testing labels Jun 14, 2024
@superwhiskers superwhiskers self-assigned this Jun 14, 2024
@superwhiskers superwhiskers linked an issue Jun 14, 2024 that may be closed by this pull request
@superwhiskers
Copy link
Collaborator Author

oh. this also adds comments referencing stuff about extracting L/U factors. i'll remove that so this can be focused only on testing

@pelesh pelesh changed the title add a LUSOL integration test add a LUSOL functionality test Jun 14, 2024
Copy link
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

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

A good first stab. Here are some suggestions how to proceed.

resolve/matrix/Coo.hpp Outdated Show resolved Hide resolved
resolve/matrix/MatrixHandlerCpu.cpp Outdated Show resolved Hide resolved
resolve/matrix/Sparse.hpp Show resolved Hide resolved
tests/functionality/testLUSOL.cpp Outdated Show resolved Hide resolved
resolve/matrix/io.cpp Outdated Show resolved Hide resolved
@pelesh
Copy link
Collaborator

pelesh commented Jun 18, 2024

@superwhiskers, I suggest you add fix for #162 to this PR.

@superwhiskers superwhiskers marked this pull request as ready for review June 18, 2024 14:42
Copy link
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

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

There are some minor issues that I addressed in my comments.

Newly added expand() function needs unit test(s). I suggest we create MatrixConversionTest.hpp and runMatrixConversionTest.cpp in tests/unit directory and implement needed unit tests there.

resolve/matrix/Sparse.hpp Show resolved Hide resolved
resolve/matrix/Utilities.cpp Show resolved Hide resolved
resolve/matrix/Utilities.cpp Show resolved Hide resolved
resolve/matrix/Utilities.hpp Outdated Show resolved Hide resolved
tests/functionality/testLUSOL.cpp Outdated Show resolved Hide resolved
tests/functionality/testLUSOL.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

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

Good progress but some more fixes are needed before this is ready to merge. I left a few comments to that end.

LUSOL test produces some type conversion warnings that need to be fixed.

resolve/matrix/Coo.cpp Outdated Show resolved Hide resolved
resolve/matrix/Csr.cpp Outdated Show resolved Hide resolved
Comment on lines +257 to +258
int matrix::Sparse::setValueOwnership(bool owns, memory::MemorySpace memspace)
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be plural in the function name -- values.

Suggested change
int matrix::Sparse::setValueOwnership(bool owns, memory::MemorySpace memspace)
{
int matrix::Sparse::setValuesOwnership(bool owns, memory::MemorySpace memspace)
{

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i don't really see how that's any better. setValueOwnership is just as correct in a plural context

resolve/matrix/Utilities.cpp Outdated Show resolved Hide resolved
resolve/matrix/Utilities.cpp Outdated Show resolved Hide resolved
Comment on lines 11 to 23
/**
* @brief Expands a symmetric COO matrix stored only as a half to its full size
*/
int expand(Coo&);

/**
* @brief Expands a symmetric CSR matrix stored only as a half to its full size
*/
int expand(Csr&);

/**
* @brief Expands a symmetric CSC matrix stored only as a half to its full size
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing that is important to mention here and in source comments is if you assume that the matrix is stored as upper- or lower triangular.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no assumption is made. technically, you could pass in a matrix that isn't triangular and it would still work

Copy link
Collaborator

Choose a reason for hiding this comment

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

The function should not allow that. If the matrix is not upper- or lower-triangular, this function should return an error. If for some reason non-symmetric matrix was tagged as symmetric, that is a nasty bug, which we need to protect against.

Copy link
Collaborator Author

@superwhiskers superwhiskers Jun 28, 2024

Choose a reason for hiding this comment

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

it's specified as part of the preconditions for each of the expand functions. i can add a debug check that goes away in release builds to catch any bugs that violate it, but i don't see why this should be a general check we do, as the presence of a precondition makes it on the caller to know beforehand

tests/functionality/testLUSOL.cpp Outdated Show resolved Hide resolved
Comment on lines 30 to 39
TestOutcome cooMatrix5x5()
{
TestStatus status;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tests needs to be documented. Also, the test should not be specific to particular matrix size.

tests/unit/matrix/MatrixExpansionTests.hpp Outdated Show resolved Hide resolved
tests/unit/matrix/MatrixExpansionTests.hpp Outdated Show resolved Hide resolved
- implemented matvec over COO matrices
- added back symmetric matrix expansion for COO matrices (temporary)
- reworked integration test code from KLU into integration test code for LUSOL (in progress, does not fully work)
- made minor tweaks to LinSolverDirectLUSOL
- set data ownership at exit of matrix-from-file conversion to avoid data leaks
- added a function to matrix::Sparse to set data ownership
- fix memory leak in `Csr` hijacking constructor
- add hijacking constructor to `Coo`
- remove needless use of `Sparse::setDataOwnership`/`Sparse::setValueOwnership`
- move `Coo::expand` to a separate function in `Utilities.cpp`
- add `Csr` expansion to `ReSolve::matrix::expand`
@superwhiskers
Copy link
Collaborator Author

rebased on latest develop

@cameronrutherford
Copy link
Collaborator

https://github.com/ORNL/ReSolve/blob/lusol-integration-tests/examples/CMakeLists.txt#L140 - might be good to have Lusol be used in the consumer test for testing resolve~cuda~rocm~klu+lusol

@pelesh
Copy link
Collaborator

pelesh commented Jun 24, 2024

https://github.com/ORNL/ReSolve/blob/lusol-integration-tests/examples/CMakeLists.txt#L140 - might be good to have Lusol be used in the consumer test for testing resolve~cuda~rocm~klu+lusol

I agree. To get there, we need to get LUSOL to work within a refactorization solver strategy, which is outside the scope of this PR.

@pelesh pelesh marked this pull request as draft August 17, 2024 11:19
@pelesh
Copy link
Collaborator

pelesh commented Sep 20, 2024

Closing in favor of #189.

@pelesh pelesh closed this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add functionality test for LUSOL
3 participants