Skip to content

Commit

Permalink
expressions_mixed: kronecker test used "new" retile as default result…
Browse files Browse the repository at this point in the history
… + test negative lobound if using signed 1-index type
  • Loading branch information
evaleev committed Aug 27, 2024
1 parent 7b2124d commit 09819de
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions tests/expressions_mixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,31 +188,28 @@ BOOST_AUTO_TEST_CASE(kronecker) {

// includes target tiles that receive contributions from multiple source
// tiles, tiny target tiles with single contribution, and tiles partially and
// completely outside the source range N.B. retile_v0 seems to struggle with
// completely empty tiles (e.g. add 47 to each 1-d range)
TA::TiledRange yrange{{5, 18, 20, 45}, {7, 20, 22, 45}};
// completely outside the source range
#ifdef TA_SIGNED_1INDEX_TYPE
TA::TiledRange yrange{{-1, 18, 20, 45, 47}, {-1, 20, 22, 45, 47}};
#else
TA::TiledRange yrange{{5, 18, 20, 45, 47}, {7, 20, 22, 45, 47}};
#endif
TA::TSpArrayD y1;
// TA::TiledRange retiler_range{yrange.dim(0), yrange.dim(1), trange2.dim(0),
// trange2.dim(1)};
// SpArrayKronDelta retiler(
// *GlobalFixture::world, retiler_range,
// SparseShape(detail::kronecker_shape(retiler_range), retiler_range),
// std::make_shared<detail::ReplicatedPmap>(
// *GlobalFixture::world, retiler_range.tiles_range().volume()));
// init_kronecker_delta(retiler);
// y("d1,d2") = retiler("d1,d2,s1,s2") * x("s1,s2");
y1 = TA::detail::retile_v1(x, yrange);
// identical to y1 = TA::detail::retile_v1(x, yrange);
TA::TiledRange retiler_range{yrange.dim(0), yrange.dim(1), trange2.dim(0),
trange2.dim(1)};
SpArrayKronDelta retiler(
*GlobalFixture::world, retiler_range,
SparseShape(detail::kronecker_shape(retiler_range), retiler_range),
std::make_shared<detail::ReplicatedPmap>(
*GlobalFixture::world, retiler_range.tiles_range().volume()));
init_kronecker_delta(retiler);
y1("d1,d2") = retiler("d1,d2,s1,s2") * x("s1,s2");
// std::cout << "y1 = " << y1 << std::endl;
// why deadlock without this?
y1.world().gop.fence();

TA::TSpArrayD y_ref = TA::detail::retile_v0(x, yrange);
auto y_ref = TA::retile(x, yrange);
// std::cout << "y_ref = " << y_ref << std::endl;
BOOST_CHECK((y1("d1,d2") - y_ref("d1,d2")).norm().get() == 0.);

auto y2 = TA::detail::retile_v2(x, yrange);
// std::cout << "y2 = " << y2 << std::endl;
BOOST_CHECK((y2("d1,d2") - y_ref("d1,d2")).norm().get() == 0.);
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 09819de

Please sign in to comment.