Skip to content

Commit

Permalink
like contraction, reduction expression and binary expression can igno…
Browse files Browse the repository at this point in the history
…re absolute positions if ignore_tile_position() is on
  • Loading branch information
evaleev committed Sep 13, 2024
1 parent 2527e80 commit 1471c8b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
22 changes: 17 additions & 5 deletions src/TiledArray/expressions/binary_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,30 @@ class BinaryEngine : public ExprEngine<Derived> {
left_.init_struct(left_indices_);
right_.init_struct(right_indices_);
#ifndef NDEBUG
if (left_.trange() != right_.trange()) {
if (ignore_tile_position()) {
if (!is_congruent(left_.trange(), right_.trange())) {
if (TiledArray::get_default_world().rank() == 0) {
TA_USER_ERROR_MESSAGE(
"The TiledRanges of the left- and right-hand arguments the "
"binary "
"expression are not congruent:"
<< "\n left = " << left_.trange()
<< "\n right = " << right_.trange());
}
TA_EXCEPTION(
"The TiledRange objects of a binary expression are not congruent.");
}
} else if (left_.trange() != right_.trange()) {
if (TiledArray::get_default_world().rank() == 0) {
TA_USER_ERROR_MESSAGE(
"The TiledRanges of the left- and right-hand arguments of the "
"binary operation are not equal:"
"The TiledRanges of the left- and right-hand arguments the binary "
"expression are not equal:"
<< "\n left = " << left_.trange()
<< "\n right = " << right_.trange());
}

TA_EXCEPTION(
"The TiledRanges of the left- and right-hand arguments "
"of the binary operation are not equal.");
"The TiledRange objects of a binary expression are not equal.");
}
#endif // NDEBUG
ExprEngine_::init_struct(target_indices);
Expand Down
17 changes: 15 additions & 2 deletions src/TiledArray/expressions/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,20 @@ class Expr {
right_dist_eval.eval();

#ifndef NDEBUG
if (left_dist_eval.trange() != right_dist_eval.trange()) {
if (ignore_tile_position()) {
if (!is_congruent(left_dist_eval.trange(), right_dist_eval.trange())) {
if (TiledArray::get_default_world().rank() == 0) {
TA_USER_ERROR_MESSAGE(
"The TiledRanges of the left- and right-hand arguments the "
"binary "
"reduction are not congruent:"
<< "\n left = " << left_dist_eval.trange()
<< "\n right = " << right_dist_eval.trange());
}
TA_EXCEPTION(
"The TiledRange objects of a binary reduction are not congruent.");
}
} else if (left_dist_eval.trange() != right_dist_eval.trange()) {
if (TiledArray::get_default_world().rank() == 0) {
TA_USER_ERROR_MESSAGE(
"The TiledRanges of the left- and right-hand arguments the binary "
Expand All @@ -674,7 +687,7 @@ class Expr {
}

TA_EXCEPTION(
"The TiledRange objects of a binary expression are not equal.");
"The TiledRange objects of a binary reduction are not equal.");
}
#endif // NDEBUG

Expand Down

0 comments on commit 1471c8b

Please sign in to comment.