32#ifndef MADNESS_WORLD_GROUP_H__INCLUDED
33#define MADNESS_WORLD_GROUP_H__INCLUDED
68 template <
typename T, std::
size_t N>
77 template <
typename T, std::
size_t N>
86 template <
typename T, std::
size_t N>
87 static std::size_t
size(
T (&
a)[
N]) {
return N; }
94 template <
typename vectorT>
95 static typename vectorT::const_iterator
begin(
const vectorT &
v) {
104 template <
typename vectorT>
105 static typename vectorT::const_iterator
end(
const vectorT &
v) {
114 template <
typename vectorT>
115 static typename std::enable_if<!std::is_array<vectorT>::value, std::size_t>
::type
116 size(
const vectorT &
v) {
return v.size(); }
125 template <
typename A>
217 child0 = (
me << 1) + 1 + group_root;
304 template <
typename A>
320 template <
typename A>
337 template <
typename A>
406 return pimpl_->get_world();
439 return pimpl_->world_rank(group_rank);
453 pimpl_->make_tree(group_root, parent, child1, child2);
456 template <
typename Archive>
Definition test_ar.cc:118
An integer with atomic set, get, read+increment, read+decrement, and decrement+test operations.
Definition atomicint.h:126
A future is a possibly yet unevaluated value.
Definition future.h:373
static std::enable_if<!std::is_array< vectorT >::value, std::size_t >::type size(const vectorT &v)
Array size accessor.
Definition group.h:116
static void deleter(Impl *pimpl)
Local group deleter.
Definition group.h:254
static T * end(T(&a)[N])
Array end iterator accessor.
Definition group.h:78
ProcessID size() const
Group size accessor.
Definition group.h:184
ProcessID world_rank(const ProcessID group_rank) const
Map group rank to world rank.
Definition group.h:189
World & world_
Parent world for this group.
Definition group.h:55
static std::size_t size(T(&a)[N])
Array size accessor.
Definition group.h:87
void make_tree(const ProcessID group_root, ProcessID &parent, ProcessID &child0, ProcessID &child1) const
Compute the binary tree parent and children.
Definition group.h:201
ProcessID rank(const ProcessID world_rank) const
Map world rank to group rank.
Definition group.h:172
static T * begin(T(&a)[N])
Array begin iterator accessor.
Definition group.h:69
static vectorT::const_iterator end(const vectorT &v)
Array const end iterator accessor.
Definition group.h:105
Impl(World &world, const A &group, const DistributedID &did)
Constructor.
Definition group.h:126
DistributedID did_
Group distributed id.
Definition group.h:56
ProcessID rank() const
Group rank accessor.
Definition group.h:165
ProcessID group_rank_
The group rank of this process.
Definition group.h:58
static vectorT::const_iterator begin(const vectorT &v)
Array const begin iterator accessor.
Definition group.h:95
World & get_world() const
Parent world accessor.
Definition group.h:155
AtomicInt local_count_
Local use count.
Definition group.h:59
void local_update() const
Local usage update.
Definition group.h:234
AtomicInt remote_count_
Remote use count.
Definition group.h:60
void remote_update(const int n) const
Remote usage update.
Definition group.h:244
std::vector< ProcessID > group_to_world_map_
List of nodes in the group.
Definition group.h:57
const DistributedID & id() const
Group id accessor.
Definition group.h:160
A collection of processes.
Definition group.h:50
void remote_update() const
Update remote usage count.
Definition group.h:383
Group(World &world, const A &group, const DistributedID &did)
Create a new group.
Definition group.h:305
ProcessID rank(const ProcessID world_rank) const
Map world rank to group rank.
Definition group.h:421
Group()
Default constructor.
Definition group.h:288
Group(World &world, const A &group, const std::size_t tag)
Create a new group.
Definition group.h:321
Group(const Group &other)
Copy constructor.
Definition group.h:294
std::shared_ptr< Impl > pimpl_
Definition group.h:263
void local_update() const
Update local usage count.
Definition group.h:369
ProcessID size() const
Group size accessor.
Definition group.h:429
const DistributedID & id() const
Group id accessor.
Definition group.h:396
Group(Impl *pimpl)
Definition group.h:281
Group & operator=(const Group &other)
Copy assignment operator.
Definition group.h:348
static void unregister_group(const DistributedID &did)
Remove this group from the registry.
Definition group.cc:78
Group(World &world, const A &group, const uniqueidT &uid, const std::size_t tag)
Create a new group.
Definition group.h:338
ProcessID world_rank(const ProcessID group_rank) const
Map group rank to world rank.
Definition group.h:437
void register_group() const
Add this group to the registry.
Definition group.cc:59
bool empty() const
Quary empty group.
Definition group.h:391
ProcessID rank() const
Group rank accessor.
Definition group.h:412
static madness::Future< Group > get_group(const DistributedID &did)
Get group from the registry.
Definition group.cc:90
void make_tree(const ProcessID group_root, ProcessID &parent, ProcessID &child1, ProcessID &child2) const
Compute the binary tree parents and children.
Definition group.h:449
void serialize(const Archive &)
Definition group.h:457
World & get_world() const
Parent world accessor.
Definition group.h:404
A parallel world class.
Definition world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:318
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:328
Class for unique global IDs.
Definition uniqueid.h:53
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
static const double v
Definition hatom_sf_dirac.cc:20
Defines madness::MadnessException for exception handling.
#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
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::pair< uniqueidT, std::size_t > DistributedID
Distributed ID which is used to identify objects.
Definition distributed_id.h:48
std::string type(const PairType &n)
Definition PNOParameters.h:18
int distance(const madness::Hash_private::HashIterator< hashT > &it, const madness::Hash_private::HashIterator< hashT > &jt)
Definition worldhashmap.h:616
static const double a
Definition nonlinschro.cc:118
int me
Definition test_binsorter.cc:10
#define N
Definition testconv.cc:37
Declares the World class for the parallel runtime environment.
Defines TaskInterface and implements WorldTaskQueue and associated stuff.
int ProcessID
Used to clearly identify process number/rank.
Definition worldtypes.h:43