Skip to content
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
6 changes: 5 additions & 1 deletion external/eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ if (TARGET TiledArray_Eigen)
foreach(_def ${LAPACK_COMPILE_DEFINITIONS})
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D${_def}")
endforeach()
list(APPEND CMAKE_REQUIRED_FLAGS ${LAPACK_COMPILE_OPTIONS})
string(GENEX_STRIP "${LAPACK_COMPILE_OPTIONS}" LAPACK_COMPILE_OPTIONS_GENEXFREE)
list(APPEND CMAKE_REQUIRED_FLAGS ${LAPACK_COMPILE_OPTIONS_GENEXFREE})
if (DEFINED LAPACK_CXX_COMPILE_OPTIONS)
list(APPEND CMAKE_REQUIRED_FLAGS ${LAPACK_CXX_COMPILE_OPTIONS})
endif()

CHECK_CXX_SOURCE_COMPILES("
#include <Eigen/Dense>
Expand Down
2 changes: 1 addition & 1 deletion external/versions.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# for each dependency track both current and previous id (the variable for the latter must contain PREVIOUS)
# to be able to auto-update them

set(TA_TRACKED_VGCMAKEKIT_TAG f946aa274745da09702a727492f1cabb843dc9e6)
set(TA_TRACKED_VGCMAKEKIT_TAG fe6176e5273feba3a3d0f4ec6e50c18b69d79d29)

# Boost explicitly downgraded to 1.59 from 1.68
set(TA_TRACKED_BOOST_VERSION 1.59)
Expand Down
14 changes: 7 additions & 7 deletions src/TiledArray/conversions/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ void counted_tensor_to_eigen_submatrix(const T& tensor,
/// TiledArray::TiledRange trange(blocks2.begin(), blocks2.end());
///
/// // Create an Array from an Eigen matrix.
/// TiledArray::Array<double, 2> array =
/// eigen_to_array<TiledArray::Array<double, 2> >(world, trange, m);
/// auto array =
/// eigen_to_array<TA::TSpArrayD> >(world, trange, m);
/// \endcode
/// \tparam A The array type
/// \tparam Derived The Eigen matrix derived type
Expand Down Expand Up @@ -476,7 +476,7 @@ A eigen_to_array(World& world, const typename A::trange_type& trange,
/// object.
/// Usage:
/// \code
/// TiledArray::Array<double, 2> array(world, trange);
/// TA::TSpArrayD array(world, trange);
/// // Set tiles of array ...
///
/// Eigen::MatrixXd m = array_to_eigen(array);
Expand Down Expand Up @@ -572,8 +572,8 @@ array_to_eigen(const DistArray<Tile, Policy>& array) {
/// TiledArray::TiledRange trange(blocks2.begin(), blocks2.end());
///
/// // Create an Array from an Eigen matrix.
/// TiledArray::Array<double, 2> array =
/// row_major_buffer_to_array<TiledArray::Array<double, 2> >(world, trange,
/// auto array =
/// row_major_buffer_to_array<TA::TSpArrayD>(world, trange,
/// buffer, 100, 100);
///
/// delete [] buffer;
Expand Down Expand Up @@ -641,8 +641,8 @@ inline A row_major_buffer_to_array(
/// TiledArray::TiledRange trange(blocks2.begin(), blocks2.end());
///
/// // Create an Array from an Eigen matrix.
/// TiledArray::Array<double, 2> array =
/// column_major_buffer_to_array<TiledArray::Array<double, 2> >(world,
/// auto array =
/// column_major_buffer_to_array<TA::TSpArrayD>(world,
/// trange, buffer, 100, 100);
///
/// delete [] buffer;
Expand Down
98 changes: 53 additions & 45 deletions src/TiledArray/conversions/vector_of_arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace detail {
/// @param block_size blocking range for the new dimension, the dimension being
/// fused
/// @return TiledRange of fused Array object
inline TA::TiledRange prepend_dim_to_trange(
inline TiledArray::TiledRange prepend_dim_to_trange(
std::size_t array_rank, const TiledArray::TiledRange& array_trange,
std::size_t block_size = 1) {
/// make the new TiledRange1 for new dimension
TA::TiledRange1 new_trange1;
TiledArray::TiledRange1 new_trange1;
{
std::vector<std::size_t> new_trange1_v;
auto range_size = array_rank;
Expand All @@ -34,15 +34,17 @@ inline TA::TiledRange prepend_dim_to_trange(
new_trange1_v.push_back(i);
}
new_trange1_v.push_back(range_size);
new_trange1 = TA::TiledRange1(new_trange1_v.begin(), new_trange1_v.end());
new_trange1 =
TiledArray::TiledRange1(new_trange1_v.begin(), new_trange1_v.end());
}

/// make the new range for N+1 Array
TA::TiledRange new_trange;
TiledArray::TiledRange new_trange;
{
auto old_trange1s = array_trange.data();
old_trange1s.insert(old_trange1s.begin(), new_trange1);
new_trange = TA::TiledRange(old_trange1s.begin(), old_trange1s.end());
new_trange =
TiledArray::TiledRange(old_trange1s.begin(), old_trange1s.end());
}

return new_trange;
Expand All @@ -68,14 +70,15 @@ inline TA::TiledRange prepend_dim_to_trange(
/// @return SparseShape of fused Array object
/// TODO rename to fuse_tilewise_vector_of_shapes
template <typename Tile>
TA::SparseShape<float> fuse_tilewise_vector_of_shapes(
TiledArray::SparseShape<float> fuse_tilewise_vector_of_shapes(
madness::World& global_world,
const std::vector<TA::DistArray<Tile, TA::SparsePolicy>>& arrays,
const std::size_t array_rank, const TA::TiledRange& fused_trange) {
const std::vector<TiledArray::DistArray<Tile, TiledArray::SparsePolicy>>&
arrays,
const std::size_t array_rank, const TiledArray::TiledRange& fused_trange) {
if (arrays.size() == 0) {
TA::Tensor<float> fused_tile_norms(fused_trange.tiles_range(), 0.f);
return TA::SparseShape<float>(global_world, fused_tile_norms, fused_trange,
true);
TiledArray::Tensor<float> fused_tile_norms(fused_trange.tiles_range(), 0.f);
return TiledArray::SparseShape<float>(global_world, fused_tile_norms,
fused_trange, true);
}
const std::size_t rank = global_world.rank();
auto size = global_world.size();
Expand All @@ -95,7 +98,7 @@ TA::SparseShape<float> fuse_tilewise_vector_of_shapes(
}
}

TA::Tensor<float> fused_tile_norms(
TiledArray::Tensor<float> fused_tile_norms(
fused_trange.tiles_range(), 0.f); // use nonzeroes for local tiles only

// compute norms of fused tiles
Expand Down Expand Up @@ -135,8 +138,8 @@ TA::SparseShape<float> fuse_tilewise_vector_of_shapes(
}
}

auto fused_shapes = TA::SparseShape<float>(global_world, fused_tile_norms,
fused_trange, true);
auto fused_shapes = TiledArray::SparseShape<float>(
global_world, fused_tile_norms, fused_trange, true);

return fused_shapes;
}
Expand All @@ -156,11 +159,12 @@ TA::SparseShape<float> fuse_tilewise_vector_of_shapes(
/// @param[in] fused_trange the TiledRange of the fused @c arrays
/// @return DenseShape of fused Array object
template <typename Tile>
TA::DenseShape fuse_tilewise_vector_of_shapes(
TiledArray::DenseShape fuse_tilewise_vector_of_shapes(
madness::World&,
const std::vector<TA::DistArray<Tile, TA::DensePolicy>>& arrays,
const std::size_t array_rank, const TA::TiledRange& fused_trange) {
return TA::DenseShape(1, fused_trange);
const std::vector<TiledArray::DistArray<Tile, TiledArray::DensePolicy>>&
arrays,
const std::size_t array_rank, const TiledArray::TiledRange& fused_trange) {
return TiledArray::DenseShape(1, fused_trange);
}

/// @brief extracts the shape of a slice of a fused array created with
Expand All @@ -177,12 +181,13 @@ TA::DenseShape fuse_tilewise_vector_of_shapes(
/// fused array
/// @return the Shape of the @c i -th subarray
// TODO rename to tilewise_slice_of_fused_shape
inline TA::SparseShape<float> 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) {
inline TiledArray::SparseShape<float> tilewise_slice_of_fused_shape(
const TiledArray::TiledRange& split_trange,
const TiledArray::SparsePolicy::shape_type& shape,
const std::size_t tile_idx, const std::size_t split_ntiles,
const std::size_t tile_size) {
TA_ASSERT(split_ntiles == split_trange.tiles_range().volume());
TA::Tensor<float> split_tile_norms(split_trange.tiles_range());
TiledArray::Tensor<float> split_tile_norms(split_trange.tiles_range());

// map element i to its tile index
std::size_t offset = tile_idx * split_ntiles;
Expand All @@ -197,7 +202,7 @@ inline TA::SparseShape<float> tilewise_slice_of_fused_shape(
[tile_size](const float& elem) { return elem * tile_size; });

auto split_shape =
TA::SparseShape<float>(split_tile_norms, split_trange, true);
TiledArray::SparseShape<float>(split_tile_norms, split_trange, true);
return split_shape;
}

Expand All @@ -209,11 +214,12 @@ inline TA::SparseShape<float> tilewise_slice_of_fused_shape(
/// 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 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) {
return TA::DenseShape(tile_size, split_trange);
inline TiledArray::DenseShape tilewise_slice_of_fused_shape(
const TiledArray::TiledRange& split_trange,
const TiledArray::DensePolicy::shape_type& shape,
const std::size_t tile_idx, const std::size_t split_ntiles,
const std::size_t tile_size) {
return TiledArray::DenseShape(tile_size, split_trange);
}
} // namespace detail

Expand Down Expand Up @@ -285,21 +291,22 @@ class dist_subarray_vec
/// The result will live in @c global_world.
/// @sa detail::fuse_tilewise_vector_of_shapes
template <typename Tile, typename Policy>
TA::DistArray<Tile, Policy> fuse_tilewise_vector_of_arrays(
TiledArray::DistArray<Tile, Policy> fuse_tilewise_vector_of_arrays(
madness::World& global_world,
const std::vector<TA::DistArray<Tile, Policy>>& array_vec,
const std::vector<TiledArray::DistArray<Tile, Policy>>& array_vec,
const std::size_t fused_dim_extent,
const TiledArray::TiledRange& array_trange, std::size_t target_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
using Array = TA::DistArray<Tile, Policy>;
using Array = TiledArray::DistArray<Tile, Policy>;
detail::dist_subarray_vec<Array> 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;
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);
Expand All @@ -310,11 +317,11 @@ TA::DistArray<Tile, Policy> fuse_tilewise_vector_of_arrays(
global_world, arrays.array_accessor(), fused_dim_extent, fused_trange);

// make fused array
TA::DistArray<Tile, Policy> fused_array(global_world, fused_trange,
fused_shape);
TiledArray::DistArray<Tile, Policy> fused_array(global_world, fused_trange,
fused_shape);

/// copy the data from a sequence of tiles
auto make_tile = [](const TA::Range& range,
auto make_tile = [](const TiledArray::Range& range,
const std::vector<madness::Future<Tile>>& tiles) {
TA_ASSERT(range.extent(0) == tiles.size());
Tile result(range);
Expand Down Expand Up @@ -392,10 +399,11 @@ TA::DistArray<Tile, Policy> fuse_tilewise_vector_of_arrays(
/// @sa detail::tilewise_slice_of_fused_shape
template <typename Tile, typename Policy>
void split_tilewise_fused_array(
madness::World& local_world, const TA::DistArray<Tile, Policy>& fused_array,
madness::World& local_world,
const TiledArray::DistArray<Tile, Policy>& fused_array,
std::size_t tile_idx,
std::vector<TA::DistArray<Tile, Policy>>& split_arrays,
const TA::TiledRange& split_trange) {
std::vector<TiledArray::DistArray<Tile, Policy>>& split_arrays,
const TiledArray::TiledRange& split_trange) {
TA_ASSERT(tile_idx < fused_array.trange().dim(0).extent());
auto arrays_size = split_arrays.size();

Expand All @@ -410,13 +418,13 @@ void split_tilewise_fused_array(
auto split_shape = detail::tilewise_slice_of_fused_shape(
split_trange, shape, tile_idx, split_ntiles, tile_size);
// create split Array object
TA::DistArray<Tile, Policy> split_array(local_world, split_trange,
split_shape);
TiledArray::DistArray<Tile, Policy> split_array(local_world, split_trange,
split_shape);
split_arrays.push_back(split_array);
}

/// copy the data from tile
auto make_tile = [](const TA::Range& range, const Tile& fused_tile,
auto make_tile = [](const TiledArray::Range& range, const Tile& fused_tile,
const size_t i_offset_in_tile) {
const auto split_tile_volume = range.volume();
return Tile(range,
Expand Down
29 changes: 17 additions & 12 deletions src/TiledArray/dist_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,28 @@ class DistArray : public madness::archive::ParallelSerializableObject {
} else {
// Validate the process map
TA_ASSERT(pmap->size() == trange.tiles_range().volume() &&
"Array::Array() -- The size of the process map is not "
"TiledArray::DistArray::DistArray() -- The size of the process "
"map is not "
"equal to the number of tiles in the TiledRange object.");
TA_ASSERT(
pmap->rank() == typename pmap_interface::size_type(world.rank()) &&
"Array::Array() -- The rank of the process map is not equal to that "
"of the world object.");
TA_ASSERT(
pmap->procs() == typename pmap_interface::size_type(world.size()) &&
"Array::Array() -- The number of processes in the process map is not "
"equal to that of the world object.");
TA_ASSERT(pmap->rank() ==
typename pmap_interface::size_type(world.rank()) &&
"TiledArray::DistArray::DistArray() -- The rank of the process "
"map is not equal to that "
"of the world object.");
TA_ASSERT(pmap->procs() ==
typename pmap_interface::size_type(world.size()) &&
"TiledArray::DistArray::DistArray() -- The number of processes "
"in the process map is not "
"equal to that of the world object.");
}

// Validate the shape
TA_ASSERT(!shape.empty() &&
"Array::Array() -- The shape is not initialized.");
TA_ASSERT(
!shape.empty() &&
"TiledArray::DistArray::DistArray() -- The shape is not initialized.");
TA_ASSERT(shape.validate(trange.tiles_range()) &&
"Array::Array() -- The range of the shape is not equal to "
"TiledArray::DistArray::DistArray() -- The range of the shape is "
"not equal to "
"the tiles range.");

return std::shared_ptr<impl_type>(new impl_type(world, trange, shape, pmap),
Expand Down
10 changes: 5 additions & 5 deletions src/TiledArray/dist_eval/array_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class LazyArrayTile {
using eval_t = typename eval_trait<typename std::decay<T>::type>::type;

public:
using conversion_result_type = decltype(
((!Op::is_consumable) && consume_ ? op_->consume(tile_)
: (*op_)(tile_))); ///< conversion_type
using conversion_result_type = decltype((
(!Op::is_consumable) && consume_ ? op_->consume(tile_)
: (*op_)(tile_))); ///< conversion_type

#ifdef TILEDARRAY_HAS_CUDA
// TODO need a better design on how to manage the lifetime of converted Tile
Expand Down Expand Up @@ -155,13 +155,13 @@ class LazyArrayTile {

}; // LazyArrayTile

/// Distributed evaluator for \c TiledArray::Array objects
/// Distributed evaluator for \c TiledArray::DistArray objects

/// This distributed evaluator applies modifications to Array that will be
/// used as input to other distributed evaluators. Common operations that
/// may be applied to array objects are scaling, permutation, and lazy tile
/// evaluation. It also serves as an abstraction layer between
/// \c TiledArray::Array objects and internal evaluation of expressions. The
/// \c TiledArray::DistArray objects and internal evaluation of expressions. The
/// main purpose of this evaluator is to do a lazy evaluation of input tiles
/// so that the resulting data is only evaluated when the tile is needed by
/// subsequent operations.
Expand Down
4 changes: 2 additions & 2 deletions src/TiledArray/expressions/tsr_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct ExprTrait<TsrExpr<const Array, false>>; // <----- This should never

/// Expression wrapper for array objects

/// \tparam Array The \c TiledArray::Array type
/// \tparam Array The \c TiledArray::DistArray type
/// \tparam Alias If true, the array tiles should be evaluated as
/// temporaries before assignment; if false, can reuse the result tiles
template <typename Array, bool Alias>
Expand Down Expand Up @@ -304,7 +304,7 @@ class TsrExpr : public Expr<TsrExpr<Array, Alias>> {

/// Expression wrapper for const array objects

/// \tparam A The \c TiledArray::Array type
/// \tparam A The \c TiledArray::DistArray type
template <typename Array>
class TsrExpr<const Array, true> : public Expr<TsrExpr<const Array, true>> {
public:
Expand Down
4 changes: 3 additions & 1 deletion src/TiledArray/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ typedef TSpArray<std::complex<float>> TSpArrayC;
// DistArray is rank-polymorphic
template <typename T, unsigned int = 0, typename Tile = Tensor<T>,
typename Policy = DensePolicy>
using Array = DistArray<Tile, Policy>;
using Array
[[deprecated("use TiledArray::DistArray or TiledArray::TArray<T>")]] =
DistArray<Tile, Policy>;

} // namespace TiledArray

Expand Down