Go to the documentation of this file.
20 #ifndef TILEDARRAY_DIST_EVAL_UNARY_EVAL_H__INCLUDED
21 #define TILEDARRAY_DIST_EVAL_UNARY_EVAL_H__INCLUDED
37 template <
typename Arg,
typename Op,
typename Policy>
40 public std::enable_shared_from_this<UnaryEvalImpl<Arg, Op, Policy>> {
69 template <
typename Perm,
typename = std::enable_if_t<
70 TiledArray::detail::is_permutation_v<Perm>>>
73 const std::shared_ptr<pmap_interface>&
pmap,
const Perm& perm,
108 typedef typename std::conditional<
109 op_type::is_consumable,
typename arg_type::value_type&,
110 const typename arg_type::value_type&>::type tile_argument_type;
114 #ifdef TILEDARRAY_HAS_CUDA
115 template <
typename U = value_type>
118 std::enable_if_t<detail::is_cuda_tile_v<U>,
void> eval_tile(
128 template <
typename U = value_type>
129 std::enable_if_t<!detail::is_cuda_tile_v<U>,
void> eval_tile(
134 void eval_tile(
const ordinal_type i, tile_argument_type tile) {
147 virtual int internal_eval() {
149 std::shared_ptr<UnaryEvalImpl_>
self =
150 std::enable_shared_from_this<UnaryEvalImpl_>::shared_from_this();
159 const typename pmap_interface::const_iterator
end = arg_.pmap()->end();
160 typename pmap_interface::const_iterator it = arg_.pmap()->begin();
161 for (; it !=
end; ++it) {
163 const auto index = *it;
165 if (!arg_.is_zero(index)) {
170 #ifdef TILEDARRAY_HAS_CUDA
172 &UnaryEvalImpl_::template eval_tile<>,
173 target_index, arg_.get(index));
176 target_index, arg_.get(index));
196 #endif // TILEDARRAY_DIST_EVAL_UNARY_EVAL_H__INCLUDED
virtual Future< value_type > get_tile(ordinal_type i) const
Get tile at index i.
World & world() const
World accessor.
Arg arg_type
The argument tensor type.
bool is_zero(const Index &i) const
Query for a zero tile.
ordinal_type perm_index_to_target(ordinal_type index) const
Permute index from a source index to a target index.
DistEvalImpl_::eval_type eval_type
Tile evaluation type.
DistEvalImpl_::shape_type shape_type
Shape type.
void set_tile(ordinal_type i, const value_type &value)
Set tensor value.
Tensor that is composed from an argument tensor.
UnaryEvalImpl(const arg_type &arg, World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap, const Perm &perm, const op_type &op)
Constructor.
DistEvalImpl_::trange_type trange_type
Tiled range type.
DistEvalImpl_::ordinal_type ordinal_type
Ordinal type.
DistEvalImpl_::TensorImpl_ TensorImpl_
The base, base class type.
eval_trait< value_type >::type eval_type
Tile evaluation type.
const std::shared_ptr< pmap_interface > & pmap() const
Tensor process map accessor.
DistEvalImpl_::range_type range_type
Range type.
Distributed evaluator implementation object.
constexpr auto end(Eigen::Matrix< _Scalar, _Rows, 1, _Options, _MaxRows, 1 > &m)
auto outer(const Permutation &p)
Tensor implementation and base for other tensor implementation objects.
#define TA_ASSERT(EXPR,...)
ordinal_type perm_index_to_source(ordinal_type index) const
Permute index from a target index to a source index.
DistEvalImpl< typename Op::result_type, Policy > DistEvalImpl_
The base class type.
TensorImpl_::ordinal_type ordinal_type
Ordinal type.
DistEvalImpl_::value_type value_type
Tile type.
DistEvalImpl_::pmap_interface pmap_interface
Process map interface type.
virtual ~UnaryEvalImpl()
Virtual destructor.
TensorImpl_::range_type range_type
Range type this tensor.
TensorImpl_::shape_type shape_type
Shape type.
TensorImpl_::pmap_interface pmap_interface
process map interface type
const trange_type & trange() const
Tiled range accessor.
const shape_type & shape() const
Tensor shape accessor.
UnaryEvalImpl< Arg, Op, Policy > UnaryEvalImpl_
This object type.
Op op_type
Tile evaluation operator type.
const madness::uniqueidT & id() const
Unique object id accessor.
TensorImpl_::trange_type trange_type
Tiled range type for this object.
An N-dimensional shallow copy wrapper for tile objects.
bool is_local(const Index &i) const
Query for a locally owned tile.
virtual void discard_tile(ordinal_type i) const
Discard a tile that is not needed.