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

MT Gauss-Seidel fixups #255

Merged
merged 4 commits into from
Oct 2, 2018
Merged

MT Gauss-Seidel fixups #255

merged 4 commits into from
Oct 2, 2018

Conversation

cgcgcg
Copy link
Contributor

@cgcgcg cgcgcg commented Jun 11, 2018

  • Add damping option
  • Instead of inverting the diagonal in every iteration, save the inverse of the diagonal
  • Allow to pass a precomputed diagonal.

The last item is necessary for MT GS to work correctly with Ifpack2. The diagonal of a Tpetra matrix might not be given by pairs (i, i) of local IDs (depending on the rowmap and the colmap). Moreover, this allows to use MT GS with the l1 option from Ifpack2.

I also added some routines to dump to MatrixMarket format.

This addresses Issues #221 and #240

@srajama1 srajama1 requested review from srajama1 and removed request for kyungjoo-kim June 12, 2018 02:36
Copy link
Contributor

@srajama1 srajama1 left a comment

Choose a reason for hiding this comment

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

There is something funky due to tabs and spaces. I might have missed something because of that, but mostly looks good. Can you do a spot check on white and bowman and post confirm everything works.

}
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Matrix market writers live in test_common/ . I assume this is for debugging , but still having two write functions seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I didn't see those! Then there is obviously no reason to add this again.

// Write the dimensions of the sparse matrix: (# rows, #
// columns, # matrix entries (counting duplicates as
// separate entries)).
out << numRows << " " << 1 << " " << endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to nit pick, space in the end of line ?

// Write the dimensions of the sparse matrix: (# rows, #
// columns, # matrix entries (counting duplicates as
// separate entries)).
out << numRows << " " << 1 << " " << endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to nit pick, space in the end of line ?

@@ -247,12 +247,12 @@ class GaussSeidelHandle{
void set_old_to_new_map(const nnz_lno_persistent_work_view_t &old_to_new_map_) {
this->old_to_new_map = old_to_new_map_;
}
void set_permuted_diagonals (const scalar_persistent_work_view_t permuted_diagonals_){
this->permuted_diagonals = permuted_diagonals_;
void set_permuted_inverse_diagonal (const scalar_persistent_work_view_t permuted_inverse_diagonal_){
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Ifpack2 already call set_permuted_diagonals ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it doesn't. This method only sets the permuted diagonal, it does not do any permutations.

static_assert (std::is_same<typename KernelHandle::const_nnz_scalar_t,
typename scalar_nnz_view_t_::const_value_type>::value,
"KokkosSparse::gauss_seidel_symbolic: scalar type of the matrix should be same as kernelHandle scalar_t.");

Copy link
Contributor

Choose a reason for hiding this comment

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

This is mainly pattern match, so I assume this is ok.

@cgcgcg
Copy link
Contributor Author

cgcgcg commented Jun 12, 2018

@srajama1 I removed the matrix market routines and took care of all the whitespace and indentation issues. This blows up the diff quite significantly, but there are no functional changes. I ran the unit test on white and bowman. Anything else I should be running?

using namespace KokkosSparse::Impl;

GAUSS_SEIDEL_NUMERIC<const_handle_type, Internal_alno_row_view_t_, Internal_alno_nnz_view_t_, Internal_ascalar_nnz_view_t_>::gauss_seidel_numeric
(&tmp_handle, num_rows, num_cols, const_a_r, const_a_l, const_a_v, const_a_d, is_graph_symmetric);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srajama1 The diagonal is passed here as const_a_d.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, missed the basic thing.

It works better when you don't hard code the damping factor..
@srajama1
Copy link
Contributor

Will review this after a meeting.

@srajama1
Copy link
Contributor

A unit test in KK will be nice as it gets tested on lot more compilers and platforms than Ifpack2.

@cgcgcg
Copy link
Contributor Author

cgcgcg commented Jun 18, 2018

@srajama1 I changed the unit test so it would run with damping. I'll build and test on Bowman and White..

@cgcgcg
Copy link
Contributor Author

cgcgcg commented Jun 18, 2018

@srajama1 Tests pass on Bowman and White.

Copy link
Contributor

@srajama1 srajama1 left a comment

Choose a reason for hiding this comment

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

Sorry for my tardiness in reviewing this. I asked for a change of spacing issues and made it complicated for myself :(. Two questions:

  1. Are we absolutely sure this works ? I am worried about the code that saves the diagonal position and updates that position later. That position is no longer the diagonal right ? Should we pass the position of the diagonal too ?
  2. Is there a difference between symmetric and unsymmetric ?

@cgcgcg
Copy link
Contributor Author

cgcgcg commented Jun 20, 2018

The more I think about it, the less I am convinced that this is correct. It will not bug out, as it did before, but it probably is still not quite correct. The graph that is used for the coloring is given in terms of local row and column IDs as well, so the coloring might be off. I'll look into it when I have time.

@srajama1
Copy link
Contributor

The coloring is on symmetric graph and only on the local part. Assuming there is no unsymmetric ordering of local rows and local columns it should be fine. If row i and column i are not the same vertex then we are coloring what is just in the row adjacency and ignoring any mismatch in column adjacency.

@jhux2
Copy link

jhux2 commented Aug 7, 2018

@srajama1 @cgcgcg How much work is involved in getting this merged? Having MT Gauss-Seidel is important for the EMPIRE L2 milestone.

@cgcgcg
Copy link
Contributor Author

cgcgcg commented Sep 26, 2018

@srajama1 Do you think this can be merged?

@srajama1
Copy link
Contributor

srajama1 commented Oct 2, 2018

Let us fix column map != row map outside KK. We can merge this.

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

Successfully merging this pull request may close these issues.

4 participants