ID Correction

This commit is contained in:
Noah L. Schrick 2022-02-11 22:47:11 -06:00
parent 1f72cfbfad
commit b9735af8cb

View File

@ -135,6 +135,7 @@ void task_one(AGGenInstance &instance, NetworkState &current_state,\
//Distribute the appl_exploit list from the extra node in task 1 to all other nodes in this task
if (alloc > two_alloc){
//Need to tell other nodes that we have data so they know to expect it
int has_data;
if (world.rank() == alloc){
if (appl_exploits.size() > 0){
@ -151,19 +152,23 @@ void task_one(AGGenInstance &instance, NetworkState &current_state,\
if(has_data==1){
std::vector<std::vector<std::tuple<Exploit, AssetGroup>>> sub_partials;
std::vector<std::tuple<Exploit, AssetGroup>> partial_appl_exploits;
if (world.rank() == alloc){
size_t num_data = appl_exploits.size()/(tcomm.size()-1);
size_t remain = appl_exploits.size()%(tcomm.size()-1);
int begin = 0;
int end = 0;
for (int i = 0; i < std::min((int)(tcomm.size()-1), (int)appl_exploits.size()); ++i){
//if our remainder hasn't been depleted, add num_data + 1 from remain, then decrement, otherwise just num_data
end += (remain > 0) ? (num_data + !!(remain--)) : num_data;
sub_partials.push_back(std::vector<std::tuple<Exploit, AssetGroup>>(appl_exploits.begin()+begin, appl_exploits.begin()+end));
begin = end;
if(!sub_partials.at(i).empty()){
mpi::request scatter_req = tcomm.isend(i, 21, sub_partials.at(i));
scatter_req.wait();
}
}
}
tcomm.barrier();
if(world.rank() < alloc){
if(tcomm.iprobe(alloc-1, 21)){
@ -251,7 +256,7 @@ void task_two(AGGenInstance &instance, int alloc, int two_alloc, boost::mpi::com
if(ttwo_comm.rank() != 0){
for (auto map_group : ex_groups){
if(sync_vectors[map_group].size() > 0){
if(!sync_vectors[map_group].empty()){
mpi::request sync_req = ttwo_comm.isend(0, 9, std::make_tuple(map_group, sync_vectors[map_group]));
sync_req.wait();
sync_vectors[map_group].clear();
@ -424,7 +429,7 @@ void task_three(AGGenInstance &instance, NetworkState &new_state, std::deque<Net
double mem_threshold, boost::mpi::communicator &world, int alloc, int two_alloc, NetworkState &current_state,\
Exploit &exploit, AssetGroup &assetGroup, std::unordered_map<size_t, int> &hash_map, int last_known_id){
//std::cout << "Started Task 3." << std::endl;
std::cout << "Started Task 3." << std::endl;
auto hash_num = new_state.get_hash(instance.facts);
//although local frontier is updated, the global hash is also updated to avoid testing on explored states.