Skip to content

Commit

Permalink
Fix sparse_ioutils test on kokkos-dev
Browse files Browse the repository at this point in the history
Adding a ss.sync call fixes it but I have no idea why it
was needed here. All the other stringstream reads work fine.
  • Loading branch information
jgfouca committed Mar 29, 2024
1 parent 23413f5 commit f664161
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sparse/src/KokkosSparse_IOUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ int read_hb(const char *fileName, lno_t &nrows, lno_t &ncols, size_type &ne,
rhs_lines = 0;

ss >> total_lines >> ptr_lines >> col_lines >> val_lines >> rhs_lines;

ss.sync(); // This fixes tests on kokkos-dev/ipcp.
if (total_lines == 0 || ptr_lines == 0 || col_lines == 0) {
throw std::runtime_error(std::string("Problem reading HB file ") +
fileName + ", Line 2 did not have valid values");
Expand All @@ -1108,7 +1108,6 @@ int read_hb(const char *fileName, lno_t &nrows, lno_t &ncols, size_type &ne,
size_type nrow = 0, ncol = 0, nnz_raw = 0, neltvl = 0;

ss >> matrix_info >> nrow >> ncol >> nnz_raw >> neltvl;

if (matrix_info.size() != 3 || nrow == 0 || ncol == 0 || nnz_raw == 0) {
throw std::runtime_error(std::string("Problem reading HB file ") +
fileName +
Expand Down

0 comments on commit f664161

Please sign in to comment.