Skip to content

Commit 567c617

Browse files
committed
fix: check block volume in eval_to before setting values
We were already checking the host array volume, also check the block volume to avoid empty blocks.
1 parent b7c7250 commit 567c617

File tree

1 file changed

+4
-3
lines changed
  • src/TiledArray/expressions

1 file changed

+4
-3
lines changed

src/TiledArray/expressions/expr.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,10 @@ class Expr {
518518
// Move the data from dist_eval into the sub-block of result array.
519519
// This step may involve communication when the tiles are moved from the
520520
// sub-block distribution to the array distribution.
521-
// N.B. handle the corner case of zero-volume host array, then no data needs
522-
// to be moved
523-
if (tsr.array().trange().tiles_range().volume() != 0) {
521+
// N.B. handle the corner cases of zero-volume host array and zero-volume
522+
// block, then no data needs to be moved
523+
if (tsr.array().trange().tiles_range().volume() != 0 &&
524+
blk_range.volume() != 0) {
524525
// N.B. must deep copy
525526
TA_ASSERT(tsr.array().trange().tiles_range().includes(tsr.lower_bound()));
526527
// N.B. this expression's range,

0 commit comments

Comments
 (0)