MADNESS  version 0.9
Classes | Public Member Functions | Static Public Member Functions | List of all members
madness::Group Class Reference

A collection of processes. More...

#include <group.h>

Public Member Functions

 Group ()
 Default constructor. More...
 
 Group (const Group &other)
 Copy constructor. More...
 
template<typename A >
 Group (World &world, const A &group, const DistributedID &did)
 Create a new group. More...
 
template<typename A >
 Group (World &world, const A &group, const std::size_t tag)
 Create a new group. More...
 
template<typename A >
 Group (World &world, const A &group, const uniqueidT &uid, const std::size_t tag)
 Create a new group. More...
 
Groupoperator= (const Group &other)
 Copy assignment operator. More...
 
void local_update () const
 Update local usage count. More...
 
void remote_update () const
 Update remote usage count. More...
 
bool empty () const
 Quary empty group. More...
 
const DistributedIDid () const
 Group id accessor. More...
 
Worldget_world () const
 Parent world accessor. More...
 
ProcessID rank () const
 Group rank accessor. More...
 
ProcessID rank (const ProcessID world_rank) const
 Map world rank to group rank. More...
 
ProcessID size () const
 Group size accessor. More...
 
ProcessID world_rank (const ProcessID group_rank) const
 Map group rank to world rank. More...
 
void make_tree (const ProcessID group_root, ProcessID &parent, ProcessID &child1, ProcessID &child2) const
 Compute the binary tree parents and children. More...
 
template<typename Archive >
void serialize (const Archive &)
 

Static Public Member Functions

static madness::Future< Groupget_group (const DistributedID &did)
 Get group from the registry. More...
 

Detailed Description

A collection of processes.

Group is a light weight object that can be used to specify a set of processes that will participate in Gop collective operations. The advantage of Group over MPI (or SafeMPI) groups is that it eliminates the need to construct new communicator and the associated barrier.

Note
This is NOT an MPI or SafeMPI group.

Constructor & Destructor Documentation

madness::Group::Group ( )
inline

Default constructor.

Create an empty group

madness::Group::Group ( const Group other)
inline

Copy constructor.

Parameters
otherThe group to be copied
Note
Copy is shallow.
template<typename A >
madness::Group::Group ( World world,
const A &  group,
const DistributedID did 
)
inline

Create a new group.

Template Parameters
AAn array type
Parameters
worldThe parent world for this group
groupAn array with a list of process to be included in the
didThe distributed id associated with this group
Note
All processes in the group list must be included in the parent world.
template<typename A >
madness::Group::Group ( World world,
const A &  group,
const std::size_t  tag 
)
inline

Create a new group.

Template Parameters
AAn array type
Parameters
worldThe parent world for this group
groupAn array with a list of process to be included in the
tagThe tag associated with this group group.
Note
All processes in the group list must be included in the parent world.
template<typename A >
madness::Group::Group ( World world,
const A &  group,
const uniqueidT uid,
const std::size_t  tag 
)
inline

Create a new group.

Template Parameters
AAn array type
Parameters
worldThe parent world for this group
groupAn array with a list of process to be included in the
uidThe unique id (used by WorldObject ) associated with this group
tagThe tag associated with this group group.
Note
All processes in the group list must be included in the parent world.

Member Function Documentation

bool madness::Group::empty ( ) const
inline
Future< Group > madness::Group::get_group ( const DistributedID did)
static

Get group from the registry.

Get a registered group.

This function is used to acquire the group in an active message handler.

Parameters
didThe id associated with the group
Returns
A future to the group
World& madness::Group::get_world ( ) const
inline

Parent world accessor.

Returns
A reference to the parent world of this group

Referenced by madness::WorldGopInterface::all_reduce(), madness::WorldGopInterface::bcast(), madness::WorldGopInterface::lazy_sync(), and madness::WorldGopInterface::reduce().

const DistributedID& madness::Group::id ( ) const
inline

Group id accessor.

Returns
A const reference to the group id
void madness::Group::local_update ( ) const
inline

Update local usage count.

Calling this function indicates that this group will be used by a task function that was spawned by a remote process. For each call to this function, remote_update must be called exactly once.

Note
Users should not call this function. Normally, WorldGopInterface will call this function as needed. Users may call this function if a Group is used in user provided collective operations.
void madness::Group::make_tree ( const ProcessID  group_root,
ProcessID parent,
ProcessID child1,
ProcessID child2 
) const
inline

Compute the binary tree parents and children.

Parameters
[in]rootThe head node of the binary tree in the group
[out]parentThe parent node of the binary tree
[out]child1The left child node of the binary tree
[out]child2The right child node of the binary tree
Note
Output ranks are in the parent world.

Referenced by madness::WorldGopInterface::all_reduce(), madness::WorldGopInterface::lazy_sync(), and madness::WorldGopInterface::reduce().

Group& madness::Group::operator= ( const Group other)
inline

Copy assignment operator.

Parameters
otherThe group to be copied
Note
Copy is shallow.
ProcessID madness::Group::rank ( ) const
inline

Group rank accessor.

Returns
The rank of this process in the group

Referenced by madness::WorldGopInterface::all_reduce(), and madness::WorldGopInterface::bcast().

ProcessID madness::Group::rank ( const ProcessID  world_rank) const
inline

Map world rank to group rank.

Parameters
world_rankThe world rank to be mapped
Returns
The rank of world_rank process in the group
void madness::Group::remote_update ( ) const
inline

Update remote usage count.

Calling this function indicates that this group has been used by a task function that was spawned by a remote process. For each call to this function, remote_update must be called exactly once.

Note
Users should not call this function. Normally, WorldGopInterface will call this function as needed. Users may call this function if a Group is used in user provided collective operations.
template<typename Archive >
void madness::Group::serialize ( const Archive &  )
inline
ProcessID madness::Group::size ( ) const
inline
ProcessID madness::Group::world_rank ( const ProcessID  group_rank) const
inline

Map group rank to world rank.

Parameters
group_rankThe group rank to be mapped to a world rank
Returns
The parent world rank of group_rank.

The documentation for this class was generated from the following files: