32#ifndef MADNESS_WORLD_WORLDDC_H__INCLUDED
33#define MADNESS_WORLD_WORLDDC_H__INCLUDED
45#include <unordered_set>
57 template <
typename keyT,
typename valueT,
typename hashfunT>
60 template <
typename keyT,
typename valueT,
typename hashfunT>
61 class WorldContainerImpl;
63 template <
typename keyT,
typename valueT,
typename hashfunT>
64 void swap(WorldContainer<keyT, valueT, hashfunT> &, WorldContainer<keyT, valueT, hashfunT> &);
66 template <
typename keyT>
67 class WorldDCPmapInterface;
69 template <
typename keyT>
73 virtual std::size_t
size()
const = 0;
88 template<
typename T=
long>
96 template<
typename T=
long>
102 template<
typename T=
long>
105 std::transform(
type.begin(),
type.end(),
type.begin(), [](
unsigned char c){ return std::tolower(c); });
109 std::string msg=
"unknown distribution type:"+
type;
120 template <
typename keyT>
173 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
177 (*iter)->redistribute_phase1(
newpmap);
180 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
184 (*iter)->redistribute_phase2();
185 newpmap->register_callback(*iter);
188 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin();
192 (*iter)->redistribute_phase3();
196 newpmap->print_data_sizes(world,
"after redistributing");
215 for (
typename std::set<ptrT>::iterator iter =
ptrs.begin(); iter !=
ptrs.end(); ++iter)
217 sum += (*iter)->size();
229 std::vector<std::size_t>
sizes(world.
size());
232 if (world.
rank() == 0)
236 std::cout <<
" procs: ";
237 for (
int i = 0; i < world.
size(); i++)
238 std::cout <<
sizes[i] <<
" ";
239 std::cout << std::endl;
248 template <
typename keyT,
typename hashfunT = Hash<keyT>>
272 template <
typename keyT,
typename hashfunT = Hash<keyT>>
294 template <
typename keyT,
typename hashfunT = Hash<keyT>>
318 template <
typename dcT>
322 World& world=dc.get_world();
323 auto result= dc.get_pmap()->distribution_type();
325 auto local_size=dc.
size();
326 auto global_size=local_size;
327 world.
gop.
sum(global_size);
330 std::unordered_map<hashT, size_t>
counts;
332 for (
const auto&
elem :
v) {
340 const auto& hashfun=dc.get_hash();
342 for (
auto it=dc.begin();it!=dc.end();++it,++i)
all_hashes[i]=hashfun(it->first);
384 template <
class internal_iteratorT>
389 typedef typename std::iterator_traits<internal_iteratorT>::value_type
value_type;
390 typedef typename std::iterator_traits<internal_iteratorT>::difference_type
difference_type;
391 typedef typename std::iterator_traits<internal_iteratorT>::pointer
pointer;
392 typedef typename std::iterator_traits<internal_iteratorT>::reference
reference;
395 internal_iteratorT
it;
421 template <
class iteratorT>
450 return !(*
this == other);
492 return value !=
nullptr;
495 template <
typename Archive>
502 template <
class iteratorT>
505 template <
class iteratorT>
508 if (
static_cast<const void *
>(
this) !=
static_cast<const void *
>(&other))
514 it = internal_iteratorT();
528 template <
typename keyT,
typename valueT,
typename hashfunT>
530 :
public WorldObject<WorldContainerImpl<keyT, valueT, hashfunT>>,
532#ifndef MADNESS_DISABLE_SHARED_FROM_THIS
534 public std::enable_shared_from_this<WorldContainerImpl<keyT, valueT, hashfunT>>
538 typedef typename std::pair<const keyT, valueT>
pairT;
569 std::shared_ptr<WorldDCPmapInterface<keyT>>
pmap;
616 pmap->register_callback(
this);
621 pmap->deregister_callback(
this);
624 const std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
const
629 std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
636 pmap->deregister_callback(
this);
638 pmap->register_callback(
this);
645 pmap->deregister_callback(
this);
647 pmap->register_callback(
this);
689 pmap->deregister_callback(
this);
691 pmap->register_callback(
this);
696 pmap->deregister_callback(
this);
698 pmap->register_callback(
this);
717 for (
auto it =
begin(); it !=
end(); ++it) {
718 keyT key = it->first;
719 valueT value = it->second;
735 pmap->deregister_callback(
this);
737 pmap->register_callback(
this);
776 std::size_t sz =
size();
779 for (
auto it =
begin(); it !=
end(); ++it)
781 keyT key = it->first;
782 valueT value = it->second;
791 for (
size_t i = 0; i < sz; i++)
812 return pmap->owner(key);
838 acc->second = datum.second;
879 template <
typename InIter>
887 template <
typename InIter>
960 template <
typename memfunT>
967 return (
acc->second.*memfun)();
971 template <
typename memfunT,
typename arg1T>
978 return (
acc->second.*memfun)(
arg1);
982 template <
typename memfunT,
typename arg1T,
typename arg2T>
993 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1004 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1015 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1026 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1037 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1125 template <
typename keyT,
typename valueT,
typename hashfunT = Hash<keyT>>
1142 std::shared_ptr<implT>
p;
1173 p->process_pending();
1190 p->process_pending();
1220 return p->get_pmap()->distribution_type();
1239 return p->get_world();
1242 std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_impl()
1251 p->replicate(fence);
1257 p->replicate_on_hosts(fence);
1277 return p->find(
acc, key);
1284 return p->find(
acc, key);
1291 return p->insert_acc(
acc, key);
1298 return p->insert_acc(
acc, key);
1302 template <
typename input_iterator>
1306 using std::placeholders::_1;
1314 return p->probe(key);
1324 return p->owner(key);
1331 return p->is_local(key);
1342 return p->find(key);
1353 return const_cast<const implT *
>(
p.get())->
find(key);
1367 return const_cast<const implT *
>(
p.get())->
begin();
1381 return const_cast<const implT *
>(
p.get())->
end();
1409 p->erase(start, finish);
1429 inline const std::shared_ptr<WorldDCPmapInterface<keyT>> &
get_pmap()
const
1432 return p->get_pmap();
1438 p->reset_pmap_to_local();
1445 return p->get_hash();
1456 p->process_pending();
1468 template <
typename memfunT>
1475 return p->send(
owner(key), itemfun, key, memfun);
1487 template <
typename memfunT,
typename arg1T>
1495 return p->send(
owner(key), itemfun, key, memfun,
arg1);
1510 template <
typename memfunT,
typename arg1T,
typename arg2T>
1532 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1551 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1570 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1576 (
implT::*itemfun)(
const keyT &,
memfunT,
const arg1T &,
const arg2T &,
const arg3T &,
const arg4T &,
const arg5T &) = &implT::template
itemfun<memfunT, arg1T, arg2T, arg3T, arg4T, arg5T>;
1589 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1595 (
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>;
1608 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1615 (
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>;
1616 return p->send(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7);
1622 template <
typename memfunT>
1632 template <
typename memfunT,
typename arg1T>
1642 template <
typename memfunT,
typename arg1T,
typename arg2T>
1652 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1662 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1672 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1682 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1693 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1711 template <
typename memfunT>
1718 return p->task(
owner(key), itemfun, key, memfun, attr);
1731 template <
typename memfunT,
typename arg1T>
1739 return p->task(
owner(key), itemfun, key, memfun,
arg1, attr);
1752 template <
typename memfunT,
typename arg1T,
typename arg2T>
1761 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2, attr);
1774 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1797 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1821 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1832 (
implT::*itemfun)(
const keyT &,
memfunT,
const a1T &,
const a2T &,
const a3T &,
const a4T &,
const a5T &) = &implT::template
itemfun<memfunT, a1T, a2T, a3T, a4T, a5T>;
1846 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1858 (
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>;
1859 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6, attr);
1872 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1885 (
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>;
1886 return p->task(
owner(key), itemfun, key, memfun,
arg1,
arg2,
arg3,
arg4,
arg5,
arg6,
arg7, attr);
1892 template <
typename memfunT>
1902 template <
typename memfunT,
typename arg1T>
1912 template <
typename memfunT,
typename arg1T,
typename arg2T>
1922 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T>
1932 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T>
1942 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T>
1952 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T>
1962 template <
typename memfunT,
typename arg1T,
typename arg2T,
typename arg3T,
typename arg4T,
typename arg5T,
typename arg6T,
typename arg7T>
1972 template <
typename Archive>
1979 const long magic = 5881828;
1980 unsigned long count = 0;
1983 if (Archive::is_output_archive)
2025#ifdef MADNESS_DISABLE_SHARED_FROM_THIS
2026 p.reset(
static_cast<implT *
>(ptr), [](
implT *
p_) ->
void{});
2051 template <
typename keyT,
typename valueT,
typename hashfunT>
2066 template <
class keyT,
class valueT>
2072 const long magic = -5881828;
2074 using const_iterator =
typename dcT::const_iterator;
2075 int count = t.
size();
2089 const_iterator start, end;
2093 op_inspector(const_iterator start, const_iterator end,
size_t &size)
2094 : start(start), end(end), size(size) {}
2098 for (const_iterator it = start; it != end; ++it)
2106 const_iterator start, end;
2111 op_executor(const_iterator start, const_iterator end,
unsigned char *buf,
size_t size)
2112 : start(start), end(end), buf(buf), size(size) {}
2116 for (const_iterator it = start; it != end; ++it)
2127 size_t local_size = 0;
2128 double wall1 = wall0;
2129 unsigned char* buf = 0;
2136 const_iterator start = t.
begin();
2137 size_t nleft = count;
2140 const_iterator end = start;
2170 buf =
new unsigned char[local_size];
2198 const int size = local_size;
2207 for (
int i = 1; i < world->
size(); ++i)
2216 if (world->
rank() == 0)
2230 if (world->
rank() == 0)
2267 template <
class keyT,
class valueT,
class localarchiveT>
2272 const long magic = -5881828;
2275 typedef typename dcT::pairT pairT;
2296 unsigned long count = 0
ul;
2327 template <
class keyT,
class valueT,
class localarchiveT>
2341 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:74
T & get(bool dowork=true)
Gets/forces the value, waiting if necessary.
Definition future.h:288
A future is a possibly yet unevaluated value.
Definition future.h:369
remote_refT remote_ref(World &world) const
Returns a structure used to pass references to another process.
Definition future.h:671
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:395
Contains attributes of a task.
Definition thread.h:329
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:1419
Internal implementation of distributed container to facilitate shallow copy.
Definition worlddc.h:536
void erase(const keyT &key)
Definition worlddc.h:864
WorldContainerIterator< internal_iteratorT > iterator
Definition worlddc.h:551
const hashfunT & get_hash() const
Definition worlddc.h:803
bool find(const_accessor &acc, const keyT &key) const
Definition worlddc.h:952
internal_containerT::accessor accessor
Definition worlddc.h:548
void find_handler(ProcessID requestor, const keyT &key, const RemoteReference< FutureImpl< iterator > > &ref)
Handles find request.
Definition worlddc.h:575
bool probe(const keyT &key) const
Definition worlddc.h:815
void find_success_handler(const RemoteReference< FutureImpl< iterator > > &ref, const pairT &datum)
Handles successful find response.
Definition worlddc.h:591
std::pair< const keyT, valueT > pairT
Definition worlddc.h:538
bool insert_const_acc(const_accessor &acc, const keyT &key)
Definition worlddc.h:853
WorldContainerIterator< internal_const_iteratorT > const_iteratorT
Definition worlddc.h:552
bool find(accessor &acc, const keyT &key)
Definition worlddc.h:945
void redistribute_phase2()
Definition worlddc.h:1080
void insert(const pairT &datum)
Definition worlddc.h:829
WorldContainerIterator< internal_iteratorT > iteratorT
Definition worlddc.h:550
void clear()
Definition worlddc.h:859
bool insert_acc(accessor &acc, const keyT &key)
Definition worlddc.h:847
Future< iterator > find(const keyT &key)
Definition worlddc.h:930
WorldContainerImpl(World &world, const std::shared_ptr< WorldDCPmapInterface< keyT > > &pm, const hashfunT &hf)
Definition worlddc.h:611
void reset_pmap_to_local()
Definition worlddc.h:634
itemfun(const keyT &key, memfunT memfun)
Definition worlddc.h:962
const pairT const_pairT
Definition worlddc.h:539
std::vector< keyT > * move_list
Tempoary used to record data that needs redistributing.
Definition worlddc.h:572
internal_containerT::iterator internal_iteratorT
Definition worlddc.h:546
WorldContainerImpl< keyT, valueT, hashfunT > implT
Definition worlddc.h:540
std::size_t size() const
Definition worlddc.h:824
void redistribute_phase1(const std::shared_ptr< WorldDCPmapInterface< keyT > > &newpmap)
Definition worlddc.h:1049
internal_containerT::const_iterator internal_const_iteratorT
Definition worlddc.h:547
std::shared_ptr< WorldDCPmapInterface< keyT > > pmap
Function/class to map from keys to owning process.
Definition worlddc.h:569
virtual ~WorldContainerImpl()
Definition worlddc.h:619
void do_replicate(World &world)
Definition worlddc.h:771
std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap()
Definition worlddc.h:629
internal_containerT local
Locally owned data.
Definition worlddc.h:571
ConcurrentHashMap< keyT, valueT, hashfunT > internal_containerT
Definition worlddc.h:542
const_iterator begin() const
Definition worlddc.h:904
void erase(InIter it)
Definition worlddc.h:880
void replicate(bool fence)
Definition worlddc.h:643
const_iterator end() const
Definition worlddc.h:914
bool is_local(const keyT &key) const
Definition worlddc.h:805
void redistribute_phase3()
Definition worlddc.h:1094
void find_failure_handler(const RemoteReference< FutureImpl< iterator > > &ref)
Handles unsuccessful find response.
Definition worlddc.h:601
ProcessID owner(const keyT &key) const
Definition worlddc.h:810
void erase(InIter first, InIter last)
Definition worlddc.h:888
void replicate_on_hosts(bool fence)
Definition worlddc.h:656
const std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap() const
Definition worlddc.h:624
iterator begin()
Definition worlddc.h:899
Future< const_iterator > find(const keyT &key) const
Definition worlddc.h:919
const ProcessID me
My MPI rank.
Definition worlddc.h:570
iterator end()
Definition worlddc.h:909
WorldContainerIterator< internal_const_iteratorT > const_iterator
Definition worlddc.h:553
internal_containerT::const_accessor const_accessor
Definition worlddc.h:549
Iterator for distributed container wraps the local iterator.
Definition worlddc.h:386
WorldContainerIterator(const WorldContainerIterator &other)
Definition worlddc.h:415
WorldContainerIterator(const internal_iteratorT &it)
Initializes from a local iterator.
Definition worlddc.h:405
WorldContainerIterator & operator++()
Pre-increment of an iterator (i.e., ++it) — local iterators only.
Definition worlddc.h:456
std::iterator_traits< internal_iteratorT >::iterator_category iterator_category
Definition worlddc.h:388
void copy(const WorldContainerIterator< iteratorT > &other)
Definition worlddc.h:506
std::iterator_traits< internal_iteratorT >::pointer pointer
Definition worlddc.h:391
bool operator==(const WorldContainerIterator &other) const
Determines if two iterators are identical.
Definition worlddc.h:441
const internal_iteratorT & get_internal_iterator() const
Private: (or should be) Returns iterator of internal container.
Definition worlddc.h:484
WorldContainerIterator & operator=(const WorldContainerIterator &other)
Assignment.
Definition worlddc.h:434
value_type * value
holds the remote values
Definition worlddc.h:397
bool is_cached() const
Returns true if this is non-local or cached value.
Definition worlddc.h:490
WorldContainerIterator operator++(int)
Definition worlddc.h:463
WorldContainerIterator(const value_type &v)
Initializes to cache a remote value.
Definition worlddc.h:409
pointer operator->() const
Iterators dereference to std::pair<const keyT,valueT>
Definition worlddc.h:472
std::iterator_traits< internal_iteratorT >::reference reference
Definition worlddc.h:392
void serialize(const Archive &)
Definition worlddc.h:496
std::iterator_traits< internal_iteratorT >::value_type value_type
Definition worlddc.h:389
WorldContainerIterator(const WorldContainerIterator< iteratorT > &other)
Definition worlddc.h:422
WorldContainerIterator()
Default constructor makes a local uninitialized value.
Definition worlddc.h:401
internal_iteratorT it
Iterator from local container.
Definition worlddc.h:395
reference operator*() const
Iterators dereference to std::pair<const keyT,valueT>
Definition worlddc.h:478
std::iterator_traits< internal_iteratorT >::difference_type difference_type
Definition worlddc.h:390
bool operator!=(const WorldContainerIterator &other) const
Determines if two iterators are different.
Definition worlddc.h:448
~WorldContainerIterator()
Definition worlddc.h:428
Makes a distributed container with specified attributes.
Definition worlddc.h:1127
void process_pending()
Process pending messages.
Definition worlddc.h:1453
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:1167
const hashfunT & get_hash() const
Returns a reference to the hashing functor.
Definition worlddc.h:1442
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:1274
bool probe(const keyT &key) const
Returns true if local data is immediately available (no communication)
Definition worlddc.h:1311
const_iterator begin() const
Returns an iterator to the beginning of the local data (no communication)
Definition worlddc.h:1364
void replace(const keyT &key, const valueT &value)
Inserts/replaces key+value pair (non-blocking communication if key not local)
Definition worlddc.h:1268
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:1295
iterator begin()
Returns an iterator to the beginning of the local data (no communication)
Definition worlddc.h:1357
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:1944
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:1183
Future< iterator > find(const keyT &key)
Returns a future iterator (non-blocking communication if key not local)
Definition worlddc.h:1339
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:1684
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:1695
Future< const_iterator > const_futureT
Definition worlddc.h:1139
bool is_replicated() const
Definition worlddc.h:1227
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:1733
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:1674
ProcessID owner(const keyT &key) const
Returns processor that logically owns key (no communication)
Definition worlddc.h:1321
implT::const_iterator const_iterator
Definition worlddc.h:1135
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:1914
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:1894
WorldContainer()
Makes an uninitialized container (no communication)
Definition worlddc.h:1155
void serialize(const archive::BufferOutputArchive &ar)
(de)Serialize — !! ONLY for purpose of interprocess communication
Definition worlddc.h:2010
keyT key_type
Definition worlddc.h:1130
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:1534
void replicate(bool fence=true)
replicates this WorldContainer on all ProcessIDs
Definition worlddc.h:1249
virtual ~WorldContainer()
Destructor passes ownership of implementation to world for deferred cleanup.
Definition worlddc.h:2040
void erase(const keyT &key)
Erases entry from container (non-blocking comm if remote)
Definition worlddc.h:1392
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:1572
void reset_pmap_to_local()
Returns shared pointer to the process mapping.
Definition worlddc.h:1436
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:1489
const uniqueidT & id() const
Returns the associated unique id ... must be initialized.
Definition worlddc.h:2033
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:1874
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:1754
WorldContainerImpl< keyT, valueT, hashfunT > implT
Definition worlddc.h:1132
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:1644
void replace(const pairT &datum)
Inserts/replaces key+value pair (non-blocking communication if key not local)
Definition worlddc.h:1261
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:1924
iterator end()
Returns an iterator past the end of the local data (no communication)
Definition worlddc.h:1371
const std::shared_ptr< WorldDCPmapInterface< keyT > > & get_pmap() const
Returns shared pointer to the process mapping.
Definition worlddc.h:1429
std::shared_ptr< WorldDCPmapInterface< keyT > > & get_impl()
Definition worlddc.h:1242
void replace(input_iterator &start, input_iterator &end)
Inserts pairs (non-blocking communication if key(s) not local)
Definition worlddc.h:1303
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:1904
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:1288
Future< iterator > futureT
Definition worlddc.h:1138
void erase(const iterator &it)
Erases entry corresponding to local iterator (no communication)
Definition worlddc.h:1399
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:1934
void erase(const iterator &start, const iterator &finish)
Erases range defined by local iterators (no communication)
Definition worlddc.h:1406
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:1664
bool is_distributed() const
Definition worlddc.h:1223
WorldContainer(const WorldContainer &other)
Copy constructor is shallow (no communication)
Definition worlddc.h:1197
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:1848
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:1610
World & get_world() const
Returns the world associated with this container.
Definition worlddc.h:1236
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:1624
implT::iterator iterator
Definition worlddc.h:1134
DistributionType get_distribution_type() const
return the way data is distributed
Definition worlddc.h:1218
implT::pairT pairT
Definition worlddc.h:1133
std::size_t size() const
Returns the number of local entries (no communication)
Definition worlddc.h:1422
containerT & operator=(const containerT &other)
Assignment is shallow (no communication)
Definition worlddc.h:1207
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:1823
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:1281
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:1776
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:1553
void serialize(const archive::BufferInputArchive &ar)
(de)Serialize — !! ONLY for purpose of interprocess communication
Definition worlddc.h:2019
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:1713
bool is_local(const keyT &key) const
Returns true if the key maps to the local processor (no communication)
Definition worlddc.h:1328
const_iterator end() const
Returns an iterator past the end of the local data (no communication)
Definition worlddc.h:1378
void serialize(const Archive &ar)
(de)Serialize — Local data only to/from anything except Buffer*Archive and Parallel*Archive
Definition worlddc.h:1973
bool is_host_replicated() const
Definition worlddc.h:1231
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:1954
void clear()
Clears all local data (no communication)
Definition worlddc.h:1415
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:1799
Future< MEMFUN_RETURNT(memfunT)> send(const keyT &key, memfunT memfun)
Sends message "resultT memfun()" to item (non-blocking comm if remote)
Definition worlddc.h:1470
implT::const_accessor const_accessor
Definition worlddc.h:1137
std::shared_ptr< implT > p
Definition worlddc.h:1142
Future< const_iterator > find(const keyT &key) const
Returns a future iterator (non-blocking communication if key not local)
Definition worlddc.h:1350
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:1654
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:1591
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:1512
void replicate_on_hosts(bool fence=true)
replicates this WorldContainer on all hosts (one PID per host)
Definition worlddc.h:1255
void check_initialized() const
Definition worlddc.h:1144
WorldContainer< keyT, valueT, hashfunT > containerT
Definition worlddc.h:1131
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:1964
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:1634
implT::accessor accessor
Definition worlddc.h:1136
Default process map is "random" using madness::hash(key)
Definition worlddc.h:250
ProcessID owner(const keyT &key) const
Maps key to processor.
Definition worlddc.h:261
WorldDCDefaultPmap(World &world, const hashfunT &hf=hashfunT())
Definition worlddc.h:256
const int nproc
Definition worlddc.h:252
hashfunT hashfun
Definition worlddc.h:253
Local process map will always return the current process as owner.
Definition worlddc.h:274
ProcessID owner(const keyT &key) const override
Maps key to processor.
Definition worlddc.h:280
WorldDCLocalPmap(World &world)
Definition worlddc.h:279
ProcessID me
Definition worlddc.h:276
DistributionType distribution_type() const override
by default the map is distributed
Definition worlddc.h:285
DistributionType distribution_type() const override
by default the map is distributed
Definition worlddc.h:311
WorldDCNodeReplicatedPmap(World &world, const std::map< std::string, std::vector< long > > ranks_per_host)
Definition worlddc.h:302
ProcessID myowner
Definition worlddc.h:296
ProcessID owner(const keyT &key) const override
owner is the lowest rank on the node, same for all keys
Definition worlddc.h:307
Interface to be provided by any process map.
Definition worlddc.h:122
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:169
virtual DistributionType distribution_type() const
by default the map is distributed
Definition worlddc.h:142
void print_data_sizes(World &world, const std::string msg="") const
Prints size info to std::cout.
Definition worlddc.h:225
std::size_t global_size(World &world) const
Counts global number of entries in all containers associated with this process map.
Definition worlddc.h:202
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:158
void register_callback(ptrT ptr)
Registers object for receipt of redistribute callbacks.
Definition worlddc.h:150
virtual void print() const
Definition worlddc.h:139
std::size_t local_size() const
Counts local number of entries in all containers associated with this process map.
Definition worlddc.h:212
std::set< ptrT > ptrs
Definition worlddc.h:128
virtual ~WorldDCPmapInterface()
Definition worlddc.h:137
WorldDCRedistributeInterface< keyT > * ptrT
Definition worlddc.h:124
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:77
void broadcast_serializable(objT &obj, ProcessID root)
Broadcast a serializable object.
Definition worldgop.h:756
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
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:173
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:955
void sum(T *buf, size_t nelem)
Inplace global sum while still processing AM & tasks.
Definition worldgop.h:872
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:366
World & get_world() const
Returns a reference to the world.
Definition world_object.h:719
World & world
The World this object belongs to. (Think globally, act locally).
Definition world_object.h:383
detail::task_result_type< memfnT >::futureT send(ProcessID dest, memfnT memfn) const
Definition world_object.h:733
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:1007
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:132
WorldTaskQueue & taskq
Task queue.
Definition world.h:206
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:320
WorldMpiInterface & mpi
MPI interface.
Definition world.h:204
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:330
WorldGopInterface & gop
Global operations.
Definition world.h:207
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:2339
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 DFParameters.h:10
DistributionType from_string(std::string type)
Definition worlddc.h:103
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:401
DistributionType
some introspection of how data is distributed
Definition worlddc.h:81
@ NodeReplicated
even if there are several ranks per node
Definition worlddc.h:84
@ Distributed
no replication of the container, the container is distributed over the world
Definition worlddc.h:82
@ RankReplicated
replicate the container over all world ranks
Definition worlddc.h:83
std::string to_string(const DistributionType type)
Definition worlddc.h:97
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:86
DistributionType validate_distribution_type(const dcT &dc)
check distribution type of WorldContainer – global communication
Definition worlddc.h:319
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:226
NDIM & f
Definition mra.h:2528
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:73
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:52
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:2860
void advance(madness::Hash_private::HashIterator< hashT > &it, const distT &dist)
Definition worldhashmap.h:610
Implements ParallelInputArchive and ParallelOutputArchive for parallel serialization of data.
static const double c
Definition relops.cc:10
Definition worlddc.h:1061
bool operator()(typename rangeT::iterator &iterator) const
Definition worlddc.h:1066
implT * impl
Definition worlddc.h:1062
P2Op(const P2Op &p)
Definition worlddc.h:1065
P2Op(implT *impl)
Definition worlddc.h:1064
Range< typename std::vector< keyT >::const_iterator > rangeT
Definition worlddc.h:1063
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:2069
static void store(const ParallelOutputArchive< localarchiveT > &ar, const WorldContainer< keyT, valueT > &t)
Definition worlddc.h:2270
Default store of an object via serialize(ar, t).
Definition archive.h:612
#define MPI_INT
Definition stubmpi.h:81
#define MPI_BYTE
Definition stubmpi.h:77
int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, int root, MPI_Comm)
Definition stubmpi.h:218
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