Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for issue #692 #697

Merged
merged 6 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dash/include/dash/Pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ namespace dash {
* <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 |
* <tt>index</tt> | <tt>global</tt> | <tt>index li</tt> | Local offset <i>li</i> of active unit to global index |
* <b>blocks</b> | &nbsp; | &nbsp; | &nbsp; |
* <tt>size[d]</tt> | <tt>blockspec</tt> | &nbsp; | Number of blocks in all dimensions. |
* <tt>size[d]</tt> | <tt>blockspec</tt> | &nbsp; | Number of blocks in all dimensions. |
* <tt>size[d]</tt> | <tt>local_blockspec</tt> | &nbsp; | Number of local blocks in all dimensions. |
* <tt>index</tt> | <tt>block_at</tt> | <tt>index[d] gp</tt> | Global index of block at global coordinates <i>gp</i> |
* <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> |
* <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> |
Expand Down
8 changes: 4 additions & 4 deletions dash/include/dash/io/hdf5/StorageDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ class StoreHDF {
}
} else {
// Auto deduce pattern
const pattern_t pattern(dash::SizeSpec<ndim>(size_extents),
const pattern_t pattern(dash::SizeSpec<ndim, typename pattern_t::size_type>(size_extents),
dash::DistributionSpec<ndim>(),
dash::TeamSpec<ndim>(), dash::Team::All());
dash::TeamSpec<ndim, typename pattern_t::index_type>(), dash::Team::All());

matrix.allocate(pattern);
}
Expand Down Expand Up @@ -698,9 +698,9 @@ class StoreHDF {
}
DASH_LOG_DEBUG("Created pattern according to metadata");

const pattern_t pattern(dash::SizeSpec<ndim>(size_extents),
const pattern_t pattern(dash::SizeSpec<ndim, typename pattern_t::size_type>(size_extents),
dash::DistributionSpec<ndim>(dist_extents),
dash::TeamSpec<ndim>(team_extents),
dash::TeamSpec<ndim, typename pattern_t::index_type>(team_extents),
dash::Team::All());

// Allocate DASH Matrix
Expand Down
4 changes: 2 additions & 2 deletions dash/include/dash/pattern/ShiftTilePattern1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,9 @@ class ShiftTilePattern<1, Arrangement, IndexType>
}

/**
* Cartesian arrangement of pattern blocks.
* Cartesian arrangement of local pattern blocks.
*/
const BlockSpec_t & local_blockspec() const
const BlockSpec_t local_blockspec() const
{
return BlockSpec_t(_nlblocks);
}
Expand Down
2 changes: 1 addition & 1 deletion dash/include/dash/pattern/TilePattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ class TilePattern
}

/**
* Cartesian arrangement of pattern blocks.
* Cartesian arrangement of local pattern blocks.
*/
constexpr const BlockSpec_t & local_blockspec() const
{
Expand Down
8 changes: 7 additions & 1 deletion dash/include/dash/pattern/TilePattern1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,15 @@ class TilePattern<1, Arrangement, IndexType>
* Cartesian arrangement of pattern blocks.
*/
constexpr BlockSpec_t blockspec() const {
return BlockSpec_t({ dash::math::div_ceil(_size, _blocksize) });
return BlockSpec_t({ _nblocks });
}

/**
* Cartesian arrangement of local pattern blocks.
*/
constexpr BlockSpec_t local_blockspec() const {
return BlockSpec_t({ _nlblocks });
}
/**
* Index of block at given global coordinates.
*
Expand Down
15 changes: 15 additions & 0 deletions dash/test/pattern/TilePatternTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,18 @@ TEST_F(TilePatternTest, Tile4Dim)
}
}
}

TEST_F(TilePatternTest, TileFunctionalCheck)
{
const size_t dims = 1;
using pattern_t = typename dash::TilePattern<dims, dash::ROW_MAJOR, long>;
using IndexType = typename pattern_t::index_type;

// create simple TilePattern 1D BLOCKED for functional checks, now the test just checks for issue 692, unfinished
size_t array_size = 100;
pattern_t pattern(array_size, dash::BLOCKED);

// tested local_blockspec()
const auto &lblockspec = pattern.local_blockspec();
ASSERT_EQ_U(dims, lblockspec.size());
}