From bcaf5ff7426fca6d714ac4ac002069fc41f82abc Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Sun, 6 Feb 2011 05:05:47 +0000 Subject: [PATCH] Some changes in the distributed tree build. --- .../core/table/distributed_table.h | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/distributed_table.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/distributed_table.h index 8a6b8f56c1..cb8a43aa9b 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/distributed_table.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/distributed_table.h @@ -56,7 +56,8 @@ class DistributedTable: public boost::noncopyable { typedef std::pair IndexType; // For giving private access to the distributed tree builder class. - friend class core::parallel::VanillaDistributedTreeBuilder; + friend class core::parallel::VanillaDistributedTreeBuilder < + DistributedTableType >; public: class TreeIterator { @@ -198,11 +199,16 @@ class DistributedTable: public boost::noncopyable { owned_table_->n_attributes(), world.size()); core::table::DensePoint root_bound_center; owned_table_->get_tree()->bound().center(&root_bound_center); - boost::mpi::all_gather( + boost::mpi::gather( world, root_bound_center.ptr(), - owned_table_->n_attributes(), global_table_->data().ptr()); - global_table_->IndexData(metric_in, 1); + owned_table_->n_attributes(), global_table_->data().ptr(), 0); + + // The master builds the tree and broadcasts the nodes. + if(world.rank() == 0) { + global_table_->IndexData(metric_in, 1); + } + boost::mpi::broadcast(world, *global_table_, 0); } public: @@ -277,6 +283,12 @@ class DistributedTable: public boost::noncopyable { return owned_table_.get(); } + /** @brief Retrieves the global new from old mapping. + */ + int *new_from_old() { + return global_table_->new_from_old(); + } + /** @brief Retrieves the global tree. */ TreeType *get_tree() {