HMLP: High-performance Machine Learning Primitives
|
#include <tree.hpp>
Public Types | |
typedef SETUP::T | T |
typedef Node< SETUP, NODEDATA > | NODE |
Public Member Functions | |
Tree () | |
~Tree () | |
void | Offset (NODE *node, size_t offset) |
void | RecursiveMorton (NODE *node, MortonHelper::Recursor r) |
void | AllocateNodes (NODE *root) |
Allocate the local tree using the local root with n points and depth l. More... | |
void | TreePartition () |
Shared-memory tree partition. More... | |
vector< size_t > | GetPermutation () |
template<typename KNNTASK > | |
Data< pair< T, size_t > > | AllNearestNeighbor (size_t n_tree, size_t k, size_t max_depth, pair< T, size_t > initNN, KNNTASK &dummy) |
Data< int > | CheckAllInteractions () |
template<typename TASK , typename... Args> | |
void | TraverseLeafs (TASK &dummy, Args &...args) |
template<typename TASK , typename... Args> | |
void | TraverseUp (TASK &dummy, Args &...args) |
template<typename TASK , typename... Args> | |
void | TraverseDown (TASK &dummy, Args &...args) |
template<typename TASK , typename... Args> | |
void | TraverseUnOrdered (TASK &dummy, Args &...args) |
For unordered traversal, we just call local downward traversal. More... | |
void | DependencyCleanUp () |
void | ExecuteAllTasks () |
bool | DoOutOfOrder () |
template<typename SUMMARY > | |
void | Summary (SUMMARY &summary) |
Summarize all events in each level. | |
Public Attributes | |
SETUP | setup |
size_t | n = 0 |
size_t | m = 0 |
size_t | depth = 0 |
Lock | lock |
vector< NODE * > | treelist |
unordered_map< size_t, NODE * > | morton2node |
Static Public Attributes | |
static const int | N_CHILDREN = 2 |
Protected Attributes | |
vector< size_t > | global_indices |
end class Setup
typedef Node<SETUP, NODEDATA> hmlp::tree::Tree< SETUP, NODEDATA >::NODE |
Define our tree node type as NODE.
|
inline |
(Default) Tree constructor.
|
inline |
(Default) Tree destructor.
|
inline |
end GetTreePermutation()
k-by-N, neighbor pairs.
Use leaf_size = 4 * k.
This loop has to be sequential to avoid race condiditon on NN.
Report accuracy
Randomize metric tree and exhausted search for each leaf node.
Increase leaf_size with less than 80% accuracy.
end for each tree.
Sort neighbor pairs in ascending order.
Check for illegle values.
Return a matrix of neighbor pairs.
|
inline |
Allocate the local tree using the local root with n points and depth l.
This routine will be called in two situations: 1) called by Tree::TreePartition(), or 2) called by MPITree::TreePartition().
Compute the global tree depth using std::log2().
Compute the local tree depth.
Clean up and reserve space for local tree nodes.
Push root into the treelist.
Allocate children with BFS (queue solution).
Assign local treenode_id.
Account for the depth of the distributed tree.
Leaf nodes are annotated with this flag
|
inline |
Get the total depth of the tree.
Number of total leaf nodes.
Create a 2^l-by-2^l table to check all interactions.
Now traverse all tree nodes (excluding the root).
Loop over all near interactions.
Loop over all far interactions.
|
inline |
|
inline |
|
inline |
|
inline |
end TreePartition()
|
inline |
Currently only used in DrawInteraction()
|
inline |
|
inline |
end TraverseUp()
contain at lesat one tree node
traverse the local tree without the root
IMPORTANT: local root alias of the distributed leaf node IMPORTANT: here l must be int, size_t will wrap over
loop over each node at level-l
do not parallelize if there is less nodes than threads
|
inline |
Contain at lesat one tree node.
do not parallelize if there is less nodes than threads
|
inline |
For unordered traversal, we just call local downward traversal.
end TraverseDown()
|
inline |
end TraverseLeafs()
contain at lesat one tree node
traverse the local tree without the root
IMPORTANT: local root alias of the distributed leaf node IMPORTANT: here l must be int, size_t will wrap over
traverse level-by-level in sequential
loop over each node at level-l
do not parallelize if there is less nodes than threads
|
inline |
Shared-memory tree partition.
end AllocateNodes()
Reset and initialize global indices with lexicographical order.
Reset the warning flag and clean up the treelist
Allocate all tree nodes in advance.
Recursive spliting (topdown).
Compute node and point MortonID.
Compute MortonID recursively.
Construct morton2node map for the local tree.
Adgust gids to the appropriate order.
size_t hmlp::tree::Tree< SETUP, NODEDATA >::depth = 0 |
depth of local tree
Lock hmlp::tree::Tree< SETUP, NODEDATA >::lock |
Mutex for exclusive right to modify treelist and morton2node.
size_t hmlp::tree::Tree< SETUP, NODEDATA >::m = 0 |
maximum leaf node size
unordered_map<size_t, NODE*> hmlp::tree::Tree< SETUP, NODEDATA >::morton2node |
Map MortonID to tree nodes. When distributed tree inherits Tree, morton2node will also contain distributed and LET node.
size_t hmlp::tree::Tree< SETUP, NODEDATA >::n = 0 |
number of points
SETUP hmlp::tree::Tree< SETUP, NODEDATA >::setup |
data shared by all tree nodes
vector<NODE*> hmlp::tree::Tree< SETUP, NODEDATA >::treelist |
Local tree nodes in the top-down order.