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

Make spiluk_handle::reset backwards compatible #2087

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions sparse/src/KokkosSparse_spiluk_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,26 @@ class SPILUKHandle {
vector_size(-1) {}

void reset_handle(const size_type nrows_, const size_type nnzL_,
const size_type nnzU_, const size_type block_size_) {
const size_type nnzU_, const size_type block_size_ = -1) {
set_nrows(nrows_);
set_num_levels(0);
set_nnzL(nnzL_);
set_nnzU(nnzU_);
set_block_size(block_size_);
// user likely does not want to reset block size to 0, so set default
// to -1
if (block_size_ != static_cast<size_type>(-1)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jgfouca can size_type be unsigned, and if so would this result in some unexpected wrap-around value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ndellingwood , yes, it will be a huge value, something no one would ever pick for a block size.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case I think it would be a bit more explicit to use Kokkos::ArithTraits<size_type>::max(). This would allow us to make comparisons more confidently down the road in my opinion.

set_block_size(block_size_);
}
set_level_maxrows(0);
set_level_maxrowsperchunk(0);
level_list = nnz_row_view_t("level_list", nrows_),
level_idx = nnz_lno_view_t("level_idx", nrows_),
level_ptr = nnz_lno_view_t("level_ptr", nrows_ + 1),
hlevel_ptr = nnz_lno_view_host_t("hlevel_ptr", nrows_ + 1),
level_nchunks = nnz_lno_view_host_t(),
level_nrowsperchunk = nnz_lno_view_host_t(), reset_symbolic_complete(),
level_list = nnz_row_view_t("level_list", nrows_);
level_idx = nnz_lno_view_t("level_idx", nrows_);
level_ptr = nnz_lno_view_t("level_ptr", nrows_ + 1);
hlevel_ptr = nnz_lno_view_host_t("hlevel_ptr", nrows_ + 1);
level_nchunks = nnz_lno_view_host_t();
level_nrowsperchunk = nnz_lno_view_host_t();
iw = work_view_t();
reset_symbolic_complete();
}

virtual ~SPILUKHandle(){};
Expand Down