Fixing Allocation of Nodes

This commit is contained in:
Noah L. Schrick 2022-01-30 16:45:51 -06:00
parent 7013ef8e2c
commit fd4ffdfd10
2 changed files with 8 additions and 3 deletions

Binary file not shown.

View File

@ -372,7 +372,7 @@ AGGenInstance &AGGen::generate(bool batch_process, int batch_size, int numThrd,
if(world.size() <= num_tasks)
alloc = 1;
else
alloc = ceil((world.size()-num_tasks)/2);
alloc = 1 + ceil((world.size()-num_tasks)/2);
//Task 2 Node Allocating
int reduc_factor = 0;
@ -384,7 +384,12 @@ AGGenInstance &AGGen::generate(bool batch_process, int batch_size, int numThrd,
//Create Communicators
boost::mpi::communicator tcomm = world.split(world.rank() > 0 && world.rank() <= alloc);
boost::mpi::communicator ttwo_comm = world.split(world.rank() >= send_check(world, alloc) && world.rank() <= (2*two_alloc));
boost::mpi::communicator ttwo_comm;
if(world.size() == 2){
ttwo_comm = world.split(world.rank() == send_check(world, alloc) && world.rank() <= (2*two_alloc));
}
else
ttwo_comm = world.split(world.rank() >= send_check(world, alloc) && world.rank() <= (2*two_alloc));
while (!localFrontier.empty() || !unex_empty() || world.rank() > 0){//while starts
@ -448,7 +453,7 @@ AGGenInstance &AGGen::generate(bool batch_process, int batch_size, int numThrd,
//Execute Task 2
//if(world.rank() == send_check(world, alloc) && world.rank() <= send_check(world, 2*two_alloc))
//Edge case: 2 nodes
//Edge case: 2 nodes: This prevents node 1 from accessing the execution of task 2
if((world.size() == 2 && world.rank() == 0) || world.size() > 2)
{
if(world.rank() >= send_check(world, alloc) && world.rank() <= (2*two_alloc))