Andrew/sccg and matrix class#421
Conversation
pelesh
left a comment
There was a problem hiding this comment.
Very nice work, thank you. Please remove matrix::Matrix class so we can merge this.
|
Some tests failing, need to fix that, as well. Setting this to draft PR until blocker issues are resolved. |
…ale tests to fail. Made "createIncrementingVector()" return a pointer to the new vector instead of a copy (which causes the data to be freed prematurely).
No commented out code.
…arse" This reverts commit 00f6992. Kept changes to "io.cpp", which fixes the an issue with out-of-bounds iterators.
…e into andrew/sccg-and-matrix-class
…e into andrew/sccg-and-matrix-class
|
Done--removed the Matrix class, and it's passing all of the tests. |
Good work on this. I made a small correction. I tested the codes on CUDA and HIP and the good news is that at least the old tests are still passsing. Before we merge this, can you do the HIP/CUDA implementation as well? It's not working currently. |
* use caller-provided backend-specific handlers in SCCG * load SCCG data on host before device sync * refresh CUDA SpMV cache when matrix changes * fix HyKKT SCCG HIP target setup * document SCCG backend setup and CUDA SpMV cache handling * mirror SpMV cache reset for HIP * Shaked/random error fix (#424) Fixed stochastic failures due to a faulty random number generator and asynchronous operations. Co-authored-by: shakedregev <shakedregev@users.noreply.github.com> --------- Co-authored-by: tamar-dewilde <tamar-dewilde@users.noreply.github.com> Co-authored-by: Shaked Regev <35384901+shakedregev@users.noreply.github.com> Co-authored-by: shakedregev <shakedregev@users.noreply.github.com>
shakedregev
left a comment
There was a problem hiding this comment.
Good work on this, I think it's ready for merging.
The review is stale. See current changes.
pelesh
left a comment
There was a problem hiding this comment.
Good work, some minor documentation (code commenting) and style issues need to be resolved before merging.
|
|
||
| if (it == tmp.end()) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| while (it != std::prev(tmp.end())) |
There was a problem hiding this comment.
Put comments to explain what is going on here. This code looks a little cryptic.
| cusparseCreateDnVec(&vecx, A->getNumRows(), vec_x->getData(memory::DEVICE), CUDA_R_64F); | ||
| cusparseCreateDnVec(&vecx, A->getNumColumns(), vec_x->getData(memory::DEVICE), CUDA_R_64F); | ||
|
|
There was a problem hiding this comment.
This is pretty big change. Needs explanation and comments in the code.
| // Rebuild cached SpMV setup if the matrix object or dimensions changed. | ||
| bool matrix_changed = (matrix_for_matvec_ != A) || (matvec_num_rows_ != A->getNumRows()) || (matvec_num_cols_ != A->getNumColumns()) || (matvec_nnz_ != A->getNnz()); | ||
| if (matrix_changed || values_changed_) | ||
| { |
There was a problem hiding this comment.
Break this line per style guidelines.
| matrix::Sparse* matrix_for_matvec_{nullptr}; ///< Matrix used for cached SpMV setup. | ||
| index_type matvec_num_rows_{0}; ///< Number of rows in cached SpMV matrix. | ||
| index_type matvec_num_cols_{0}; ///< Number of columns in cached SpMV matrix. | ||
| index_type matvec_nnz_{0}; ///< Number of nonzeros in cached SpMV matrix. |
There was a problem hiding this comment.
Why is matrix cached to begin with?
| // Rebuild cached SpMV setup if the matrix object or dimensions changed. | ||
| bool matrix_changed = (matrix_for_matvec_ != A) || (matvec_num_rows_ != A->getNumRows()) || (matvec_num_cols_ != A->getNumColumns()) || (matvec_nnz_ != A->getNnz()); | ||
| if (matrix_changed || values_changed_) | ||
| { | ||
| workspace_->resetMatvecSetup(); | ||
| } |
| HykktSchurComplementConjugateGradientTests(memory::MemorySpace memspace, MatrixHandler& matrix_handler, VectorHandler& vector_handler, std::mt19937& generator) | ||
| : memspace_(memspace), matrix_handler_(matrix_handler), vector_handler_(vector_handler), generator_(generator) | ||
| { |
There was a problem hiding this comment.
Break long lines per style guidelines.
Description
Implemented Schur complement conjugate gradient and Matrix parent class.
Proposed changes
Added a CPU implementation of Schur complement conjugate gradient similar to the HyKKT implementation, along with a basic test that will need to be completed later. The current test is a modified copy of the tests in the HyKKT implementation, which uses a set of test matrix files.
Created a Matrix class that is a parent of Sparse and, in the future, other matrix representations. The Matrix class is designed to act as an interface for matrices generally and has wrappers for matrix operations implemented in MatrixHandler.
@shakedregev
Checklist
make testandmake test_installper testing instructions). Code tested on./examples/<your_example>.exe -hto get instructions how to run examples). Code tested on:-Wall -Wpedantic -Wconversion -Wextra.Further comments