Skip to content

Commit f84e89e

Browse files
authored
Merge pull request #697 from anindex/bug-692-pattern
Patch for issue #692
2 parents 08316c1 + 467fe1e commit f84e89e

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

dash/include/dash/Pattern.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ namespace dash {
4848
* <tt>index</tt> | <tt>global</tt> | <tt>unit u, index li</tt> | Local offset <i>li</i> of unit <i>u</i> to global index |
4949
* <tt>index</tt> | <tt>global</tt> | <tt>index li</tt> | Local offset <i>li</i> of active unit to global index |
5050
* <b>blocks</b> | &nbsp; | &nbsp; | &nbsp; |
51-
* <tt>size[d]</tt> | <tt>blockspec</tt> | &nbsp; | Number of blocks in all dimensions. |
51+
* <tt>size[d]</tt> | <tt>blockspec</tt> | &nbsp; | Number of blocks in all dimensions. |
52+
* <tt>size[d]</tt> | <tt>local_blockspec</tt> | &nbsp; | Number of local blocks in all dimensions. |
5253
* <tt>index</tt> | <tt>block_at</tt> | <tt>index[d] gp</tt> | Global index of block at global coordinates <i>gp</i> |
5354
* <tt>viewspec</tt> | <tt>block</tt> | <tt>index gbi</tt> | Offset and extent in global cartesian space of block at global block index <i>gbi</i> |
5455
* <tt>viewspec</tt> | <tt>local_block</tt> | <tt>index lbi</tt> | Offset and extent in global cartesian space of block at local block index <i>lbi</i> |

dash/include/dash/io/hdf5/StorageDriver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ class StoreHDF {
361361
}
362362
} else {
363363
// Auto deduce pattern
364-
const pattern_t pattern(dash::SizeSpec<ndim>(size_extents),
364+
const pattern_t pattern(dash::SizeSpec<ndim, typename pattern_t::size_type>(size_extents),
365365
dash::DistributionSpec<ndim>(),
366-
dash::TeamSpec<ndim>(), dash::Team::All());
366+
dash::TeamSpec<ndim, typename pattern_t::index_type>(), dash::Team::All());
367367

368368
matrix.allocate(pattern);
369369
}
@@ -698,9 +698,9 @@ class StoreHDF {
698698
}
699699
DASH_LOG_DEBUG("Created pattern according to metadata");
700700

701-
const pattern_t pattern(dash::SizeSpec<ndim>(size_extents),
701+
const pattern_t pattern(dash::SizeSpec<ndim, typename pattern_t::size_type>(size_extents),
702702
dash::DistributionSpec<ndim>(dist_extents),
703-
dash::TeamSpec<ndim>(team_extents),
703+
dash::TeamSpec<ndim, typename pattern_t::index_type>(team_extents),
704704
dash::Team::All());
705705

706706
// Allocate DASH Matrix

dash/include/dash/pattern/ShiftTilePattern1D.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,9 +916,9 @@ class ShiftTilePattern<1, Arrangement, IndexType>
916916
}
917917

918918
/**
919-
* Cartesian arrangement of pattern blocks.
919+
* Cartesian arrangement of local pattern blocks.
920920
*/
921-
const BlockSpec_t & local_blockspec() const
921+
const BlockSpec_t local_blockspec() const
922922
{
923923
return BlockSpec_t(_nlblocks);
924924
}

dash/include/dash/pattern/TilePattern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ class TilePattern
12951295
}
12961296

12971297
/**
1298-
* Cartesian arrangement of pattern blocks.
1298+
* Cartesian arrangement of local pattern blocks.
12991299
*/
13001300
constexpr const BlockSpec_t & local_blockspec() const
13011301
{

dash/include/dash/pattern/TilePattern1D.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,15 @@ class TilePattern<1, Arrangement, IndexType>
796796
* Cartesian arrangement of pattern blocks.
797797
*/
798798
constexpr BlockSpec_t blockspec() const {
799-
return BlockSpec_t({ dash::math::div_ceil(_size, _blocksize) });
799+
return BlockSpec_t({ _nblocks });
800800
}
801801

802+
/**
803+
* Cartesian arrangement of local pattern blocks.
804+
*/
805+
constexpr BlockSpec_t local_blockspec() const {
806+
return BlockSpec_t({ _nlblocks });
807+
}
802808
/**
803809
* Index of block at given global coordinates.
804810
*

dash/test/pattern/TilePatternTest.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,18 @@ TEST_F(TilePatternTest, Tile4Dim)
300300
}
301301
}
302302
}
303+
304+
TEST_F(TilePatternTest, TileFunctionalCheck)
305+
{
306+
const size_t dims = 1;
307+
using pattern_t = typename dash::TilePattern<dims, dash::ROW_MAJOR, long>;
308+
using IndexType = typename pattern_t::index_type;
309+
310+
// create simple TilePattern 1D BLOCKED for functional checks, now the test just checks for issue 692, unfinished
311+
size_t array_size = 100;
312+
pattern_t pattern(array_size, dash::BLOCKED);
313+
314+
// tested local_blockspec()
315+
const auto &lblockspec = pattern.local_blockspec();
316+
ASSERT_EQ_U(dims, lblockspec.size());
317+
}

0 commit comments

Comments
 (0)