One critical bug fixed in distributed GNP, where the reference tree was grabbed multiple times.
This commit is contained in:
+9
-3
@@ -9,7 +9,6 @@
|
||||
#ifndef CORE_GNP_DISTRIBUTED_DUALTREE_DFS_DEV_H
|
||||
#define CORE_GNP_DISTRIBUTED_DUALTREE_DFS_DEV_H
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/mpi.hpp>
|
||||
#include "core/gnp/distributed_dualtree_dfs.h"
|
||||
#include "core/gnp/dualtree_dfs_dev.h"
|
||||
@@ -126,8 +125,15 @@ void DistributedDualtreeDfs<DistributedProblemType>::ReduceScatter_(
|
||||
for(typename std::map<int, int>::const_iterator it =
|
||||
sub_engine.unpruned_reference_nodes().begin();
|
||||
it != sub_engine.unpruned_reference_nodes().end(); it++) {
|
||||
receive_requests[i].push_back(
|
||||
std::pair<int, int>(it->first, it->second));
|
||||
|
||||
// This operation might be less than ideal, so change it
|
||||
// later.
|
||||
std::pair<int, int> new_pair(it->first, it->second);
|
||||
if(std::find(
|
||||
receive_requests[i].begin(), receive_requests[i].end(),
|
||||
new_pair) == receive_requests[i].end()) {
|
||||
receive_requests[i].push_back(new_pair);
|
||||
}
|
||||
}
|
||||
new_computation_frontier[i].insert(
|
||||
new_computation_frontier[i].end(),
|
||||
|
||||
@@ -284,4 +284,5 @@ int main(int argc, char *argv[]) {
|
||||
core::optimization::TrustRegionSearchMethod::STEIHAUG);
|
||||
|
||||
printf("All tests passed!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+8
@@ -591,6 +591,14 @@ class DistributedTreeBuilder {
|
||||
printf(
|
||||
"Took %g seconds to read in the distributed tree.\n",
|
||||
distributed_table_index_timer.elapsed());
|
||||
printf(
|
||||
"The following is the distribution of points among all MPI "
|
||||
"processes.\n");
|
||||
for(int i = 0; i < world.size(); i++) {
|
||||
printf(
|
||||
"Process %d has %d points.\n", i,
|
||||
distributed_table_->local_n_entries(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
namespace core {
|
||||
namespace table {
|
||||
extern core::table::MemoryMappedFile *global_m_file_;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace core {
|
||||
namespace parallel {
|
||||
@@ -38,7 +38,7 @@ class TableExchange {
|
||||
|
||||
std::vector<int *> new_from_old_cache_;
|
||||
|
||||
std::vector< SubTableListType > received_subtables;
|
||||
std::vector< SubTableListType > received_subtables_;
|
||||
|
||||
public:
|
||||
|
||||
@@ -60,18 +60,18 @@ class TableExchange {
|
||||
SubTableType &FindSubTable(int process_id, int begin, int count) {
|
||||
|
||||
// Naive search, but probably should use a STL map here...
|
||||
for(unsigned int i = 0; i < received_subtables[process_id].size(); i++) {
|
||||
for(unsigned int i = 0; i < received_subtables_[process_id].size(); i++) {
|
||||
if(
|
||||
received_subtables[
|
||||
received_subtables_[
|
||||
process_id][i].table()->get_tree()->begin() == begin &&
|
||||
received_subtables[
|
||||
received_subtables_[
|
||||
process_id][i].table()->get_tree()->count() == count) {
|
||||
return received_subtables[process_id][i];
|
||||
return received_subtables_[process_id][i];
|
||||
}
|
||||
}
|
||||
|
||||
// The code should not get to this point.
|
||||
return received_subtables[process_id][0];
|
||||
return received_subtables_[process_id][0];
|
||||
}
|
||||
|
||||
void Init(
|
||||
@@ -150,16 +150,16 @@ class TableExchange {
|
||||
}
|
||||
|
||||
// Clear the received subtables and resize.
|
||||
received_subtables.resize(0);
|
||||
received_subtables.resize(world.size());
|
||||
received_subtables_.resize(0);
|
||||
received_subtables_.resize(world.size());
|
||||
for(unsigned int j = 0; j < receive_requests.size(); j++) {
|
||||
for(unsigned int i = 0; i < receive_requests[j].size(); i++) {
|
||||
received_subtables[j].push_back(
|
||||
received_subtables_[j].push_back(
|
||||
j, point_cache_[j], old_from_new_cache_[j], new_from_old_cache_[j],
|
||||
max_num_levels_to_serialize);
|
||||
}
|
||||
}
|
||||
boost::mpi::all_to_all(world, send_subtables, received_subtables);
|
||||
boost::mpi::all_to_all(world, send_subtables, received_subtables_);
|
||||
|
||||
// Clear the receive requests so that it can be used in the next
|
||||
// iteration.
|
||||
@@ -169,7 +169,7 @@ class TableExchange {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -360,7 +360,7 @@ class SubTable {
|
||||
tree_ = table_in->get_tree_offset_ptr();
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/** @file sub_table_list.h
|
||||
*
|
||||
* An abstract class to maintain a list of subtables to aid in the
|
||||
* all-to-all exchange.
|
||||
*
|
||||
* @author Dongryeol Lee (dongryel@cc.gatech.edu)
|
||||
*/
|
||||
@@ -11,6 +14,9 @@
|
||||
|
||||
namespace core {
|
||||
namespace table {
|
||||
|
||||
/** @brief An abstract class for a list of subtables.
|
||||
*/
|
||||
template<typename IncomingSubTableType>
|
||||
class SubTableList {
|
||||
public:
|
||||
@@ -21,20 +27,36 @@ class SubTableList {
|
||||
typedef IncomingSubTableType SubTableType;
|
||||
|
||||
private:
|
||||
|
||||
// For boost serialization.
|
||||
friend class boost::serialization::access;
|
||||
|
||||
/** @brief The list of subtables.
|
||||
*/
|
||||
std::vector<SubTableType> list_;
|
||||
|
||||
public:
|
||||
|
||||
/** @brief Resets the subtable list to be an empty list.
|
||||
*/
|
||||
void Reset() {
|
||||
list_.resize(0);
|
||||
}
|
||||
|
||||
/** @brief Returns the subtable at a given position.
|
||||
*/
|
||||
SubTableType &operator[](int pos) {
|
||||
return list_[pos];
|
||||
}
|
||||
|
||||
/** @brief The size of the subtable list.
|
||||
*/
|
||||
unsigned int size() const {
|
||||
return list_.size();
|
||||
}
|
||||
|
||||
/** @brief Serializes each element of the subtable list.
|
||||
*/
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar, const unsigned int version) {
|
||||
for(unsigned int i = 0; i < list_.size(); i++) {
|
||||
@@ -42,6 +64,8 @@ class SubTableList {
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief Pushes back a subtable for loading.
|
||||
*/
|
||||
template<typename OldFromNewIndexType>
|
||||
void push_back(
|
||||
int rank_in, core::table::DenseMatrix &data_alias_in,
|
||||
@@ -54,6 +78,9 @@ class SubTableList {
|
||||
max_num_levels_to_serialize_in);
|
||||
}
|
||||
|
||||
/** @brief Pushes back a starting node and the number of levels to
|
||||
* serialize under.
|
||||
*/
|
||||
template<typename TableType, typename TreeType>
|
||||
void push_back(
|
||||
TableType *table_in, TreeType *start_node_in,
|
||||
@@ -63,7 +90,7 @@ class SubTableList {
|
||||
table_in, start_node_in, max_num_levels_to_serialize_in);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user