Go to the documentation of this file.
20 #ifndef TILEDARRAY_ARRAY_H__INCLUDED
21 #define TILEDARRAY_ARRAY_H__INCLUDED
25 #include <madness/world/parallel_archive.h>
41 template <
typename,
typename>
43 namespace expressions {
44 template <
typename,
bool>
55 template <
typename Tile = Tensor<
double, Eigen::aligned_allocator<
double>>,
56 typename Policy = DensePolicy>
57 class DistArray :
public madness::archive::ParallelSerializableObject {
83 typedef typename impl_type::range_type::index
109 template <
typename OtherTile>
110 using is_my_type = std::is_same<DistArray_, DistArray<OtherTile, Policy>>;
112 template <
typename OtherTile>
114 std::enable_if_t<not is_my_type<OtherTile>::value>;
116 template <
typename Index>
118 std::is_integral_v<Index> || detail::is_integral_range_v<Index>;
120 template <
typename Index>
122 std::enable_if_t<is_integral_or_integral_range_v<Index>>;
124 template <
typename Index>
127 template <
typename Value>
130 std::is_same_v<std::decay_t<Value>,
value_type>;
133 std::shared_ptr<impl_type> pimpl_;
135 static madness::AtomicInt cleanup_counter_;
146 const madness::uniqueidT
id =
pimpl->id();
152 DistArray_::cleanup_counter_--;
154 }
catch (madness::MadnessException& e) {
156 "!! ERROR TiledArray: madness::MadnessException thrown in "
157 "Array::lazy_deleter().\n"
159 "!! ERROR TiledArray: The exception has been absorbed.\n"
160 "!! ERROR TiledArray: rank=%i\n",
161 e.what(),
world.rank());
165 }
catch (std::exception& e) {
167 "!! ERROR TiledArray: std::exception thrown in "
168 "Array::lazy_deleter().\n"
170 "!! ERROR TiledArray: The exception has been absorbed.\n"
171 "!! ERROR TiledArray: rank=%i\n",
172 e.what(),
world.rank());
178 "!! ERROR TiledArray: An unknown exception was thrown in "
179 "Array::lazy_deleter().\n"
180 "!! ERROR TiledArray: The exception has been absorbed.\n"
181 "!! ERROR TiledArray: rank=%i\n",
199 static std::shared_ptr<impl_type> init(World&
world,
202 std::shared_ptr<pmap_interface>
pmap) {
211 "Array::Array() -- The size of the process map is not "
212 "equal to the number of tiles in the TiledRange object.");
214 pmap->rank() ==
typename pmap_interface::size_type(
world.rank()) &&
215 "Array::Array() -- The rank of the process map is not equal to that "
216 "of the world object.");
218 pmap->procs() ==
typename pmap_interface::size_type(
world.size()) &&
219 "Array::Array() -- The number of processes in the process map is not "
220 "equal to that of the world object.");
225 "Array::Array() -- The shape is not initialized.");
227 "Array::Array() -- The range of the shape is not equal to "
259 const std::shared_ptr<pmap_interface>&
pmap =
260 std::shared_ptr<pmap_interface>())
273 const std::shared_ptr<pmap_interface>&
pmap =
274 std::shared_ptr<pmap_interface>())
302 template <
typename T>
306 template <
typename T>
310 template <
typename T>
314 template <
typename T>
318 template <
typename T>
322 template <
typename T>
353 template <
typename T>
357 template <
typename T>
361 template <
typename T>
365 template <
typename T>
369 template <
typename T>
373 template <
typename T>
384 template <
typename OtherTile,
typename = enable_if_not_my_type<OtherTile>>
386 *
this = foreach<Tile>(other, [](
Tile& result,
const OtherTile& source) {
398 template <
typename OtherTile,
typename Op>
400 *
this = foreach<Tile>(other, std::forward<Op>(op));
418 std::shared_ptr<const impl_type>
pimpl()
const {
return pimpl_; }
423 std::shared_ptr<impl_type>
pimpl() {
return pimpl_; }
428 std::weak_ptr<const impl_type>
weak_pimpl()
const {
return pimpl_; }
446 world.await([&]() {
return (cleanup_counter_ == 0); },
true);
448 printf(
"%i: Array lazy cleanup timeout with %i pending cleanup(s)\n",
449 world.rank(),
int(cleanup_counter_));
466 pimpl_ = other.pimpl_;
477 madness::uniqueidT
id()
const {
return impl_ref().id(); }
522 template <
typename Index,
523 typename = enable_if_is_integral_or_integral_range<Index>>
526 return pimpl_->
get(i);
542 template <
typename Integer,
typename = enable_if_is_
integral<Integer>>
544 return find<std::initializer_list<Integer>>(i);
553 template <
typename Index,
554 typename = std::enable_if_t<std::is_integral_v<Index> ||
555 detail::is_integral_range_v<Index>>>
557 check_local_index(i);
567 template <
typename Integer,
568 typename = std::enable_if_t<(std::is_integral_v<Integer>)>>
570 const std::initializer_list<Integer>& i)
const {
571 return find_local<std::initializer_list<Integer>>(i);
580 template <
typename Index,
581 typename = std::enable_if_t<std::is_integral_v<Index> ||
582 detail::is_integral_range_v<Index>>>
584 check_local_index(i);
594 template <
typename Integer,
595 typename = std::enable_if_t<(std::is_integral_v<Integer>)>>
597 return find_local<std::initializer_list<Integer>>(i);
616 typename Index,
typename InIter,
617 typename = std::enable_if_t<is_integral_or_integral_range_v<Index> &&
619 void set(
const Index& i, InIter first) {
639 template <
typename Integer,
typename InIter,
640 typename = std::enable_if_t<(std::is_integral_v<Integer>)&&detail::
641 is_input_iterator<InIter>::value>>
643 const std::initializer_list<Integer>& i, InIter first) {
644 set<std::initializer_list<Integer>>(i, first);
666 template <
typename Index,
667 typename = enable_if_is_integral_or_integral_range<Index>>
692 template <
typename Integer,
typename = enable_if_is_
integral<Integer>>
693 void set(
const std::initializer_list<Integer>& i,
695 set<std::initializer_list<Integer>>(i, value);
713 typename Index,
typename Value,
714 typename = std::enable_if_t<(is_integral_or_integral_range_v<Index> &&
715 is_value_or_future_to_value_v<Value>)>>
716 void set(
const Index& i, Value&& v) {
718 pimpl_->
set(i, std::forward<Value>(v));
735 typename Index,
typename Value,
736 typename = std::enable_if_t<
737 (std::is_integral_v<Index>)&&is_value_or_future_to_value_v<Value>>>
738 void set(
const std::initializer_list<Index>& i, Value&& v) {
739 set<std::initializer_list<Index>>(i, std::forward<Value>(v));
751 bool skip_set =
false) {
833 template <
typename Op>
841 auto it = impl_ref().pmap()->begin();
842 const auto end = pimpl_->
pmap()->end();
843 for (; it !=
end; ++it) {
844 const auto&
index = *it;
848 if (fut.probe())
continue;
853 auto pimpl_ptr =
pimpl.lock();
855 return op_shared_handle(
856 pimpl_ptr->trange().make_tile_range(
index));
889 template <
typename Op>
893 [op = std::move(op_shared_handle)](
899 for (
auto& idx :
range) tile[idx] = op(idx);
940 [[deprecated(
"use DistArray::elements_range()")]]
const typename trange_type::
959 return impl_ref().trange().elements_range();
972 auto size()
const {
return impl_ref().size(); }
981 const std::string& vars)
const {
982 check_str_index(vars);
994 const std::string& vars) {
995 check_str_index(vars);
1007 World&
world()
const {
return impl_ref().world(); }
1010 [[deprecated]]
const std::shared_ptr<pmap_interface>&
get_pmap()
const {
1019 const std::shared_ptr<pmap_interface>&
pmap()
const {
1020 return impl_ref().pmap();
1028 bool is_dense()
const {
return impl_ref().is_dense(); }
1056 template <
typename Index,
1057 typename = enable_if_is_integral_or_integral_range<Index>>
1060 return pimpl_->
owner(i);
1077 template <
typename Index,
typename = enable_if_is_
integral<Index>>
1078 ProcessID
owner(
const std::initializer_list<Index>& i)
const {
1079 return owner<std::initializer_list<Index>>(i);
1096 template <
typename Index,
1097 typename = enable_if_is_integral_or_integral_range<Index>>
1116 template <
typename Index,
typename = enable_if_is_
integral<Index>>
1117 bool is_local(
const std::initializer_list<Index>& i)
const {
1118 return is_local<std::initializer_list<Index>>(i);
1135 template <
typename Index,
1136 typename = enable_if_is_integral_or_integral_range<Index>>
1155 template <
typename Index,
typename = enable_if_is_
integral<Index>>
1156 bool is_zero(
const std::initializer_list<Index>& i)
const {
1157 return is_zero<std::initializer_list<Index>>(i);
1172 auto pmap = std::make_shared<detail::ReplicatedPmap>(
world(),
size());
1178 std::make_shared<detail::Replicator<DistArray_>>(*
this, result);
1183 madness::detail::deferred_cleanup(
world(), replicator);
1197 typename shape_type::value_type thresh = shape_type::threshold()) {
1220 template <
typename Archive,
1221 typename = std::enable_if_t<
1222 !Archive::is_parallel_archive &&
1227 ar&
typeid(*this).hash_code() &
world().size() &
world().rank() &
trange() &
1228 shape() &
typeid(
pmap().get()).hash_code();
1230 for (
auto it =
begin(); it !=
end(); ++it) ++count;
1232 for (
auto it =
begin(); it !=
end(); ++it) ar & it->get();
1240 template <
typename Archive,
1241 typename = std::enable_if_t<
1242 !Archive::is_parallel_archive &&
1247 std::size_t typeid_hash = 0l;
1249 if (typeid_hash !=
typeid(*this).hash_code())
1251 "DistArray::serialize: source DistArray type != this DistArray type");
1253 ProcessID world_size = -1;
1254 ProcessID world_rank = -1;
1255 ar& world_size& world_rank;
1256 if (world_size !=
world.size() || world_rank !=
world.rank())
1258 "DistArray::serialize: source DistArray world != this DistArray "
1268 size_t pmap_hash_code = 0;
1270 if (pmap_hash_code !=
typeid(
pmap.get()).hash_code())
1272 "DistArray::serialize: source DistArray pmap != this DistArray pmap");
1278 for (
auto it =
begin(); it !=
end(); ++it, --count) {
1281 this->
set(it.ordinal(), std::move(tile));
1285 "DistArray::serialize: # of tiles in archive != # of tiles expected");
1299 template <
typename Archive>
1301 auto me =
world.rank();
1302 const Tag tag =
world.mpi.unique_tag();
1304 if (ar.dofence())
world.gop.fence();
1306 if (ar.is_io_node()) {
1308 auto& localar = ar.local_archive();
1312 std::size_t typeid_hash = 0l;
1313 localar& typeid_hash;
1314 if (typeid_hash !=
typeid(*this).hash_code())
1316 "DistArray::load: source DistArray type != this DistArray type");
1319 int num_io_clients = 0;
1320 localar& num_io_clients;
1321 if (num_io_clients != ar.num_io_clients())
1322 TA_EXCEPTION(
"DistArray::load: invalid parallel archive");
1329 for (ProcessID p = 0; p <
world.size(); ++p) {
1330 if (p != me && ar.io_node(p) == me) {
1331 world.mpi.Send(
int(1), p, tag);
1332 madness::archive::MPIOutputArchive dest(
world, p);
1346 for (
size_t ord = 0; ord !=
volume; ++ord) {
1348 auto owner_rank =
pmap->owner(ord);
1349 if (ar.io_node(owner_rank) == me) {
1352 this->
set(ord, std::move(tile));
1359 "DistArray::load: # of tiles in archive != # of tiles expected");
1365 ProcessID p = ar.my_io_node();
1367 world.mpi.Recv(flag, p, tag);
1369 madness::archive::MPIInputArchive source(
world, p);
1379 if (ar.dofence())
world.gop.fence();
1391 template <
typename Archive>
1393 auto me =
world().rank();
1395 if (ar.dofence())
world().gop.fence();
1397 if (ar.is_io_node()) {
1398 auto& localar = ar.local_archive();
1400 localar&
typeid(*this).hash_code() & ar.num_io_clients() &
trange() &
1407 for (
size_t ord = 0; ord !=
volume; ++ord) {
1409 const auto owner_rank =
pmap()->owner(ord);
1410 if (ar.io_node(owner_rank) == me) {
1416 for (
size_t ord = 0; ord !=
volume; ++ord) {
1418 auto owner_rank =
pmap()->owner(ord);
1419 if (ar.io_node(owner_rank) == me) localar&
find(ord).get();
1423 if (ar.dofence())
world().gop.fence();
1433 std::function<
void(
const impl_type&, int64_t)> notifier = {}) {
1438 template <
typename Index>
1439 std::enable_if_t<std::is_integral_v<Index>,
void> check_index(
1440 const Index i)
const {
1443 "The ordinal index used to access an array tile is out of range.");
1446 template <
typename Index>
1447 std::enable_if_t<detail::is_integral_range_v<Index>,
void> check_index(
1448 const Index& i)
const {
1451 "The coordinate index used to access an array tile is out of range.");
1454 template <
typename Index1>
1455 void check_index(
const std::initializer_list<Index1>& i)
const {
1456 check_index<std::initializer_list<Index1>>(i);
1459 template <
typename Index>
1460 std::enable_if_t<std::is_integral_v<Index>,
void> check_local_index(
1461 const Index i)
const {
1465 "The ordinal index used to access an array tile is not local.");
1468 template <
typename Index>
1469 std::enable_if_t<detail::is_integral_range_v<Index>,
void> check_local_index(
1470 const Index& i)
const {
1474 &&
"The coordinate index used to access an array tile is not local.");
1477 template <
typename Index1>
1478 void check_local_index(
const std::initializer_list<Index1>& i)
const {
1479 check_local_index<std::initializer_list<Index1>>(i);
1489 void check_str_index(
const std::string& vars)
const {
1490 #if (TA_ASSERT_POLICY != TA_ASSERT_IGNORE)
1495 constexpr
bool is_tot = detail::is_tensor_of_tensor_v<value_type>;
1504 TA_ASSERT(std::count(vars.begin(), vars.begin() + vars.find(
';'),
',') +
1514 TA_ASSERT(std::count(vars.begin(), vars.end(),
',') + 1ul ==
rank);
1520 void assert_pimpl()
const {
1522 "The Array has not been initialized, likely reason: it was "
1523 "default constructed and used.");
1535 auto& impl_ref()
const {
1556 template <
typename Tile,
typename Policy>
1557 madness::AtomicInt DistArray<Tile, Policy>::cleanup_counter_;
1559 #ifndef TILEDARRAY_HEADER_ONLY
1561 extern template class DistArray<
1562 Tensor<double, Eigen::aligned_allocator<double>>, DensePolicy>;
1563 extern template class DistArray<Tensor<float, Eigen::aligned_allocator<float>>,
1565 extern template class DistArray<Tensor<int, Eigen::aligned_allocator<int>>,
1567 extern template class DistArray<Tensor<long, Eigen::aligned_allocator<long>>,
1575 extern template class DistArray<
1576 Tensor<double, Eigen::aligned_allocator<double>>, SparsePolicy>;
1577 extern template class DistArray<Tensor<float, Eigen::aligned_allocator<float>>,
1579 extern template class DistArray<Tensor<int, Eigen::aligned_allocator<int>>,
1581 extern template class DistArray<Tensor<long, Eigen::aligned_allocator<long>>,
1589 #endif // TILEDARRAY_HEADER_ONLY
1601 template <
typename Tile,
typename Policy>
1604 if (a.
world().rank() == 0) {
1605 for (std::size_t i = 0; i < a.
size(); ++i)
1609 os << i <<
": " << tile <<
"\n";
1612 a.
world().gop.fence();
1616 template <
typename Tile,
typename Policy>
1618 return a.
trange().tiles_range().rank();
1621 template <
typename Tile,
typename Policy>
1625 return a.
trange().elements_range().volume();
1629 template <
typename Tile,
typename Policy>
1634 template <
typename Tile,
typename Policy>
1639 template <
typename Tile,
typename Policy>
1646 template <
typename Tile,
typename Policy>
1654 template <
typename Tile,
typename Policy>
1659 template <
typename Tile,
typename Policy>
1669 template <
class Tile,
class Policy>
1672 static inline void load(
const ParallelInputArchive& ar,
1674 x.
load(*ar.get_world(), ar);
1678 template <
class Tile,
class Policy>
1681 static inline void store(
const ParallelOutputArchive& ar,
1688 template <
class Tile,
class Policy>
1690 const std::string name) {
1691 archive::ParallelOutputArchive ar2(x.
world(), name.c_str(), 1);
1695 template <
class Tile,
class Policy>
1697 archive::ParallelInputArchive ar2(x.
world(), name.c_str(), 1);
1703 #endif // TILEDARRAY_ARRAY_H__INCLUDED
const std::shared_ptr< pmap_interface > & get_pmap() const
auto norm2(const DistArray< Tile, Policy > &a)
static std::function< void(const ArrayImpl_ &, int64_t)> & set_notifier_accessor()
impl_type::const_iterator const_iterator
Local tile const iterator.
bool is_initialized() const
Check if the array is initialized.
Tensor implementation and base for other tensor implementation objects.
impl_type::range_type::index1_type index1_type
1-index type
static void store(const ParallelOutputArchive &ar, const TiledArray::DistArray< Tile, Policy > &x)
DistArray(World &world, detail::tensor4_il< T > il)
std::enable_if_t< is_integral_or_integral_range_v< Index > > enable_if_is_integral_or_integral_range
static void register_set_notifier(std::function< void(const impl_type &, int64_t)> notifier={})
Debugging/tracing instrumentation.
impl_type::value_type value_type
Tile type.
TensorImpl_::ordinal_type ordinal_type
Ordinal type.
std::string dummy_annotation(unsigned int n_outer_size, unsigned int n_inner_size=0)
void swap(DistArray_ &other)
Swap this array with other.
DistArray_ clone() const
Create a deep copy of this array.
World & world() const
World accessor.
TiledArray::expressions::TsrExpr< DistArray_, true > operator()(const std::string &vars)
Create a tensor expression.
impl_type::reference reference
future type
const Future< value_type > & find_local(const Index &i) const
Find local tile.
impl_type::pmap_interface pmap_interface
Process map interface type.
const_iterator end() const
End const iterator factory function.
const_iterator begin() const
Begin const iterator factory function.
TiledArray::expressions::TsrExpr< const DistArray_, true > operator()(const std::string &vars) const
Create a tensor expression.
detail::numeric_type< Tile >::type numeric_type
std::enable_if< detail::is_input_iterator< InIter >::value >::type set(const std::initializer_list< Integer > &i, InIter first)
madness::uniqueidT id() const
Global object id.
TensorImpl_::index1_type index1_type
1-index type
DistArray_ & operator=(const DistArray_ &other)
Copy assignment.
TensorImpl_::range_type range_type
Elements/tiles range type.
void wait_for_lazy_cleanup() const
Wait for lazy tile cleanup.
void swap(Bitset< B > &b0, Bitset< B > &b1)
auto inner_product(const DistArray< Tile, Policy > &a, const DistArray< Tile, Policy > &b)
std::shared_ptr< const impl_type > pimpl() const
Accessor for the (shared_ptr to) implementation object.
DistArray(World &world, const trange_type &trange, detail::tensor4_il< T > il)
Expression wrapper for array objects.
DistArray()
Default constructor.
impl_type::trange_type trange_type
Tile range type.
Distributed tensor iterator.
DistArray(World &world, const trange_type &trange, detail::tensor3_il< T > il)
bool is_zero(const Index &i) const
Query for a zero tile.
TensorImpl_::pmap_interface pmap_interface
process map interface type
const range_type & tiles_range() const
Tile range accessor.
Type trait for extracting the scalar type of tensors and arrays.
void fill_local(const element_type &value=element_type(), bool skip_set=false)
Fill all local tiles with the specified value.
void set(const Index &i, InIter first)
std::initializer_list< T > vector_il
impl_type::const_reference const_reference
future type
DistArray< Tile, Policy > DistArray_
This object's type.
DistArray< Tile, Policy > clone(const DistArray< Tile, Policy > &arg)
Create a deep copy of an array.
TensorImpl_::policy_type policy_type
Policy type for this object.
Future< value_type > find(const std::initializer_list< Integer > &i) const
Find local or remote tile.
void serialize(const Archive &ar)
deserialize local contents of a DistArray from an Archive object
auto make_op_shared_handle(Op &&op)
auto dot(const DistArray< Tile, Policy > &a, const DistArray< Tile, Policy > &b)
std::weak_ptr< impl_type > weak_pimpl()
Accessor for the (shared_ptr to) implementation object.
const std::shared_ptr< pmap_interface > & pmap() const
Tensor process map accessor.
void fill_random(bool skip_set=false)
auto abs_min(const DistArray< Tile, Policy > &a)
impl_type::range_type range_type
Elements/tiles range type.
auto rank(const DistArray< Tile, Policy > &a)
typename tensor_type::value_type value_type
value type
const shape_type & get_shape() const
typename T::policy_type policy_t
static constexpr bool is_value_or_future_to_value_v
iterator begin()
Begin iterator factory function.
impl_type::eval_type eval_type
The tile evaluation type.
std::initializer_list< tensor4_il< T > > tensor5_il
DistArray(const DistArray< OtherTile, Policy > &other, Op &&op)
Unary transform constructor.
void init_elements(Op &&op, bool skip_set=false)
Initialize elements of local, non-zero tiles with a user provided functor.
DistArray(World &world, detail::matrix_il< T > il)
auto array_from_il(World &world, const TiledRange &trange, T &&il)
Converts an std::initializer_list into a tiled array.
bool is_local(const std::initializer_list< Index > &i) const
Check if the tile at index i is stored locally.
auto abs_max(const DistArray< Tile, Policy > &a)
DistArray(World &world, const trange_type &trange, detail::matrix_il< T > il)
#define TA_ASSERT(EXPR,...)
World & get_default_world()
static void wait_for_lazy_cleanup(World &world, const double=60.0)
Wait for lazy tile cleanup.
bool is_tot_index(const std::string &idx)
ProcessID owner(const Index &i) const
Query a tile owner.
void load(TiledArray::DistArray< Tile, Policy > &x, const std::string name)
auto size() const
Returns the number of tiles in the tensor.
const trange_type & trange() const
Tiled range accessor.
DistArray(World &world, const trange_type &trange, detail::tensor5_il< T > il)
Future< value_type > find(const Index &i) const
Find local or remote tile by index.
auto squared_norm(const DistArray< Tile, Policy > &a)
std::initializer_list< tensor5_il< T > > tensor6_il
const shape_type & shape() const
Shape accessor.
impl_type::policy_type policy_type
Policy type.
void set(const Index &i, Value &&value)
Set tile.
const range_type & range() const
Tile range accessor.
DistArray(World &world, const trange_type &trange, detail::vector_il< T > il)
std::initializer_list< matrix_il< T > > tensor3_il
DistArray(World &world, detail::vector_il< T > il)
DistArray(World &world, detail::tensor5_il< T > il)
DistArray(World &world, const trange_type &trange, const shape_type &shape, const std::shared_ptr< pmap_interface > &pmap=std::shared_ptr< pmap_interface >())
Sparse array constructor.
std::weak_ptr< const impl_type > weak_pimpl() const
Accessor for the (weak_ptr to) implementation object.
value_type::value_type element_type
impl_type::iterator iterator
Local tile iterator.
iterator end()
End iterator factory function.
DistArray(World &world, const trange_type &trange, const std::shared_ptr< pmap_interface > &pmap=std::shared_ptr< pmap_interface >())
Dense array constructor.
World & world() const
World accessor.
static constexpr bool is_integral_or_integral_range_v
DistArray(World &world, detail::tensor3_il< T > il)
const future & get_local(const Index &i) const
Local tile future accessor.
void set(const std::initializer_list< Index > &i, Value &&v)
Set a tile directly using a future to a tile.
bool is_local(const Index &i) const
Check if the tile at index i is stored locally.
World & get_world() const
std::ostream & operator<<(std::ostream &os, const DistArray< Tile, Policy > &a)
Add the tensor to an output stream.
impl_type::ordinal_type ordinal_type
Ordinal type.
static ValueType generate_value()
Generates a random value of type ValueType.
void save(const TiledArray::DistArray< Tile, Policy > &x, const std::string name)
std::initializer_list< vector_il< T > > matrix_il
const trange_type::range_type & elements_range() const
Element range accessor.
void store(Archive &ar) const
Stores this array to an Archive object.
bool is_zero(const Index &i) const
Check for zero tiles.
std::enable_if_t< not is_my_type< OtherTile >::value > enable_if_not_my_type
Future< value_type > & find_local(const std::initializer_list< Integer > &i)
Find local tile.
TiledArray::detail::ArrayImpl< Tile, Policy > impl_type
The type of the PIMPL.
bool is_zero(const std::initializer_list< Index > &i) const
Check for zero tiles.
impl_type::range_type::index index
Array coordinate index type.
DistArray(World &world, const trange_type &trange, detail::tensor6_il< T > il)
size_t volume(const DistArray< Tile, Policy > &a)
DistArray(const DistArray< OtherTile, Policy > &other)
converting copy constructor
eval_trait< Tile >::type eval_type
The tile evaluation type.
void set(const std::initializer_list< Integer > &i, const element_type &value=element_type())
Set every element of a tile to a specified value.
void init_tiles(Op &&op, bool skip_set=false)
Initialize (local) tiles with a user provided functor.
const trange_type::range_type & elements() const
DistArray(World &world, detail::tensor6_il< T > il)
Type trait for extracting the numeric type of tensors and arrays.
std::shared_ptr< impl_type > pimpl()
Accessor for the (shared_ptr to) implementation object.
constexpr bool is_replicated(World &world, const DenseShape &t)
std::initializer_list< tensor3_il< T > > tensor4_il
void serialize(const Archive &ar) const
serialize local contents of a DistArray to an Archive object
future get(const Index &i) const
Tile future accessor.
std::enable_if_t< is_dense_v< Policy >, void > truncate(DistArray< Tile, Policy > &array, typename Policy::shape_type::value_type=0)
Truncate a dense Array.
Future< value_type > & find_local(const Index &i)
Find local tile.
void fill(const element_type &value=numeric_type(), bool skip_set=false)
Fill all local tiles with the specified value.
std::enable_if_t< can_make_random_v< T > > enable_if_can_make_random_t
const trange_type & trange() const
Tiled range accessor.
impl_type::reference future
Future of value_type.
TensorImpl_::trange_type trange_type
Tiled range type for this object.
detail::scalar_type< Tile >::type scalar_type
bool is_dense() const
Check dense/sparse.
ProcessID owner(const Index &i) const
Tile ownership.
std::enable_if_t< std::is_integral_v< Index > > enable_if_is_integral
const std::shared_ptr< pmap_interface > & pmap() const
Process map accessor.
void load(World &world, Archive &ar)
DistArray(const DistArray_ &other)
Copy constructor.
void set(const Index &i, const element_type &value=element_type())
Set a tile and fill it using a value.
TensorImpl_::shape_type shape_type
Shape type.
An N-dimensional shallow copy wrapper for tile objects.
bool is_local(const Index &i) const
Query for a locally owned tile.
const Future< value_type > & find_local(const std::initializer_list< Integer > &i) const
Find local tile.
impl_type::shape_type shape_type
Shape type for array tiling.
void truncate(typename shape_type::value_type thresh=shape_type::threshold())
std::is_same< DistArray_, DistArray< OtherTile, Policy > > is_my_type
void set(const Index &i, Value &&v)
Set a tile directly using a future to a tile.
A (hyperrectangular) interval on , space of integer -indices.
ProcessID owner(const std::initializer_list< Index > &i) const
Tile ownership.