Go to the documentation of this file.
20 #ifndef TILEDARRAY_TENSOR_IMPL_H__INCLUDED
21 #define TILEDARRAY_TENSOR_IMPL_H__INCLUDED
38 template <
typename Policy>
48 typedef typename Policy::pmap_interface
55 std::shared_ptr<pmap_interface> pmap_;
68 const std::shared_ptr<pmap_interface>&
pmap)
72 TA_ASSERT(pmap_->size() == trange_.tiles_range().volume());
74 typename pmap_interface::size_type(world_.rank()));
76 typename pmap_interface::size_type(world_.size()));
77 TA_ASSERT(shape_.validate(trange_.tiles_range()));
89 const std::shared_ptr<pmap_interface>&
pmap()
const {
return pmap_; }
121 template <
typename Index>
122 ProcessID
owner(
const Index& i)
const {
123 TA_ASSERT(trange_.tiles_range().includes(i));
124 return pmap_->owner(trange_.tiles_range().ordinal(i));
133 template <
typename Index>
135 TA_ASSERT(trange_.tiles_range().includes(i));
136 return pmap_->is_local(trange_.tiles_range().ordinal(i));
146 template <
typename Index>
148 TA_ASSERT(trange_.tiles_range().includes(i));
149 return shape_.is_zero(trange_.tiles_range().ordinal(i));
156 bool is_dense()
const {
return shape_.is_dense(); }
170 [[deprecated]] World&
get_world()
const {
return world_; }
175 World&
world()
const {
return world_; }
179 #ifndef TILEDARRAY_HEADER_ONLY
181 extern template class TensorImpl<DensePolicy>;
182 extern template class TensorImpl<SparsePolicy>;
184 #endif // TILEDARRAY_HEADER_ONLY
189 #endif // TILEDARRAY_TENSOR_IMPL_H__INCLUDED
Policy policy_type
Policy type.
World & world() const
World accessor.
virtual ~TensorImpl()
Virtual destructor.
World & get_world() const
ordinal_type size() const
Tensor tile volume accessor.
TensorImpl< Policy > TensorImpl_
bool is_zero(const Index &i) const
Query for a zero tile.
bool is_dense() const
Query the density of the tensor.
const range_type & tiles_range() const
Tiles range accessor.
const std::shared_ptr< pmap_interface > & pmap() const
Tensor process map accessor.
Tensor implementation and base for other tensor implementation objects.
#define TA_ASSERT(EXPR,...)
ProcessID owner(const Index &i) const
Query a tile owner.
Policy::ordinal_type ordinal_type
Ordinal type.
Policy::shape_type shape_type
Tensor shape type.
Policy::range_type range_type
Element/tile range type.
Policy::trange_type trange_type
Tiled range type.
ordinal_type local_size() const
Local element count.
TensorImpl(World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap)
Constructor.
Policy::pmap_interface pmap_interface
Process map interface type.
Policy::index1_type index1_type
1-index type
constexpr bool is_replicated(World &world, const DenseShape &t)
const trange_type & trange() const
Tiled range accessor.
const shape_type & shape() const
Tensor shape accessor.
bool is_local(const Index &i) const
Query for a locally owned tile.