From 3da2003d291d8f47fd426592844d72a9a6872fa3 Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Sun, 16 Jan 2011 03:37:09 +0000 Subject: [PATCH] Bug fixed. Now need to deal with the MPI message sizes. --- .../core/gnp/distributed_dualtree_dfs_dev.h | 16 +++++++++++----- .../thesis_research/core/gnp/dualtree_dfs_dev.h | 2 +- .../distributed_kde/distributed_kde.test.cc | 17 +++++++++++++++-- 3 files changed, 27 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 b4537c9de3..769acc1e81 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 @@ -114,7 +114,7 @@ void DistributedDualtreeDfs::AllToAllReduce_( if(i != world_->rank()) { for(unsigned int j = 0; j < computation_frontier[i].size(); j++) { int sorted_index = computation_frontier_priorities[i][j].first; - DualtreeDfs sub_engine; + core::gnp::DualtreeDfs sub_engine; ProblemType sub_problem; ArgumentType sub_argument; SubTableType &frontier_reference_subtable = @@ -152,10 +152,16 @@ void DistributedDualtreeDfs::AllToAllReduce_( sub_engine.unpruned_query_reference_pairs().end()); // Insert the priorities for the new computation. - new_computation_frontier_priorities[i].insert( - new_computation_frontier_priorities[i].end(), - sub_engine.unpruned_query_reference_pair_priorities().begin(), - sub_engine.unpruned_query_reference_pair_priorities().end()); + int initial_new_computation_frontier_priorities_size = + new_computation_frontier_priorities[i].size(); + for(unsigned int k = 0; + k < sub_engine.unpruned_query_reference_pair_priorities().size(); + k++) { + new_computation_frontier_priorities[i].push_back( + sub_engine.unpruned_query_reference_pair_priorities()[k]); + new_computation_frontier_priorities[i].back().first += + initial_new_computation_frontier_priorities_size; + } } // Looping over each of the outstanding work from the $i$-th // process. diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/dualtree_dfs_dev.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/dualtree_dfs_dev.h index 3be1b7e655..b20c45e8f8 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/dualtree_dfs_dev.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/dualtree_dfs_dev.h @@ -403,7 +403,7 @@ bool DualtreeDfs::DualtreeCanonical_( qnode, std::pair(rnode->begin(), rnode->count()))); unpruned_query_reference_pair_priorities_.push_back( std::pair( - unpruned_query_reference_pair_priorities_.size(), + unpruned_query_reference_pairs_.size() - 1, squared_distance_range.lo)); unpruned_reference_nodes_[rnode->begin()] = rnode->count(); } diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/mlpack/distributed_kde/distributed_kde.test.cc b/fastlib/trunk/contrib/dongryel/thesis_research/mlpack/distributed_kde/distributed_kde.test.cc index 0927de9724..6b279ac64e 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/mlpack/distributed_kde/distributed_kde.test.cc +++ b/fastlib/trunk/contrib/dongryel/thesis_research/mlpack/distributed_kde/distributed_kde.test.cc @@ -306,14 +306,27 @@ class TestDistributed_Kde { distributed_kde_instance.Compute( distributed_kde_arguments, &distributed_kde_result); + // For each process, check whether all the othe reference points + // have been encountered. + DistributedTableType *distributed_reference_table = + distributed_kde_arguments.reference_table_; + int total_num_points = -1; + for(int i = 0; i < world.size(); i++) { + total_num_points += distributed_reference_table->local_n_entries(i); + } + for(unsigned int i = 0; i < distributed_kde_result.pruned_.size(); i++) { + if(distributed_kde_result.pruned_[i] != total_num_points) { + std::cerr << "Not all reference point have been accounted for.\n"; + exit(-1); + } + } + // Call the ultra-naive. std::vector ultra_naive_distributed_kde_result; // The master collects all the distributed tables and collects a // mega-table for which can be used to compute the naive // results. - DistributedTableType *distributed_reference_table = - distributed_kde_arguments.reference_table_; TableType combined_reference_table; int *total_distribution; CombineTables_(