diff --git a/external/versions.cmake b/external/versions.cmake index 90c9fcccd8..694231cc76 100644 --- a/external/versions.cmake +++ b/external/versions.cmake @@ -22,8 +22,8 @@ set(TA_TRACKED_MADNESS_PREVIOUS_TAG b22ee85059e6ccc9a6e803ba0550652ece8d9df1) set(TA_TRACKED_MADNESS_VERSION 0.10.1) set(TA_TRACKED_MADNESS_PREVIOUS_VERSION 0.10.1) -set(TA_TRACKED_BTAS_TAG bbb11894802d7e2f89182a2e7fce9aed1078f851) -set(TA_TRACKED_BTAS_PREVIOUS_TAG 8752fb97fc68d1982c48283aba4b03c744389ba8) +set(TA_TRACKED_BTAS_TAG f4c965b778ff7df74f276f7fcf6224ac419e8ee3) +set(TA_TRACKED_BTAS_PREVIOUS_TAG ed453f9c81dcfbba5a0b8eea88f89a484da2e128) set(TA_TRACKED_CUTT_TAG 0e8685bf82910bc7435835f846e88f1b39f47f09) set(TA_TRACKED_CUTT_PREVIOUS_TAG 592198b93c93b7ca79e7900b9a9f2e79f9dafec3) diff --git a/src/TiledArray/conversions/vector_of_arrays.h b/src/TiledArray/conversions/vector_of_arrays.h index 1f67c1ca14..f79606e99f 100644 --- a/src/TiledArray/conversions/vector_of_arrays.h +++ b/src/TiledArray/conversions/vector_of_arrays.h @@ -68,7 +68,7 @@ inline TA::TiledRange prepend_dim_to_trange( /// @return SparseShape of fused Array object /// TODO rename to fuse_tilewise_vector_of_shapes template -TA::SparseShape fuse_vector_of_shapes_tiles( +TA::SparseShape fuse_tilewise_vector_of_shapes( madness::World& global_world, const std::vector>& arrays, const std::size_t array_rank, const TA::TiledRange& fused_trange) { @@ -156,7 +156,7 @@ TA::SparseShape fuse_vector_of_shapes_tiles( /// @param[in] fused_trange the TiledRange of the fused @c arrays /// @return DenseShape of fused Array object template -TA::DenseShape fuse_vector_of_shapes_tiles( +TA::DenseShape fuse_tilewise_vector_of_shapes( madness::World&, const std::vector>& arrays, const std::size_t array_rank, const TA::TiledRange& fused_trange) { @@ -177,7 +177,7 @@ TA::DenseShape fuse_vector_of_shapes_tiles( /// fused array /// @return the Shape of the @c i -th subarray // TODO rename to tilewise_slice_of_fused_shape -inline TA::SparseShape subshape_from_fused_tile( +inline TA::SparseShape tilewise_slice_of_fused_shape( const TA::TiledRange& split_trange, const TA::SparsePolicy::shape_type& shape, const std::size_t tile_idx, const std::size_t split_ntiles, const std::size_t tile_size) { @@ -209,7 +209,7 @@ inline TA::SparseShape subshape_from_fused_tile( /// the index of the corresponding tile of the leading dimension) /// @param[in] split_trange TiledRange of the target subarray objct /// @return the Shape of the @c i -th subarray -inline TA::DenseShape subshape_from_fused_tile( +inline TA::DenseShape tilewise_slice_of_fused_shape( const TA::TiledRange& split_trange, const TA::DensePolicy::shape_type& shape, const std::size_t tile_idx, const std::size_t split_ntiles, const std::size_t tile_size) { @@ -283,14 +283,13 @@ class dist_subarray_vec /// global_world, but the subarrays are "local" to each rank and distributed in /// tilewise-round-robin fashion. /// The result will live in @c global_world. -/// @sa detail::fuse_vector_of_shapes_tiles -/// TODO rename to fuse_tilewise_vector_of_arrays +/// @sa detail::fuse_tilewise_vector_of_shapes template -TA::DistArray fuse_vector_of_arrays_tiles( +TA::DistArray fuse_tilewise_vector_of_arrays( madness::World& global_world, const std::vector>& array_vec, const std::size_t fused_dim_extent, - const TiledArray::TiledRange& array_trange, std::size_t block_size = 1) { + const TiledArray::TiledRange& array_trange, std::size_t target_block_size = 1) { auto nproc = global_world.size(); // make instances of array_vec globally accessible @@ -298,13 +297,16 @@ TA::DistArray fuse_vector_of_arrays_tiles( detail::dist_subarray_vec arrays(global_world, array_vec, fused_dim_extent); + std::size_t nblocks = + (fused_dim_extent + target_block_size - 1) / target_block_size; + std::size_t block_size = (fused_dim_extent + nblocks - 1) / nblocks; // make fused tiledrange auto fused_trange = detail::prepend_dim_to_trange(fused_dim_extent, array_trange, block_size); std::size_t ntiles_per_array = array_trange.tiles_range().volume(); // make fused shape - auto fused_shape = detail::fuse_vector_of_shapes_tiles( + auto fused_shape = detail::fuse_tilewise_vector_of_shapes( global_world, arrays.array_accessor(), fused_dim_extent, fused_trange); // make fused array @@ -387,10 +389,9 @@ TA::DistArray fuse_vector_of_arrays_tiles( /// @param[in] tile_of_i tile range information for tile i /// @param[in] split_trange TiledRange of the split Array object /// @return the @c i -th subarray -/// @sa detail::subshape_from_fused_tile -/// TODO rename to split_tilewise_fused_array +/// @sa detail::tilewise_slice_of_fused_shape template -void subarray_from_fused_array( +void split_tilewise_fused_array( madness::World& local_world, const TA::DistArray& fused_array, std::size_t tile_idx, std::vector>& split_arrays, @@ -406,7 +407,7 @@ void subarray_from_fused_array( // Create tile_size arrays and put them into split_arrays for (size_t i = tile_range.first; i < tile_range.second; ++i) { - auto split_shape = detail::subshape_from_fused_tile( + auto split_shape = detail::tilewise_slice_of_fused_shape( split_trange, shape, tile_idx, split_ntiles, tile_size); // create split Array object TA::DistArray split_array(local_world, split_trange, diff --git a/tests/conversions.cpp b/tests/conversions.cpp index 770d8f8b55..98bcb159d0 100644 --- a/tests/conversions.cpp +++ b/tests/conversions.cpp @@ -276,14 +276,14 @@ BOOST_AUTO_TEST_CASE(tiles_of_array_unit_blocking) { TA::set_default_world(this_world); for (int r = 0; r < num_mode0_tiles; ++r) { if (rank == r % size) { - TiledArray::subarray_from_fused_array(this_world, b_dense, r, + TiledArray::split_tilewise_fused_array(this_world, b_dense, r, b_dense_vector, tr_split); } } TA::set_default_world(world); world.gop.fence(); // convert vector of arrays back into dense array - auto b_dense_fused = TiledArray::fuse_vector_of_arrays_tiles( + auto b_dense_fused = TiledArray::fuse_tilewise_vector_of_arrays( world, b_dense_vector, 11, tr_split, 1); b_dense_vector.clear(); @@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_array_unit_blocking) { TA::set_default_world(this_world); for (int r = 0; r < num_mode0_tiles; ++r) { if (rank == r % size) { - TiledArray::subarray_from_fused_array(this_world, b_sparse, r, + TiledArray::split_tilewise_fused_array(this_world, b_sparse, r, b_sparse_vector, tr_split); } } @@ -316,7 +316,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_array_unit_blocking) { world.gop.fence(); // convert vector of arrays back into dense array - auto b_sparse_fused = TiledArray::fuse_vector_of_arrays_tiles( + auto b_sparse_fused = TiledArray::fuse_tilewise_vector_of_arrays( world, b_sparse_vector, 11, tr_split, 1); b_sparse_vector.clear(); @@ -374,7 +374,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_arrays_non_unit_blocking) { TA::set_default_world(this_world); for (int r = 0; r < num_mode0_tiles; ++r) { if (rank == r % size) { - TiledArray::subarray_from_fused_array(this_world, b_dense, r, + TiledArray::split_tilewise_fused_array(this_world, b_dense, r, b_dense_vector, tr_split); } } @@ -382,7 +382,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_arrays_non_unit_blocking) { world.gop.fence(); // convert vector of arrays back into dense array - auto b_dense_fused = TiledArray::fuse_vector_of_arrays_tiles( + auto b_dense_fused = TiledArray::fuse_tilewise_vector_of_arrays( world, b_dense_vector, dim_one, tr_split, block_size); b_dense_vector.clear(); @@ -410,7 +410,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_arrays_non_unit_blocking) { TA::set_default_world(this_world); for (int r = 0; r < num_mode0_tiles; ++r) { if (rank == r % size) { - TiledArray::subarray_from_fused_array(this_world, b_sparse, r, + TiledArray::split_tilewise_fused_array(this_world, b_sparse, r, b_sparse_vector, tr_split); } } @@ -418,7 +418,7 @@ BOOST_AUTO_TEST_CASE(tiles_of_arrays_non_unit_blocking) { world.gop.fence(); // convert vector of arrays back into dense array - auto b_sparse_fused = TiledArray::fuse_vector_of_arrays_tiles( + auto b_sparse_fused = TiledArray::fuse_tilewise_vector_of_arrays( world, b_sparse_vector, dim_one, tr_split, block_size); b_sparse_vector.clear(); // Check to see if the fused and original arrays are the same