MADNESS 0.10.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
madness::Group Class Reference

A collection of processes. More...

#include <group.h>

Classes

class  Impl
 

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

 Group (Impl *pimpl)
 
void register_group () const
 Add this group to the registry.
 

Static Private Member Functions

static void unregister_group (const DistributedID &did)
 Remove this group from the registry.
 

Private Attributes

std::shared_ptr< Implpimpl_
 

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

◆ Group() [1/6]

madness::Group::Group ( Impl pimpl)
inlineprivate

◆ Group() [2/6]

madness::Group::Group ( )
inline

Default constructor.

Create an empty group

Referenced by register_group().

◆ Group() [3/6]

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

Copy constructor.

Parameters
otherThe group to be copied
Note
Copy is shallow.

◆ Group() [4/6]

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.

References register_group().

◆ Group() [5/6]

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.

References register_group().

◆ Group() [6/6]

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.

References register_group().

Member Function Documentation

◆ empty()

bool madness::Group::empty ( ) const
inline

◆ get_group()

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

Referenced by madness::WorldGopInterface::group_bcast_handler().

◆ get_world()

World & madness::Group::get_world ( ) const
inline

Parent world accessor.

Returns
A reference to the parent world of this group

References MADNESS_ASSERT, and pimpl_.

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

◆ id()

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

Group id accessor.

Returns
A const reference to the group id

References MADNESS_ASSERT, and pimpl_.

Referenced by madness::WorldGopInterface::group_bcast_task().

◆ local_update()

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.

References MADNESS_ASSERT, and pimpl_.

Referenced by madness::WorldGopInterface::bcast_internal().

◆ make_tree()

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]group_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.

References MADNESS_ASSERT, and pimpl_.

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

◆ operator=()

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

Copy assignment operator.

Parameters
otherThe group to be copied
Note
Copy is shallow.

References pimpl_.

◆ rank() [1/2]

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

Group rank accessor.

Returns
The rank of this process in the group

References MADNESS_ASSERT, and pimpl_.

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

◆ rank() [2/2]

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

References MADNESS_ASSERT, pimpl_, and world_rank().

◆ register_group()

void madness::Group::register_group ( ) const
private

Add this group to the registry.

Register a group.

Register a group so that it can be used in active messages and tasks spawned on remote nodes.

Exceptions
TiledArray::ExceptionWhen the group is empty
TiledArray::ExceptionWhen the group is already in the registry

Register a group so that it can be used in active messages and tasks spawned on remote nodes.

Parameters
groupThe group to be registered
Exceptions
TiledArray::ExceptionWhen the group is empty
TiledArray::ExceptionWhen the group is already in the registry

References Group(), and pimpl_.

Referenced by Group(), Group(), and Group().

◆ remote_update()

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.

References MADNESS_ASSERT, and pimpl_.

Referenced by madness::WorldGopInterface::group_bcast_task().

◆ serialize()

template<typename Archive >
void madness::Group::serialize ( const Archive &  )
inline

References MADNESS_ASSERT.

◆ size()

ProcessID madness::Group::size ( ) const
inline

◆ unregister_group()

void madness::Group::unregister_group ( const DistributedID did)
staticprivate

Remove this group from the registry.

Remove the given group from the registry.

Groups are removed via a lazy sync operation, which will only remove the group from the registry once unregister_group() has been called on all processes in the group.

Groups are removed via a lazy sync operation, which will only remove the group from the registry once unregistered has been called on all processes in the group.

Parameters
groupThe group to be removed from the registry

References MADNESS_ASSERT.

Referenced by madness::Group::Impl::remote_update().

◆ world_rank()

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.

References MADNESS_ASSERT, and pimpl_.

Referenced by rank().

Member Data Documentation

◆ pimpl_

std::shared_ptr<Impl> madness::Group::pimpl_
private

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