32#ifndef MADNESS_WORLD_WORLDDC_H__INCLUDED
33#define MADNESS_WORLD_WORLDDC_H__INCLUDED
48#include <unordered_set>
60 template <
typename keyT,
typename valueT,
typename hashfunT>
63 template <
typename keyT,
typename valueT,
typename hashfunT>
64 class WorldContainerImpl;
66 template <
typename keyT,
typename valueT,
typename hashfunT>
67 void swap(WorldContainer<keyT, valueT, hashfunT> &, WorldContainer<keyT, valueT, hashfunT> &);
69 template <
typename keyT>
70 class WorldDCPmapInterface;
72 template <
typename keyT>
76 virtual std::size_t
size()
const = 0;
91 template<
typename T=
long>
99 template<
typename T=
long>
105 template<
typename T=
long>
108 std::transform(
type.begin(),
type.end(),
type.begin(), [](
unsigned char c){ return std::tolower(c); });
112 std::string msg=
"unknown distribution type:"+
type;
123 template <
typename keyT>
184 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
188 (*iter)->redistribute_phase1(
newpmap);
191 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
195 (*iter)->redistribute_phase2();
196 newpmap->register_callback(*iter);
199 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
203 (*iter)->redistribute_phase3();
207 newpmap->print_data_sizes(world,
"after redistributing");
226 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin(); iter !=
ptrs.end(); ++iter)
228 sum += (*iter)->size();
240 std::vector<std::size_t>
sizes(world.
size());
243 if (world.
rank() == 0)
247 std::cout <<
" procs: ";
248 for (
int i = 0; i < world.
size(); i++)
249 std::cout <<
sizes[i] <<
" ";
250 std::cout << std::endl;
259 template <
typename keyT,
typename hashfunT = Hash<keyT>>
283 template <
typename keyT,
typename hashfunT = Hash<keyT>>
307 template <
typename keyT>
322 template <
typename keyT,
typename hashfunT = Hash<keyT>>
346 template <
typename dcT>
350 World& world=dc.get_world();
351 auto result= dc.get_pmap()->distribution_type();
353 auto local_size=dc.
size();
354 auto global_size=local_size;
355 world.
gop.
sum(global_size);
358 std::unordered_map<hashT, size_t>
counts;
360 for (
const auto&
elem :
v) {
368 const auto& hashfun=dc.get_hash();
370 for (
auto it=dc.begin();it!=dc.end();++it,++i)
all_hashes[i]=hashfun(it->first);
412 template <
class internal_iteratorT>
417 typedef typename std::iterator_traits<internal_iteratorT>::value_type
value_type;
418 typedef typename std::iterator_traits<internal_iteratorT>::difference_type
difference_type;
419 typedef typename std::iterator_traits<internal_iteratorT>::pointer
pointer;
420 typedef typename std::iterator_traits<internal_iteratorT>::reference
reference;
423 internal_iteratorT
it;
449 template <
class iteratorT>
478 return !(*
this == other);
520 return value !=
nullptr;
523 template <
typename Archive>
530 template <
class iteratorT>
533 template <
class iteratorT>
536 if (
static_cast<const void *
>(
this) !=
static_cast<const void *
>(&other))
542 it = internal_iteratorT();
556 template <
typename keyT,
typename valueT,
typename hashfunT>
558 :
public WorldObject<WorldContainerImpl<keyT, valueT, hashfunT>>,
560#ifndef MADNESS_DISABLE_SHARED_FROM_THIS
562 public std::enable_shared_from_this<WorldContainerImpl<keyT, valueT, hashfunT>>
566 typedef typename std::pair<const keyT, valueT>
pairT;
597 std::shared_ptr<WorldDCPmapInterface<keyT>>
pmap;
674 pmap->register_callback(
this);
679 pmap->deregister_callback(
this);
682 const std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
const
687 std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
695 pmap->deregister_callback(
this);
697 pmap->register_callback(
this);
716 int complete = rank_replication_complete_ ? 1 : 0;
724 pmap->deregister_callback(
this);
726 pmap->register_callback(
this);
771 pmap->deregister_callback(
this);
773 pmap->register_callback(
this);
778 pmap->deregister_callback(
this);
780 pmap->register_callback(
this);
799 for (
auto it =
begin(); it !=
end(); ++it) {
800 keyT key = it->first;
801 valueT value = it->second;
817 pmap->deregister_callback(
this);
819 pmap->register_callback(
this);
863 std::size_t sz =
size();
866 for (
auto it =
begin(); it !=
end(); ++it)
868 keyT key = it->first;
869 valueT value = it->second;
879 for (
size_t i = 0; i < sz; i++)
885 received.emplace_back(std::move(key), std::move(value));
902 return pmap->owner(key);
928 acc->second = datum.second;
959 acc->second =
kv.second;
984 template <
typename InIter>
992 template <
typename InIter>
1069 template <
typename memfunT>
1076 return (
acc->second.*memfun)();
1080 template <
typename memfunT,
typename arg1T>
1087 return (
acc->second.*memfun)(
arg1);
1091 template <
typename memfunT,
typename arg1T,
typename arg2T>
1102 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1113 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1124 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1135 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1146 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1220 pmap->deregister_callback(
this);
1222 pmap->register_callback(
this);
1238 std::vector<ProcessID>
dsts;
1243 std::stable_partition(
dsts.begin(),
dsts.end(),
1248 std::vector<pairT> batch;
1250 for (std::size_t i = 0; i <
keys.size(); ++i)
1255 batch.push_back(
pairT(
keys[i], iter->second));
1297 template <
typename keyT,
typename valueT,
typename hashfunT = Hash<keyT>>
1314 std::shared_ptr<implT>
p;
1345 p->process_pending();
1362 p->process_pending();
1392 return p->get_pmap()->distribution_type();
1411 return p->get_world();
1414 std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_impl()
1426 p->replicate(fence);
1432 p->replicate_on_hosts(fence);
1440 p->redistribute_coalesced_phase1(
newpmap);
1449 p->redistribute_coalesced_phase2(
cap_boxes, rotate);
1469 return p->find(
acc, key);
1476 return p->find(
acc, key);
1483 return p->insert_acc(
acc, key);
1490 return p->insert_acc(
acc, key);
1494 template <
typename input_iterator>
1498 using std::placeholders::_1;
1506 return p->probe(key);
1516 return p->owner(key);
1523 return p->is_local(key);
1534 return p->find(key);
1545 return const_cast<const implT *
>(
p.get())->
find(key);
1559 return const_cast<const implT *
>(
p.get())->
begin();
1573 return const_cast<const implT *
>(
p.get())->
end();
1601 p->erase(start, finish);
1621 inline const std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
const
1624 return p->get_pmap();
1630 p->reset_pmap_to_local();
1637 return p->get_hash();
1648 p->process_pending();
1660 template <
typename memfunT>
1667 return p->send(
owner(key), itemfun, key, memfun);
1679 template <
typename memfunT,
typename arg1T>
1687 return p->send(
owner(key), itemfun, key, memfun,
arg1);
1702 template <
typename memfunT,
typename arg1T,
typename arg2T>
1724 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1743 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1762 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1768 (
implT::*itemfun)(
const keyT &,
memfunT,
const arg1T &,
const arg2T &,
const arg3T &,
const arg4T &,
const arg5T &) = &implT::template
itemfun<memfunT, arg1T, arg2T, arg3T, arg4T, arg5T>;
1781 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1787 (
implT::*itemfun)(
const keyT &,
memfunT,
const arg1T &,
const arg2T &,
const arg3T &,
const arg4T &,
const arg5T &,
const arg6T &) = &implT::template
itemfun<memfunT, arg1T, arg2T, arg3T, arg4T, arg5T, arg6T>;
1800 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1807 (
implT::*itemfun)(
const keyT &,
memfunT,
const arg1T &,
const arg2T &,
const arg3T &,
const arg4T &,
const arg5T &,
const arg6T &,
const arg7T &) = &implT::template
itemfun<memfunT, arg1T, arg2T, arg3T, arg4T, arg5T, arg6T, arg7T>;
1808 return p->send(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7);
1814 template <
typename memfunT>
1824 template <
typename memfunT,
typename arg1T>
1834 template <
typename memfunT,
typename arg1T,
typename arg2T>
1844 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1854 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1864 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1874 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1885 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1903 template <
typename memfunT>
1910 return p->task(
owner(key), itemfun, key, memfun, attr);
1923 template <
typename memfunT,
typename arg1T>
1931 return p->task(
owner(key), itemfun, key, memfun,
arg1, attr);
1944 template <
typename memfunT,
typename arg1T,
typename arg2T>
1953 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2, attr);
1966 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1989 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
2013 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
2024 (
implT::*itemfun)(
const keyT &,
memfunT,
const a1T &,
const a2T &,
const a3T &,
const a4T &,
const a5T &) = &implT::template
itemfun<memfunT, a1T, a2T, a3T, a4T, a5T>;
2038 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
2050 (
implT::*itemfun)(
const keyT &,
memfunT,
const a1T &,
const a2T &,
const a3T &,
const a4T &,
const a5T &,
const a6T &) = &implT::template
itemfun<memfunT, a1T, a2T, a3T, a4T, a5T, a6T>;
2051 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6, attr);
2064 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
2077 (
implT::*itemfun)(
const keyT &,
memfunT,
const a1T &,
const a2T &,
const a3T &,
const a4T &,
const a5T &,
const a6T &,
const a7T &) = &implT::template
itemfun<memfunT, a1T, a2T, a3T, a4T, a5T, a6T, a7T>;
2078 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7, attr);
2084 template <
typename memfunT>
2094 template <
typename memfunT,
typename arg1T>
2104 template <
typename memfunT,
typename arg1T,
typename arg2T>
2114 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
2124 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
2134 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
2144 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
2154 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
2164 template <
typename Archive>
2171 const long magic = 5881828;
2172 unsigned long count = 0;
2175 if (Archive::is_output_archive)
2217#ifdef MADNESS_DISABLE_SHARED_FROM_THIS
2218 p.reset(
static_cast<implT *
>(ptr), [](
implT *
p_) ->
void{});
2243 template <
typename keyT,
typename valueT,
typename hashfunT>
2258 template <
class keyT,
class valueT>
2264 const long magic = -5881828;
2266 using const_iterator =
typename dcT::const_iterator;
2267 int count = t.
size();
2281 const_iterator start, end;
2285 op_inspector(const_iterator start, const_iterator end,
size_t &size)
2286 : start(start), end(end), size(size) {}
2288 using TaskInterface::run;
2293 for (const_iterator it = start; it != end; ++it)
2301 const_iterator start, end;
2306 op_executor(const_iterator start, const_iterator end,
unsigned char *buf,
size_t size)
2307 : start(start), end(end), buf(buf), size(size) {}
2309 using TaskInterface::run;
2314 for (const_iterator it = start; it != end; ++it)
2325 size_t local_size = 0;
2326 double wall1 = wall0;
2327 unsigned char* buf = 0;
2334 const_iterator start = t.
begin();
2335 size_t nleft = count;
2338 const_iterator end = start;
2368 buf =
new unsigned char[local_size];
2396 const int size = local_size;
2405 for (
int i = 1; i < world->
size(); ++i)
2414 if (world->
rank() == 0)
2428 if (world->
rank() == 0)
2465 template <
class keyT,
class valueT,
class localarchiveT>
2470 const long magic = -5881828;
2473 typedef typename dcT::pairT pairT;
2494 unsigned long count = 0
ul;
2525 template <
class keyT,
class valueT,
class localarchiveT>
2539 const long magic = -5881828;
Group Incl(int n, const int *ranks) const
Definition safempi.h:437
Wrapper around MPI_Comm. Has a shallow copy constructor; use Create(Get_group()) for deep copy.
Definition safempi.h:497
Intracomm Create(Group group) const
Definition safempi.h:616
MPI_Comm & Get_mpi_comm() const
Definition safempi.h:716
int unique_tag()
Returns a unique tag for temporary use (1023<tag<4095)
Definition safempi.h:837
Group Get_group() const
Definition safempi.h:709
Definition worldhashmap.h:396
size_t size() const
Definition worldhashmap.h:560
iterator begin()
Definition worldhashmap.h:571
void erase(const iterator &it)
Definition worldhashmap.h:507
std::pair< iterator, bool > insert(const datumT &datum)
Definition worldhashmap.h:468
const hashfunT & get_hash() const
Definition worldhashmap.h:595
bool try_erase(const keyT &key)
Definition worldhashmap.h:502
iterator end()
Definition worldhashmap.h:583
iterator find(const keyT &key)
Definition worldhashmap.h:524
void clear()
Definition worldhashmap.h:556
Implements the functionality of futures.
Definition future.h:75
T & get(bool dowork=true)
Gets/forces the value, waiting if necessary.
Definition future.h:289
A future is a possibly yet unevaluated value.
Definition future.h:370
remote_refT remote_ref(World &world) const
Returns a structure used to pass references to another process.
Definition future.h:672
Definition worldhashmap.h:330
iterator for hash
Definition worldhashmap.h:188
Range, vaguely a la Intel TBB, to encapsulate a random-access, STL-like start and end iterator with c...
Definition range.h:64
iteratorT iterator
Alias for the iterator type.
Definition range.h:71
Simple structure used to manage references/pointers to remote instances.
Definition worldref.h:394
Contains attributes of a task.
Definition thread.h:330
All world tasks must be derived from this public interface.
Definition taskfn.h:69
static std::size_t size()
Returns the number of threads in the pool.
Definition thread.h:1460
Internal implementation of distributed container to facilitate shallow copy.
Definition worlddc.h:564
void erase(const keyT &key)
Definition worlddc.h:969
WorldContainerIterator< internal_iteratorT > iterator
Definition worlddc.h:579
const hashfunT & get_hash() const
Definition worlddc.h:893
bool find(const_accessor &acc, const keyT &key) const
Definition worlddc.h:1061
internal_containerT::accessor accessor
Definition worlddc.h:576
void find_handler(ProcessID requestor, const keyT &key, const RemoteReference< FutureImpl< iterator > > &ref)
Handles find request.
Definition worlddc.h:605
bool probe(const keyT &key) const
Definition worlddc.h:905
void find_success_handler(const RemoteReference< FutureImpl< iterator > > &ref, const pairT &datum)
Handles successful find response.
Definition worlddc.h:621
std::pair< const keyT, valueT > pairT
Definition worlddc.h:566
bool insert_const_acc(const_accessor &acc, const keyT &key)
Definition worlddc.h:943
void redistribute_coalesced_phase1(const std::shared_ptr< WorldDCPmapInterface< keyT > > &newpmap)
Definition worlddc.h:1217
WorldContainerIterator< internal_const_iteratorT > const_iteratorT
Definition worlddc.h:580
bool find(accessor &acc, const keyT &key)
Definition worlddc.h:1054
void redistribute_phase2()
Definition worlddc.h:1190
void insert(const pairT &datum)
Definition worlddc.h:919
WorldContainerIterator< internal_iteratorT > iteratorT
Definition worlddc.h:578
void clear()
Definition worlddc.h:963
bool insert_acc(accessor &acc, const keyT &key)
Definition worlddc.h:937
void find_const_failure_handler(const RemoteReference< FutureImpl< const_iterator > > &ref)
Handles unsuccessful const find response.
Definition worlddc.h:662
Future< iterator > find(const keyT &key)
Definition worlddc.h:1039
WorldContainerImpl(World &world, const std::shared_ptr< WorldDCPmapInterface< keyT > > &pm, const hashfunT &hf)
Definition worlddc.h:669
void redistribute_coalesced_phase2(std::size_t cap_boxes, bool rotate)
Definition worlddc.h:1235
void reset_pmap_to_local()
Definition worlddc.h:692
itemfun(const keyT &key, memfunT memfun)
Definition worlddc.h:1071
const pairT const_pairT
Definition worlddc.h:567
std::vector< keyT > * move_list
Tempoary used to record data that needs redistributing.
Definition worlddc.h:601
internal_containerT::iterator internal_iteratorT
Definition worlddc.h:574
WorldContainerImpl< keyT, valueT, hashfunT > implT
Definition worlddc.h:568
std::size_t size() const
Definition worlddc.h:914
void redistribute_phase1(const std::shared_ptr< WorldDCPmapInterface< keyT > > &newpmap)
Definition worlddc.h:1158
internal_containerT::const_iterator internal_const_iteratorT
Definition worlddc.h:575
std::shared_ptr< WorldDCPmapInterface< keyT > > pmap
Function/class to map from keys to owning process.
Definition worlddc.h:597
virtual ~WorldContainerImpl()
Definition worlddc.h:677
void do_replicate(World &world)
Definition worlddc.h:853
std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap()
Definition worlddc.h:687
internal_containerT local
Locally owned data.
Definition worlddc.h:600
ConcurrentHashMap< keyT, valueT, hashfunT > internal_containerT
Definition worlddc.h:570
void find_const_success_handler(const RemoteReference< FutureImpl< const_iterator > > &ref, const pairT &datum)
Handles successful const find response.
Definition worlddc.h:655
void insert_batch(const std::vector< pairT > &boxes)
Definition worlddc.h:953
const_iterator begin() const
Definition worlddc.h:1009
void erase(InIter it)
Definition worlddc.h:985
void replicate(bool fence)
Definition worlddc.h:711
const_iterator end() const
Definition worlddc.h:1019
bool is_local(const keyT &key) const
Definition worlddc.h:895
void redistribute_phase3()
Definition worlddc.h:1204
bool rank_replication_complete_
True if the last replicate() completed and no reset followed.
Definition worlddc.h:598
void find_failure_handler(const RemoteReference< FutureImpl< iterator > > &ref)
Handles unsuccessful find response.
Definition worlddc.h:631
ProcessID owner(const keyT &key) const
Definition worlddc.h:900
void erase(InIter first, InIter last)
Definition worlddc.h:993
void find_const_handler(ProcessID requestor, const keyT &key, const RemoteReference< FutureImpl< const_iterator > > &ref)
Handles const find request.
Definition worlddc.h:641
void replicate_on_hosts(bool fence)
Definition worlddc.h:737
const std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap() const
Definition worlddc.h:682
iterator begin()
Definition worlddc.h:1004
Future< const_iterator > find(const keyT &key) const
Definition worlddc.h:1024
const ProcessID me
My MPI rank.
Definition worlddc.h:599
iterator end()
Definition worlddc.h:1014
std::map< ProcessID, std::vector< keyT > > coalesced_move_
Temporary: keys to move, bucketed by destination (coalesced redistribute)
Definition worlddc.h:602
WorldContainerIterator< internal_const_iteratorT > const_iterator
Definition worlddc.h:581
internal_containerT::const_accessor const_accessor
Definition worlddc.h:577
Iterator for distributed container wraps the local iterator.
Definition worlddc.h:414
WorldContainerIterator(const WorldContainerIterator &other)
Definition worlddc.h:443
WorldContainerIterator(const internal_iteratorT &it)
Initializes from a local iterator.
Definition worlddc.h:433
WorldContainerIterator & operator++()
Pre-increment of an iterator (i.e., ++it) — local iterators only.
Definition worlddc.h:484
std::iterator_traits< internal_iteratorT >::iterator_category iterator_category
Definition worlddc.h:416
void copy(const WorldContainerIterator< iteratorT > &other)
Definition worlddc.h:534
std::iterator_traits< internal_iteratorT >::pointer pointer
Definition worlddc.h:419
bool operator==(const WorldContainerIterator &other) const
Determines if two iterators are identical.
Definition worlddc.h:469
const internal_iteratorT & get_internal_iterator() const
Private: (or should be) Returns iterator of internal container.
Definition worlddc.h:512
WorldContainerIterator & operator=(const WorldContainerIterator &other)
Assignment.
Definition worlddc.h:462
value_type * value
holds the remote values
Definition worlddc.h:425
bool is_cached() const
Returns true if this is non-local or cached value.
Definition worlddc.h:518
WorldContainerIterator operator++(int)
Definition worlddc.h:491
WorldContainerIterator(const value_type &v)
Initializes to cache a remote value.
Definition worlddc.h:437
pointer operator->() const
Iterators dereference to std::pair<const keyT,valueT>
Definition worlddc.h:500
std::iterator_traits< internal_iteratorT >::reference reference
Definition worlddc.h:420
void serialize(const Archive &)
Definition worlddc.h:524
std::iterator_traits< internal_iteratorT >::value_type value_type
Definition worlddc.h:417
WorldContainerIterator(const WorldContainerIterator< iteratorT > &other)
Definition worlddc.h:450
WorldContainerIterator()
Default constructor makes a local uninitialized value.
Definition worlddc.h:429
internal_iteratorT it
Iterator from local container.
Definition worlddc.h:423
reference operator*() const
Iterators dereference to std::pair<const keyT,valueT>
Definition worlddc.h:506
std::iterator_traits< internal_iteratorT >::difference_type difference_type
Definition worlddc.h:418
bool operator!=(const WorldContainerIterator &other) const
Determines if two iterators are different.
Definition worlddc.h:476
~WorldContainerIterator()
Definition worlddc.h:456
Makes a distributed container with specified attributes.
Definition worlddc.h:1299
void process_pending()
Process pending messages.
Definition worlddc.h:1645
WorldContainer(World &world, bool do_pending=true, const hashfunT &hf=hashfunT())
Makes an initialized, empty container with default data distribution (no communication)
Definition worlddc.h:1339
const hashfunT & get_hash() const
Returns a reference to the hashing functor.
Definition worlddc.h:1634
bool find(accessor &acc, const keyT &key)
Write access to LOCAL value by key. Returns true if found, false otherwise (always false for remote).
Definition worlddc.h:1466
bool probe(const keyT &key) const
Returns true if local data is immediately available (no communication)
Definition worlddc.h:1503
void redistribute_coalesced_phase2(std::size_t cap_boxes, bool rotate=true)
Definition worlddc.h:1446
const_iterator begin() const
Returns an iterator to the beginning of the local data (no communication)
Definition worlddc.h:1556
void replace(const keyT &key, const valueT &value)
Inserts/replaces key+value pair (non-blocking communication if key not local)
Definition worlddc.h:1460
bool insert(const_accessor &acc, const keyT &key)
Read access to LOCAL value by key. Returns true if inserted, false if already exists (throws if remot...
Definition worlddc.h:1487
iterator begin()
Returns an iterator to the beginning of the local data (no communication)
Definition worlddc.h:1549
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T) const" in process owning item (non-blocking ...
Definition worlddc.h:2136
WorldContainer(World &world, const std::shared_ptr< WorldDCPmapInterface< keyT > > &pmap, bool do_pending=true, const hashfunT &hf=hashfunT())
Makes an initialized, empty container (no communication)
Definition worlddc.h:1355
Future< iterator > find(const keyT &key)
Returns a future iterator (non-blocking communication if key not local)
Definition worlddc.h:1531
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6) const
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T) const" to item (non-blocking comm ...
Definition worlddc.h:1876
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const arg7T &arg7) const
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T,arg7T) const" to item (non-blocking...
Definition worlddc.h:1887
Future< const_iterator > const_futureT
Definition worlddc.h:1311
bool is_replicated() const
Definition worlddc.h:1399
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T)" in process owning item (non-blocking comm if remote)
Definition worlddc.h:1925
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5) const
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T) const" to item (non-blocking comm if rem...
Definition worlddc.h:1866
ProcessID owner(const keyT &key) const
Returns processor that logically owns key (no communication)
Definition worlddc.h:1513
implT::const_iterator const_iterator
Definition worlddc.h:1307
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T) const" in process owning item (non-blocking comm if remote)
Definition worlddc.h:2106
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun() const" in process owning item (non-blocking comm if remote)
Definition worlddc.h:2086
WorldContainer()
Makes an uninitialized container (no communication)
Definition worlddc.h:1327
void serialize(const archive::BufferOutputArchive &ar)
(de)Serialize — !! ONLY for purpose of interprocess communication
Definition worlddc.h:2202
keyT key_type
Definition worlddc.h:1302
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3)
Sends message "resultT memfun(arg1T,arg2T,arg3T)" to item (non-blocking comm if remote)
Definition worlddc.h:1726
void replicate(bool fence=true)
Definition worlddc.h:1424
virtual ~WorldContainer()
Destructor passes ownership of implementation to world for deferred cleanup.
Definition worlddc.h:2232
void erase(const keyT &key)
Erases entry from container (non-blocking comm if remote)
Definition worlddc.h:1584
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5)
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T)" to item (non-blocking comm if remote)
Definition worlddc.h:1764
void reset_pmap_to_local()
Returns shared pointer to the process mapping.
Definition worlddc.h:1628
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, const memfunT &memfun, const arg1T &arg1)
Sends message "resultT memfun(arg1T)" to item (non-blocking comm if remote)
Definition worlddc.h:1681
const uniqueidT & id() const
Returns the associated unique id ... must be initialized.
Definition worlddc.h:2225
void redistribute_coalesced_phase1(const std::shared_ptr< WorldDCPmapInterface< keyT > > &newpmap)
Definition worlddc.h:1437
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const arg7T &arg7, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T,arg7T)" in process owning item (non-blo...
Definition worlddc.h:2066
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T)" in process owning item (non-blocking comm if remote)
Definition worlddc.h:1946
WorldContainerImpl< keyT, valueT, hashfunT > implT
Definition worlddc.h:1304
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2) const
Sends message "resultT memfun(arg1T,arg2T) const" to item (non-blocking comm if remote)
Definition worlddc.h:1836
void replace(const pairT &datum)
Inserts/replaces key+value pair (non-blocking communication if key not local)
Definition worlddc.h:1453
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T,arg3T) const" in process owning item (non-blocking comm if remo...
Definition worlddc.h:2116
iterator end()
Returns an iterator past the end of the local data (no communication)
Definition worlddc.h:1563
const std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap() const
Returns shared pointer to the process mapping.
Definition worlddc.h:1621
std::shared_ptr< WorldDCPmapInterface< keyT > > & get_impl()
Definition worlddc.h:1414
void replace(input_iterator &start, input_iterator &end)
Inserts pairs (non-blocking communication if key(s) not local)
Definition worlddc.h:1495
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T) const" in process owning item (non-blocking comm if remote)
Definition worlddc.h:2096
bool insert(accessor &acc, const keyT &key)
Write access to LOCAL value by key. Returns true if inserted, false if already exists (throws if remo...
Definition worlddc.h:1480
Future< iterator > futureT
Definition worlddc.h:1310
void erase(const iterator &it)
Erases entry corresponding to local iterator (no communication)
Definition worlddc.h:1591
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T,arg3T, arg4T) const" in process owning item (non-blocking comm ...
Definition worlddc.h:2126
void erase(const iterator &start, const iterator &finish)
Erases range defined by local iterators (no communication)
Definition worlddc.h:1598
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4) const
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T) const" to item (non-blocking comm if remote)
Definition worlddc.h:1856
bool is_distributed() const
Definition worlddc.h:1395
WorldContainer(const WorldContainer &other)
Copy constructor is shallow (no communication)
Definition worlddc.h:1369
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T)" in process owning item (non-blocking ...
Definition worlddc.h:2040
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const arg7T &arg7)
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T,arg7T)" to item (non-blocking comm ...
Definition worlddc.h:1802
World & get_world() const
Returns the world associated with this container.
Definition worlddc.h:1408
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun) const
Sends message "resultT memfun() const" to item (non-blocking comm if remote)
Definition worlddc.h:1816
implT::iterator iterator
Definition worlddc.h:1306
DistributionType get_distribution_type() const
return the way data is distributed
Definition worlddc.h:1390
implT::pairT pairT
Definition worlddc.h:1305
std::size_t size() const
Returns the number of local entries (no communication)
Definition worlddc.h:1614
containerT & operator=(const containerT &other)
Assignment is shallow (no communication)
Definition worlddc.h:1379
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T)" in process owning item (non-blocking comm i...
Definition worlddc.h:2015
bool find(const_accessor &acc, const keyT &key) const
Read access to LOCAL value by key. Returns true if found, false otherwise (always false for remote).
Definition worlddc.h:1473
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T,arg3T)" in process owning item (non-blocking comm if remote)
Definition worlddc.h:1968
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4)
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T)" to item (non-blocking comm if remote)
Definition worlddc.h:1745
void serialize(const archive::BufferInputArchive &ar)
(de)Serialize — !! ONLY for purpose of interprocess communication
Definition worlddc.h:2211
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun()" in process owning item (non-blocking comm if remote)
Definition worlddc.h:1905
bool is_local(const keyT &key) const
Returns true if the key maps to the local processor (no communication)
Definition worlddc.h:1520
const_iterator end() const
Returns an iterator past the end of the local data (no communication)
Definition worlddc.h:1570
void serialize(const Archive &ar)
(de)Serialize — Local data only to/from anything except Buffer*Archive and Parallel*Archive
Definition worlddc.h:2165
bool is_host_replicated() const
Definition worlddc.h:1403
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T) const" in process owning item (non-blo...
Definition worlddc.h:2146
void clear()
Clears all local data (no communication)
Definition worlddc.h:1607
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const TaskAttributes &attr=TaskAttributes())
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T)" in process owning item (non-blocking comm if remo...
Definition worlddc.h:1991
Future< MEMFUN_RETURNT(memfunT)> send(const keyT &key, memfunT memfun)
Sends message "resultT memfun()" to item (non-blocking comm if remote)
Definition worlddc.h:1662
implT::const_accessor const_accessor
Definition worlddc.h:1309
std::shared_ptr< implT > p
Definition worlddc.h:1314
Future< const_iterator > find(const keyT &key) const
Returns a future iterator (non-blocking communication if key not local)
Definition worlddc.h:1542
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3) const
Sends message "resultT memfun(arg1T,arg2T,arg3T) const" to item (non-blocking comm if remote)
Definition worlddc.h:1846
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6)
Sends message "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T)" to item (non-blocking comm if rem...
Definition worlddc.h:1783
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2)
Sends message "resultT memfun(arg1T,arg2T)" to item (non-blocking comm if remote)
Definition worlddc.h:1704
void replicate_on_hosts(bool fence=true)
replicates this WorldContainer on all hosts (one PID per host)
Definition worlddc.h:1430
void check_initialized() const
Definition worlddc.h:1316
WorldContainer< keyT, valueT, hashfunT > containerT
Definition worlddc.h:1303
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> task(const keyT &key, memfunT memfun, const arg1T &arg1, const arg2T &arg2, const arg3T &arg3, const arg4T &arg4, const arg5T &arg5, const arg6T &arg6, const arg7T &arg7, const TaskAttributes &attr=TaskAttributes()) const
Adds task "resultT memfun(arg1T,arg2T,arg3T,arg4T,arg5T,arg6T,arg7T) const" in process owning item (n...
Definition worlddc.h:2156
Future< REMFUTURE(MEMFUN_RETURNT(memfunT))> send(const keyT &key, memfunT memfun, const arg1T &arg1) const
Sends message "resultT memfun(arg1T) const" to item (non-blocking comm if remote)
Definition worlddc.h:1826
implT::accessor accessor
Definition worlddc.h:1308
Default process map is "random" using madness::hash(key)
Definition worlddc.h:261
ProcessID owner(const keyT &key) const
Maps key to processor.
Definition worlddc.h:272
WorldDCDefaultPmap(World &world, const hashfunT &hf=hashfunT())
Definition worlddc.h:267
const int nproc
Definition worlddc.h:263
hashfunT hashfun
Definition worlddc.h:264
Local process map will always return the current process as owner.
Definition worlddc.h:285
ProcessID owner(const keyT &key) const override
Maps key to processor.
Definition worlddc.h:291
WorldDCLocalPmap(World &world)
Definition worlddc.h:290
ProcessID me
Definition worlddc.h:287
DistributionType distribution_type() const override
by default the map is distributed
Definition worlddc.h:296
DistributionType distribution_type() const override
by default the map is distributed
Definition worlddc.h:339
WorldDCNodeReplicatedPmap(World &world, const std::map< std::string, std::vector< long > > ranks_per_host)
Definition worlddc.h:330
ProcessID myowner
Definition worlddc.h:324
ProcessID owner(const keyT &key) const override
owner is the lowest rank on the node, same for all keys
Definition worlddc.h:335
Interface to be provided by any process map.
Definition worlddc.h:125
void redistribute(World &world, const std::shared_ptr< WorldDCPmapInterface< keyT > > &newpmap)
Invoking this switches all registered objects from this process map to the new one.
Definition worlddc.h:180
virtual DistributionType distribution_type() const
by default the map is distributed
Definition worlddc.h:145
virtual ProcessID single_owner() const
Definition worlddc.h:153
void print_data_sizes(World &world, const std::string msg="") const
Prints size info to std::cout.
Definition worlddc.h:236
std::size_t global_size(World &world) const
Counts global number of entries in all containers associated with this process map.
Definition worlddc.h:213
virtual ProcessID owner(const keyT &key) const =0
Maps key to processor.
void deregister_callback(ptrT ptr)
Deregisters object for receipt of redistribute callbacks.
Definition worlddc.h:169
void register_callback(ptrT ptr)
Registers object for receipt of redistribute callbacks.
Definition worlddc.h:161
virtual void print() const
Definition worlddc.h:142
std::size_t local_size() const
Counts local number of entries in all containers associated with this process map.
Definition worlddc.h:223
std::set< ptrT > ptrs
Definition worlddc.h:131
virtual ~WorldDCPmapInterface()
Definition worlddc.h:140
WorldDCRedistributeInterface< keyT > * ptrT
Definition worlddc.h:127
virtual void redistribute_phase3()=0
virtual std::size_t size() const =0
virtual void redistribute_phase2()=0
virtual void redistribute_phase1(const std::shared_ptr< WorldDCPmapInterface< keyT > > &newmap)=0
virtual ~WorldDCRedistributeInterface()
Definition worlddc.h:80
WorldDCSingleOwnerPmap(ProcessID owner)
Definition worlddc.h:314
const ProcessID owner_
Definition worlddc.h:311
ProcessID owner(const keyT &) const override
Maps key to processor.
Definition worlddc.h:315
ProcessID single_owner() const override
Definition worlddc.h:316
void broadcast_serializable(objT &obj, ProcessID root)
Broadcast a serializable object.
Definition worldgop.h:774
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:177
void broadcast(void *buf, size_t nbyte, ProcessID root, bool dowork=true, Tag bcast_tag=-1)
Broadcasts bytes from process root while still processing AM & tasks.
Definition worldgop.cc:189
void min(T *buf, size_t nelem)
Inplace global min while still processing AM & tasks.
Definition worldgop.h:896
std::vector< T > concat0(const std::vector< T > &v, size_t bufsz=1024 *1024)
Concatenate an STL vector of serializable stuff onto node 0.
Definition worldgop.h:973
void sum(T *buf, size_t nelem)
Inplace global sum while still processing AM & tasks.
Definition worldgop.h:890
SafeMPI::Intracomm & comm()
Returns the associated SafeMPI communicator.
Definition worldmpi.h:286
void Send(const T *buf, long lenbuf, int dest, int tag=SafeMPI::DEFAULT_SEND_RECV_TAG) const
Send array of lenbuf elements to process dest.
Definition worldmpi.h:347
void Recv(T *buf, long lenbuf, int src, int tag) const
Receive data of up to lenbuf elements from process src.
Definition worldmpi.h:374
Implements most parts of a globally addressable object (via unique ID).
Definition world_object.h:491
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn) const
Definition world_object.h:858
detail::task_result_type< memfnT >::futureT task(ProcessID dest, memfnT memfn, const TaskAttributes &attr=TaskAttributes()) const
Sends task to derived class method returnT (this->*memfn)().
Definition world_object.h:1132
Future< bool > for_each(const rangeT &range, const opT &op)
Apply op(item) on all items in range.
Definition world_task_queue.h:572
void add(TaskInterface *t)
Add a new local task, taking ownership of the pointer.
Definition world_task_queue.h:466
void fence()
Returns after all local tasks have completed.
Definition world_task_queue.h:1384
A parallel world class.
Definition world.h:134
WorldTaskQueue & taskq
Task queue.
Definition world.h:215
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
WorldMpiInterface & mpi
MPI interface.
Definition world.h:213
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:354
WorldGopInterface & gop
Global operations.
Definition world.h:216
bool dofence() const
Check if we should fence around a read/write operation.
Definition parallel_archive.h:295
World * get_world() const
Returns a pointer to the world.
Definition parallel_archive.h:130
bool is_io_node() const
Returns true if this node is doing physical I/O.
Definition parallel_archive.h:122
int num_io_clients() const
Returns the number of I/O clients for this node, including self (zero if not an I/O node).
Definition parallel_archive.h:114
ProcessID io_node(ProcessID rank) const
Returns the process doing I/O for given node.
Definition parallel_archive.h:99
ProcessID my_io_node() const
Returns the process doing I/O for this node.
Definition parallel_archive.h:106
Archive & local_archive() const
Returns a reference to the local archive.
Definition parallel_archive.h:248
Wraps an archive around a memory buffer for output.
Definition buffer_archive.h:59
std::size_t size() const
Return the amount of data stored (counted) in the buffer.
Definition buffer_archive.h:123
Archive allowing buffering, serialization of data, and point-to-point communication between processes...
Definition mpi_archive.h:118
void flush() const
Send all data in the buffer to the destination process.
Definition mpi_archive.h:158
An archive for storing local or parallel data wrapping a BinaryFstreamOutputArchive.
Definition parallel_archive.h:321
Objects that implement their own parallel archive interface should derive from this class.
Definition parallel_archive.h:58
Wraps an archive around an STL vector for output.
Definition vector_archive.h:55
Class for unique global IDs.
Definition uniqueid.h:53
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
void run(World &world, ansatzT ansatz, const int nuclear_charge, const commandlineparser &parser, const int nstates)
Definition dirac-hatom.cc:1392
static void load(const ParallelInputArchive< localarchiveT > &ar, WorldContainer< keyT, valueT > &t)
Read container from parallel archive.
Definition worlddc.h:2537
static const double v
Definition hatom_sf_dirac.cc:20
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:182
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
#define MADNESS_CHECK_THROW(condition, msg)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:207
Implements archives to serialize data for MPI.
void deferred_cleanup(World &world, const std::shared_ptr< objT > &p, bool assume_p_is_unique=false)
Defer the cleanup of a shared pointer to the end of the next fence.
Definition deferred_cleanup.h:135
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
DistributionType from_string(std::string type)
Definition worlddc.h:106
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:401
std::string to_string(const Representation r)
Definition Restart.h:64
DistributionType
some introspection of how data is distributed
Definition worlddc.h:84
@ NodeReplicated
even if there are several ranks per node
Definition worlddc.h:87
@ Distributed
no replication of the container, the container is distributed over the world
Definition worlddc.h:85
@ RankReplicated
replicate the container over all world ranks
Definition worlddc.h:86
std::vector< int > primary_ranks_per_host(World &world, const std::map< std::string, std::vector< long > > &ranks_per_host1)
Definition ranks_and_hosts.cpp:94
DistributionType validate_distribution_type(const dcT &dc)
check distribution type of WorldContainer – global communication
Definition worlddc.h:347
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:227
NDIM & f
Definition mra.h:2668
double wall_time()
Returns the wall time in seconds relative to an arbitrary origin.
Definition timers.cc:48
std::string type(const PairType &n)
Definition PNOParameters.h:18
long lowest_rank_on_host_of_rank(const std::map< std::string, std::vector< long > > ranks_per_host1, int rank)
Definition ranks_and_hosts.cpp:81
std::map< std::string, std::vector< long > > ranks_per_host(World &universe)
for each host, return a list of its ranks
Definition ranks_and_hosts.cpp:60
static XNonlinearSolver< std::vector< Function< T, NDIM > >, T, vector_function_allocator< T, NDIM > > nonlinear_vector_solver(World &world, const long nvec)
Definition nonlinsol.h:371
void swap(Function< R, MDIM > &f1, Function< R, MDIM > &f2)
Definition mra.h:3000
void advance(madness::Hash_private::HashIterator< hashT > &it, const distT &dist)
Definition worldhashmap.h:610
static const double d
Definition nonlinschro.cc:121
Implements ParallelInputArchive and ParallelOutputArchive for parallel serialization of data.
static const double c
Definition relops.cc:10
Definition worlddc.h:1171
bool operator()(typename rangeT::iterator &iterator) const
Definition worlddc.h:1176
implT * impl
Definition worlddc.h:1172
P2Op(const P2Op &p)
Definition worlddc.h:1175
P2Op(implT *impl)
Definition worlddc.h:1174
Range< typename std::vector< keyT >::const_iterator > rangeT
Definition worlddc.h:1173
World & world
Memoized reference to the world to which this object belongs.
Definition world_object.h:348
World & get_world() const
Definition world_object.h:446
Default load of an object via serialize(ar, t).
Definition archive.h:667
static void postamble_store(const Archive &)
By default there is no postamble.
Definition archive.h:546
static void preamble_store(const Archive &ar)
Serialize a cookie for type checking.
Definition archive.h:536
static void store(const ParallelOutputArchive< VectorOutputArchive > &ar, const WorldContainer< keyT, valueT > &t)
Definition worlddc.h:2261
static void store(const ParallelOutputArchive< localarchiveT > &ar, const WorldContainer< keyT, valueT > &t)
Definition worlddc.h:2468
Default store of an object via serialize(ar, t).
Definition archive.h:612
int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int[], MPI_Datatype recvtype, int, MPI_Comm)
Definition stubmpi.h:218
#define MPI_INT
Definition stubmpi.h:81
#define MPI_BYTE
Definition stubmpi.h:77
int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
Definition stubmpi.h:233
AtomicInt sum
Definition test_atomicint.cc:46
std::pair< int, double > valueT
Definition test_binsorter.cc:6
int me
Definition test_binsorter.cc:10
const double offset
Definition testfuns.cc:143
double source(const coordT &r)
Definition testperiodic.cc:48
#define REMFUTURE(T)
Macro to determine type of future (by removing wrapping Future template).
Definition type_traits.h:163
#define MEMFUN_RETURNT(MEMFUN)
Macro to make member function type traits easier to use.
Definition type_traits.h:773
Defines and implements WorldObject.
Defines and implements a concurrent hashmap.
int ProcessID
Used to clearly identify process number/rank.
Definition worldtypes.h:43
int Tag
Used to clearly identify message tag/type.
Definition worldtypes.h:44