Skip to content

Commit

Permalink
fix MoveToDense generic matrix test
Browse files Browse the repository at this point in the history
The stride requirements are incorrect
  • Loading branch information
upsj committed Apr 26, 2022
1 parent f5f2d53 commit 110b6fc
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions test/matrix/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,30 +1074,13 @@ TYPED_TEST(Matrix, MoveToDenseIsEquivalentToRef)
using Mtx = typename TestFixture::Mtx;
using Dense = gko::matrix::Dense<typename Mtx::value_type>;
this->forall_matrix_scenarios([&](auto mtx) {
const auto size = mtx.ref->get_size();
const auto stride = size[1] + 5;
const auto padded_size = gko::dim<2>{size[0], stride};
auto ref_padded = Dense::create(this->ref, padded_size);
auto dev_padded = Dense::create(this->exec, padded_size);
ref_padded->fill(12345);
dev_padded->fill(12345);
const auto rows = gko::span{0, size[0]};
const auto cols = gko::span{0, size[1]};
const auto pad_cols = gko::span{size[1], stride};
auto ref_result = ref_padded->create_submatrix(rows, cols);
auto dev_result = dev_padded->create_submatrix(rows, cols);
auto ref_padding = ref_padded->create_submatrix(rows, pad_cols);
auto dev_padding = dev_padded->create_submatrix(rows, pad_cols);
auto orig_padding = ref_padding->clone();
auto ref_result = Dense::create(this->ref);
auto dev_result = Dense::create(this->exec);

mtx.ref->move_to(ref_result.get());
mtx.dev->move_to(dev_result.get());

GKO_ASSERT_MTX_NEAR(ref_result, dev_result, 0.0);
ASSERT_EQ(ref_result->get_stride(), stride);
ASSERT_EQ(dev_result->get_stride(), stride);
GKO_ASSERT_MTX_NEAR(ref_padding, orig_padding, 0.0);
GKO_ASSERT_MTX_NEAR(dev_padding, orig_padding, 0.0);
});
}

Expand Down

0 comments on commit 110b6fc

Please sign in to comment.