Skip to content

Commit

Permalink
renable test and try new way to split comms ref #1873
Browse files Browse the repository at this point in the history
r17907
  • Loading branch information
friedmud authored and permcody committed Feb 14, 2014
1 parent ecc2a4b commit 2c0b4d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
38 changes: 10 additions & 28 deletions framework/src/multiapps/MultiApp.C
Expand Up @@ -336,42 +336,24 @@ MultiApp::buildComm()
{
// If we've already hit the max number of procs per app then this processor
// won't have an app at all
std::cerr<<rank<<" No app!"<<std::endl;
// std::cerr<<rank<<" No app!"<<std::endl;
_has_an_app = false;
_my_comm = MPI_COMM_SELF;
procs_for_my_app = 1;
my_app = 0;
}
else if((unsigned int) my_app >= _total_num_apps-1) // The last app will gain any left-over procs
{
my_app = _total_num_apps - 1;
procs_for_my_app += _orig_num_procs % _total_num_apps;
_first_local_app = my_app;
_my_num_apps = 1;
}

// Only one app here
_first_local_app = my_app;
_my_num_apps = 1;

std::vector<int> ranks_in_my_group(procs_for_my_app);

// Add all the processors in that are in my group
for(unsigned int i=0; i<procs_for_my_app; i++)
ranks_in_my_group[i] = (my_app * procs_per_app) + i;

if(!_has_an_app)
ranks_in_my_group[0] = rank;

MPI_Group orig_group, new_group;

// Extract the original group handle
MPI_Comm_group(_orig_comm, &orig_group);

// Create a group
MPI_Group_incl(orig_group, procs_for_my_app, &ranks_in_my_group[0], &new_group);

// Create new communicator
MPI_Comm_create(_orig_comm, new_group, &_my_comm);
MPI_Comm_rank(_my_comm, (int*)&_my_rank);
if(_has_an_app)
MPI_Comm_split(_orig_comm, _first_local_app, rank, &_my_comm);
else
{
MPI_Comm_split(_orig_comm, MPI_UNDEFINED, rank, &_my_comm);
_my_comm = MPI_COMM_SELF;
}
}

unsigned int
Expand Down
1 change: 0 additions & 1 deletion test/tests/multiapps/max_procs_per_app/tests
Expand Up @@ -4,6 +4,5 @@
input = 'master.i'
exodiff = 'master_out.e master_out_sub0.e'
min_parallel = 3
skip = 'Hosed'
[../]
[]

0 comments on commit 2c0b4d7

Please sign in to comment.