26 #ifndef TILEDARRAY_DIST_EVAL_ARRAY_EVAL_H__INCLUDED 27 #define TILEDARRAY_DIST_EVAL_ARRAY_EVAL_H__INCLUDED 41 template <
typename Tile,
typename Op>
51 std::shared_ptr<op_type> op_;
65 tile_(other.tile_), op_(other.op_), consume_(other.consume_)
74 tile_(
tile), op_(op), consume_(consume)
83 consume_ = other.consume_;
94 #ifdef __clang__ // clang's operator auto behavior is severely broken 98 using conversion_result_type =
99 decltype(((!Op::is_consumable) && consume_ ? op_->consume(tile_)
101 explicit operator conversion_result_type()
const {
102 return ((!Op::is_consumable) && consume_ ? op_->consume(tile_)
106 explicit operator auto()
const {
107 return ((!Op::is_consumable) && consume_ ? op_->consume(tile_)
118 template <
typename Archive>
137 template <
typename Array,
typename Op,
typename Policy>
139 public DistEvalImpl<LazyArrayTile<typename Array::value_type, Op>, Policy>,
140 public std::enable_shared_from_this<ArrayEvalImpl<Array, Op, Policy> >
155 using std::enable_shared_from_this<ArrayEvalImpl<Array, Op, Policy> >::shared_from_this;
159 std::shared_ptr<op_type> op_;
177 array_(array), op_(
std::make_shared<
op_type>(op)), block_range_()
194 const std::vector<std::size_t>& lower_bound,
195 const std::vector<std::size_t>& upper_bound) :
197 array_(array), op_(
std::make_shared<
op_type>(op)),
211 if(block_range_.
rank())
212 array_index = block_range_.
ordinal(array_index);
215 Future<typename array_type::value_type> tile =
216 array_.
find(array_index);
218 const bool consumable_tile = ! array_.
is_local(array_index);
222 Future<value_type> result;
223 result.set(make_tile(tile, consumable_tile));
228 Future<value_type> result =
230 & ArrayEvalImpl_::make_tile, tile, consumable_tile,
231 madness::TaskAttributes::hipri());
233 result.register_callback(const_cast<ArrayEvalImpl_*>(
this));
265 virtual int internal_eval() {
274 typename array_type::pmap_interface::const_iterator it =
276 const typename array_type::pmap_interface::const_iterator end =
279 for(; it != end; ++it) {
293 #endif // TILEDARRAY_DIST_EVAL_ARRAY_EVAL_H__INCLUDED TensorImpl_::size_type size_type
Size type.
DistEvalImpl< LazyArrayTile< typename Array::value_type, Op >, Policy > DistEvalImpl_
The base class type.
DistEvalImpl_::trange_type trange_type
tiled range type
Op op_type
The operation that will modify this tile.
DistEvalImpl_::pmap_interface pmap_interface
Process map interface type.
const shape_type & shape() const
Tensor shape accessor.
const trange_type & trange() const
Tiled range accessor.
ordinal_type ordinal(const Index &index) const
calculate the ordinal index of i
LazyArrayTile< Tile, Op > LazyArrayTile_
This class type.
bool is_dense() const
Query the density of the tensor.
DistEvalImpl_::size_type size_type
Size type.
DistEvalImpl_::range_type range_type
Range type.
Future< value_type > find(const Index &i) const
Find local or remote tile.
virtual Future< value_type > get_tile(size_type i) const
Get tile at index i.
LazyArrayTile()
Default constructor.
DistEvalImpl_::value_type value_type
value type
Op op_type
Tile evaluation operator type.
Distributed evaluator implementation object.
Determine the object type used in the evaluation of tensor expressions.
TensorImpl_::pmap_interface pmap_interface
process map interface type
DistEvalImpl_::shape_type shape_type
Shape type.
Tensor implementation and base for other tensor implementation objects.
virtual ~ArrayEvalImpl()
Virtual destructor.
void set_tile(size_type i, const value_type &value)
Set tensor value.
const tile_type & tile() const
return ref to input tile
TensorImpl_::trange_type trange_type
Tiled range type for this object.
ArrayEvalImpl(const array_type &array, World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap, const Permutation &perm, const op_type &op)
Construct with full array range.
unsigned int rank() const
Rank accessor.
LazyArrayTile_ & operator=(const LazyArrayTile_ &other)
Assignment operator.
ArrayEvalImpl(const array_type &array, World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap, const Permutation &perm, const op_type &op, const std::vector< std::size_t > &lower_bound, const std::vector< std::size_t > &upper_bound)
Constructor with sub-block range.
impl_type::value_type value_type
Tile type.
Lazy tile for on-the-fly evaluation of array tiles.
TensorImpl_::shape_type shape_type
Shape type.
bool is_zero(const Index &i) const
Query for a zero tile.
LazyArrayTile(const tile_type &tile, const std::shared_ptr< op_type > &op, const bool consume)
Construct from tile and operation.
bool is_local(const Index &i) const
Check if the tile at index i is stored locally.
op_type::result_type eval_type
virtual void discard_tile(size_type) const
Discard a tile that is not needed.
TensorImpl_::range_type range_type
Range type this tensor.
Tile tile_type
The input tile type.
Array array_type
The array type.
Permutation of a sequence of objects indexed by base-0 indices.
Range that references a subblock of another range.
ArrayEvalImpl< Array, Op, Policy > ArrayEvalImpl_
This object type.
Distributed evaluator for TiledArray::Array objects.
World & world() const
World accessor.
LazyArrayTile(const LazyArrayTile_ &other)
Copy constructor.
const range_type & tiles_range() const
Tiles range accessor.
bool is_consumable() const
Query runtime consumable status.
size_type perm_index_to_source(size_type index) const
Permute index from a target index to a source index.
const std::shared_ptr< pmap_interface > & pmap() const
Tensor process map accessor.
DistEvalImpl_::TensorImpl_ TensorImpl_
The base, base class type.
An N-dimensional shallow copy wrapper for tile objects.
virtual void notify()
Tile set notification.
void serialize(const Archive &)
Serialization (not implemented)