From 5974ecd3038853f0884c0d0bf78b17e0ae2641a3 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 25 Feb 2020 11:27:12 +0100 Subject: [PATCH 1/4] Add local_blockspec() call to 1D TilePattern specialization --- dash/include/dash/Pattern.h | 3 ++- dash/include/dash/pattern/ShiftTilePattern1D.h | 4 ++-- dash/include/dash/pattern/TilePattern.h | 2 +- dash/include/dash/pattern/TilePattern1D.h | 8 +++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dash/include/dash/Pattern.h b/dash/include/dash/Pattern.h index c8da56908..3876f9e89 100644 --- a/dash/include/dash/Pattern.h +++ b/dash/include/dash/Pattern.h @@ -48,7 +48,8 @@ namespace dash { * index | global | unit u, index li | Local offset li of unit u to global index | * index | global | index li | Local offset li of active unit to global index | * blocks |   |   |   | - * size[d] | blockspec |   | Number of blocks in all dimensions. | + * size[d] | blockspec |   | Number of blocks in all dimensions. | + * size[d] | local_blockspec |   | Number of local blocks in all dimensions. | * index | block_at | index[d] gp | Global index of block at global coordinates gp | * viewspec | block | index gbi | Offset and extent in global cartesian space of block at global block index gbi | * viewspec | local_block | index lbi | Offset and extent in global cartesian space of block at local block index lbi | diff --git a/dash/include/dash/pattern/ShiftTilePattern1D.h b/dash/include/dash/pattern/ShiftTilePattern1D.h index 736f665ff..1ff4f81a1 100644 --- a/dash/include/dash/pattern/ShiftTilePattern1D.h +++ b/dash/include/dash/pattern/ShiftTilePattern1D.h @@ -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); } diff --git a/dash/include/dash/pattern/TilePattern.h b/dash/include/dash/pattern/TilePattern.h index 9d75d623f..c28bdf5a0 100644 --- a/dash/include/dash/pattern/TilePattern.h +++ b/dash/include/dash/pattern/TilePattern.h @@ -1295,7 +1295,7 @@ class TilePattern } /** - * Cartesian arrangement of pattern blocks. + * Cartesian arrangement of local pattern blocks. */ constexpr const BlockSpec_t & local_blockspec() const { diff --git a/dash/include/dash/pattern/TilePattern1D.h b/dash/include/dash/pattern/TilePattern1D.h index e6a324a57..23b46a47a 100644 --- a/dash/include/dash/pattern/TilePattern1D.h +++ b/dash/include/dash/pattern/TilePattern1D.h @@ -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. * From 59db2c3d6243d692947f55372b7da2d8635a0568 Mon Sep 17 00:00:00 2001 From: anindex Date: Mon, 2 Mar 2020 13:01:19 +0100 Subject: [PATCH 2/4] Add TileFunctionalCheck for avaialble checking(drafted) --- dash/test/pattern/TilePatternTest.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dash/test/pattern/TilePatternTest.cc b/dash/test/pattern/TilePatternTest.cc index f202dcb5b..081ac1119 100644 --- a/dash/test/pattern/TilePatternTest.cc +++ b/dash/test/pattern/TilePatternTest.cc @@ -300,3 +300,18 @@ TEST_F(TilePatternTest, Tile4Dim) } } } + +TEST_F(TilePatternTest, TileFunctionalCheck) +{ + const size_t dims = 1; + using pattern_t = typename dash::TilePattern; + 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()); +} \ No newline at end of file From a03215d63258d5704a8dd965b256948c6ba43dda Mon Sep 17 00:00:00 2001 From: anindex Date: Mon, 2 Mar 2020 17:46:12 +0100 Subject: [PATCH 3/4] Fix bug causing missing explicit index type transfer in StoreHDF function calls --- dash/include/dash/io/hdf5/StorageDriver.h | 8 ++++---- dash/test/pattern/TilePatternTest.cc | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dash/include/dash/io/hdf5/StorageDriver.h b/dash/include/dash/io/hdf5/StorageDriver.h index 7df9f4f7a..25de12b43 100644 --- a/dash/include/dash/io/hdf5/StorageDriver.h +++ b/dash/include/dash/io/hdf5/StorageDriver.h @@ -361,9 +361,9 @@ class StoreHDF { } } else { // Auto deduce pattern - const pattern_t pattern(dash::SizeSpec(size_extents), + const pattern_t pattern(dash::SizeSpec(size_extents), dash::DistributionSpec(), - dash::TeamSpec(), dash::Team::All()); + dash::TeamSpec(), dash::Team::All()); matrix.allocate(pattern); } @@ -698,9 +698,9 @@ class StoreHDF { } DASH_LOG_DEBUG("Created pattern according to metadata"); - const pattern_t pattern(dash::SizeSpec(size_extents), + const pattern_t pattern(dash::SizeSpec(size_extents), dash::DistributionSpec(dist_extents), - dash::TeamSpec(team_extents), + dash::TeamSpec(team_extents), dash::Team::All()); // Allocate DASH Matrix diff --git a/dash/test/pattern/TilePatternTest.cc b/dash/test/pattern/TilePatternTest.cc index 081ac1119..2fdb4cf09 100644 --- a/dash/test/pattern/TilePatternTest.cc +++ b/dash/test/pattern/TilePatternTest.cc @@ -4,6 +4,8 @@ #include #include +#include + #include #include @@ -314,4 +316,17 @@ TEST_F(TilePatternTest, TileFunctionalCheck) // tested local_blockspec() const auto &lblockspec = pattern.local_blockspec(); ASSERT_EQ_U(dims, lblockspec.size()); + + + // just to show how we correctly call StoreHDF::write and StoreHDF::read + using dash::io::hdf5::hdf5_options; + using dash::io::hdf5::StoreHDF; + using view_t = typename dash::Matrix; + using container_t = typename dash::view_traits::origin_type; + + view_t *h5matrix = new view_t(dash::SizeSpec<1>(8)); + + StoreHDF::write(*h5matrix, "testf.h5", "testg/testd1D"); + StoreHDF::read(*h5matrix, "testf.h5", "testg/testd1D"); + } \ No newline at end of file From 467fe1e4b824bacd6ccbd229f8f1678b54bf1dd3 Mon Sep 17 00:00:00 2001 From: anindex Date: Mon, 2 Mar 2020 18:06:42 +0100 Subject: [PATCH 4/4] Remove example fix because it make CI fails (not enable HDF5) --- dash/test/pattern/TilePatternTest.cc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/dash/test/pattern/TilePatternTest.cc b/dash/test/pattern/TilePatternTest.cc index 2fdb4cf09..081ac1119 100644 --- a/dash/test/pattern/TilePatternTest.cc +++ b/dash/test/pattern/TilePatternTest.cc @@ -4,8 +4,6 @@ #include #include -#include - #include #include @@ -316,17 +314,4 @@ TEST_F(TilePatternTest, TileFunctionalCheck) // tested local_blockspec() const auto &lblockspec = pattern.local_blockspec(); ASSERT_EQ_U(dims, lblockspec.size()); - - - // just to show how we correctly call StoreHDF::write and StoreHDF::read - using dash::io::hdf5::hdf5_options; - using dash::io::hdf5::StoreHDF; - using view_t = typename dash::Matrix; - using container_t = typename dash::view_traits::origin_type; - - view_t *h5matrix = new view_t(dash::SizeSpec<1>(8)); - - StoreHDF::write(*h5matrix, "testf.h5", "testg/testd1D"); - StoreHDF::read(*h5matrix, "testf.h5", "testg/testd1D"); - } \ No newline at end of file