struct
#include <src/vt/collective/tree/tree.h>
Tree General interface for storing a spanning tree.
Holds the portion of a spanning tree on each node. Does not do any parallel coordination. Higher-level components must keep track of the pieces of the tree on each node.
Derived classes
- struct vt::collective::barrier::Barrier virtual
- Perform a collective barrier that is safe to use with VT handlers in flight.
- struct vt::collective::reduce::Reduce virtual
- A specific, isolated reducer instance for a given scope that sequences reduce operations via the reduction stamp within that scope.
- struct vt::collective::scatter::Scatter virtual
- Scatter data across all nodes from a single origin.
- struct vt::term::TerminationDetector
- Detect global termination and of subsets of work.
Public types
- using NodeListType = std::vector<NodeType>
- using OperationType = std::function<void(NodeType)>
- using NumLevelsType = int32_t
Constructors, destructors, conversion operators
- Tree(DefaultTreeConstructTag) explicit
- Construct the default spanning tree across the whole communicator.
- Tree(NodeListType const& in_children) explicit
- Construct a spanning tree with a list of children nodes on the root node.
- Tree(bool const in_is_root, NodeType const& parent, NodeListType const& in_children)
- Construct a spanning tree with a list of children nodes, parent node, and whether this is the root.
Public functions
- void setupTree()
- Setup the default (binomial) tree.
- auto getParent() const -> NodeType
- Get the parent node in the tree.
- auto getNumChildren() const -> NodeType
- Get the number of children nodes.
- auto isRoot() const -> bool
- Get whether this node is the root.
- auto getChildren() const -> NodeListType const &
- Get the (const) list of children.
- auto getChildren(NodeType node) const -> NodeListType
- Get the list of children for a particular node in the tree.
- void foreachChild(OperationType op) const
- Apply function (foreach) across all children.
- auto numLevels() const -> NumLevelsType
- Get number of levels in the tree.
- void foreachChild(NumLevelsType level, OperationType op) const
- Apply function (foreach) across all children with number of levels passed to apply function.
- auto getNumDescendants(NodeType child) const -> std::size_t
- Get total number of descendants for a particular node in the tree.
- auto getNumDescendants() const -> std::size_t
- Get total number of descendants in the tree.
Function documentation
vt:: collective:: tree:: Tree:: Tree(NodeListType const& in_children) explicit
Construct a spanning tree with a list of children nodes on the root node.
Parameters | |
---|---|
in_children in | the list of children |
vt:: collective:: tree:: Tree:: Tree(bool const in_is_root,
NodeType const& parent,
NodeListType const& in_children)
Construct a spanning tree with a list of children nodes, parent node, and whether this is the root.
Parameters | |
---|---|
in_is_root in | if this is the root node |
parent in | the node's parent in the tree |
in_children in | the list of children |
NodeType vt:: collective:: tree:: Tree:: getNumChildren() const
Get the number of children nodes.
Returns | the number of children nodes |
---|
bool vt:: collective:: tree:: Tree:: isRoot() const
Get whether this node is the root.
Returns | whether this node is the root |
---|
NodeListType const & vt:: collective:: tree:: Tree:: getChildren() const
Get the (const) list of children.
Returns | (const) list of children |
---|
NodeListType vt:: collective:: tree:: Tree:: getChildren(NodeType node) const
Get the list of children for a particular node in the tree.
Returns | list of children |
---|
void vt:: collective:: tree:: Tree:: foreachChild(OperationType op) const
Apply function (foreach) across all children.
Parameters | |
---|---|
op in | action to apply, passed the node |
NumLevelsType vt:: collective:: tree:: Tree:: numLevels() const
Get number of levels in the tree.
Returns | number of levels |
---|
void vt:: collective:: tree:: Tree:: foreachChild(NumLevelsType level,
OperationType op) const
Apply function (foreach) across all children with number of levels passed to apply function.
Parameters | |
---|---|
level in | number of levels in spanning tree |
op in | action to apply, passed levels and node |
std::size_t vt:: collective:: tree:: Tree:: getNumDescendants(NodeType child) const
Get total number of descendants for a particular node in the tree.
Parameters | |
---|---|
child in | the node |
Returns | number of descendants |
\internalThe returned count does not include the node passed—only its descendants.
std::size_t vt:: collective:: tree:: Tree:: getNumDescendants() const
Get total number of descendants in the tree.
Returns | number of descendants |
---|