Skip to content

Commit

Permalink
AAA rules in test
Browse files Browse the repository at this point in the history
Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
  • Loading branch information
yhmtsai and MarcelKoch committed Jul 6, 2024
1 parent 460dae3 commit 7cf1b31
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dpcpp/test/preconditioner/jacobi_kernels.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,11 @@ TEST_F(Jacobi, ScalarJacobiHandleZero)
gko::initialize<Vec>({{0, 0, 0}, {0, 2, 0}, {0, 0, 0}}, ref));
auto b = gko::initialize<Vec>({1, 2, 3}, ref);
auto x = Vec::create(ref, gko::dim<2>(3, 1));
auto jacobi = Bj::build().with_max_block_size(1u).on(ref)->generate(mtx);
auto d_b = b->clone(dpcpp);
auto d_x = x->clone(dpcpp);
auto d_mtx = gko::share(mtx->clone(dpcpp));

auto jacobi = Bj::build().with_max_block_size(1u).on(ref)->generate(mtx);
// Must generate from scratch because the clone copies the inverted
// information.
auto d_jacobi =
Expand All @@ -923,7 +924,6 @@ TEST_F(Jacobi, ScalarJacobiHandleZero)
// Jacobi uses 1 as the result when diagonal value is zero.
jacobi->apply(b, x);
d_jacobi->apply(d_b, d_x);

GKO_ASSERT_MTX_NEAR(d_x, x, 0.0);
}

Expand Down
2 changes: 1 addition & 1 deletion reference/test/preconditioner/jacobi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,11 @@ TYPED_TEST(Jacobi, ScalarJacobiHandleZero)
gko::initialize<Vec>({{0, 0, 0}, {0, 2, 0}, {0, 0, 0}}, this->exec));
auto b = gko::initialize<Vec>({1, 2, 3}, this->exec);
auto x = Vec::create(this->exec, gko::dim<2>(3, 1));

auto jacobi = this->scalar_j_factory->generate(mtx);

// Jacobi uses 1 as the result when diagonal value is zero.
jacobi->apply(b, x);

ASSERT_EQ(x->at(0, 0), value_type{1.0});
ASSERT_EQ(x->at(1, 0), value_type{1.0});
ASSERT_EQ(x->at(2, 0), value_type{3.0});
Expand Down
4 changes: 2 additions & 2 deletions test/preconditioner/jacobi_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,10 +895,11 @@ TEST_F(Jacobi, ScalarJacobiHandleZero)
gko::initialize<Vec>({{0, 0, 0}, {0, 2, 0}, {0, 0, 0}}, ref));
auto b = gko::initialize<Vec>({1, 2, 3}, ref);
auto x = Vec::create(ref, gko::dim<2>(3, 1));
auto jacobi = Bj::build().with_max_block_size(1u).on(ref)->generate(mtx);
auto d_b = b->clone(exec);
auto d_x = x->clone(exec);
auto d_mtx = gko::share(mtx->clone(exec));

auto jacobi = Bj::build().with_max_block_size(1u).on(ref)->generate(mtx);
// Must generate from scratch because the clone copies the inverted
// information.
auto d_jacobi =
Expand All @@ -907,6 +908,5 @@ TEST_F(Jacobi, ScalarJacobiHandleZero)
// Jacobi uses 1 as the result when diagonal value is zero.
jacobi->apply(b, x);
d_jacobi->apply(d_b, d_x);

GKO_ASSERT_MTX_NEAR(d_x, x, 0.0);
}

0 comments on commit 7cf1b31

Please sign in to comment.