From d8934d0fa10eee664fe19f732eb2d55c4ac60ee7 Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Fri, 31 Dec 2010 14:18:46 +0000 Subject: [PATCH] I think all fixed, now onto performance tuning. --- .../core/gnp/distributed_dualtree_dfs_dev.h | 25 +++++++++++++------ .../core/parallel/table_exchange.h | 7 +++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h index 55ba695b73..96b24106ee 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h @@ -1,4 +1,7 @@ /** @file distributed_dualtree_dfs_dev.h + * + * The generic algorithm template for distributed dual-tree + * computation. * * @author Dongryeol Lee (dongryel@cc.gatech.edu) */ @@ -90,8 +93,11 @@ void core::gnp::DistributedDualtreeDfs::ReduceScatter_( // Each process calls the independent sets of serial dual-tree dfs // algorithms. Further parallelism can be exploited here. - receive_requests.resize(0); - receive_requests.resize(world_->size()); + std::vector < + std::vector < + std::pair > > > new_computation_frontier; + new_computation_frontier.resize(world_->size()); + for(int i = 0; i < world_->size(); i++) { if(i != world_->rank()) { for(unsigned int j = 0; j < computation_frontier[i].size(); j++) { @@ -119,12 +125,17 @@ void core::gnp::DistributedDualtreeDfs::ReduceScatter_( receive_requests[i].push_back( std::pair(it->first, it->second)); } - - // Need to update the computation frontier here. - - } + new_computation_frontier[i].insert( + new_computation_frontier[i].end(), + sub_engine.unpruned_query_reference_pairs().begin(), + sub_engine.unpruned_query_reference_pairs().end()); + } // Looping over each of the outstanding work from the $i$-th + // process. } - } + } // end of taking care of the computation frontier. + + // Now copy over and make the new computation frontier. + computation_frontier = new_computation_frontier; } while(true); } diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/parallel/table_exchange.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/parallel/table_exchange.h index c06f36e553..177ba87af5 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/parallel/table_exchange.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/parallel/table_exchange.h @@ -111,7 +111,7 @@ class TableExchange { boost::mpi::communicator &world, int max_num_levels_to_serialize, TableType &local_table, - const std::vector < + std::vector < std::vector< std::pair > > &receive_requests) { // The gathered request lists to send to each process. @@ -161,6 +161,11 @@ class TableExchange { } boost::mpi::all_to_all(world, send_subtables, received_subtables); + // Clear the receive requests so that it can be used in the next + // iteration. + receive_requests.resize(0); + receive_requests.resize(world.size()); + return false; } };