mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow disabling of initial MPI_Comm_dup(MPI_COMM_WORLD,...)
- can use -mpi-no-comm-dup to suppress the initial communicator duplication (to avoid potential deadlock with coupled processes). This is partly related to comments in merge-request !735 ENH: simplify parsing/removal of local -world option - can extract the world name in a single pass and also makes the parsing robuster. ENH: support regular MPI_Comm_split() - the two-step method of Allgather + Comm_create_group may not be expected by other applications (issue #3127) and that can lead to deadlock, so also add in code for the regular MPI_Comm_split. Does not support re-sorting keys! FIX: faulty logic for splitting communicators - only affected more recent develop branch
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
Test-parallel-comm2.C
|
||||
Test-parallel-comm2.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-parallel-comm2
|
||||
|
||||
@ -69,6 +69,7 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption("info", "information");
|
||||
argList::addBoolOption("print-tree", "Report tree(s) as graph");
|
||||
argList::addBoolOption("no-test", "Disable general tests");
|
||||
argList::addBoolOption("split", "Test Pstream split-comm");
|
||||
argList::addBoolOption("host-comm", "Test Pstream host-comm");
|
||||
argList::addBoolOption("host-broadcast", "Test host-base broadcasts");
|
||||
|
||||
@ -85,8 +86,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (UPstream::parRun() && optPrintTree)
|
||||
{
|
||||
Info<< "comms: "
|
||||
<< UPstream::whichCommunication(UPstream::worldComm) << nl;
|
||||
// Info<< "comms: "
|
||||
// << UPstream::whichCommunication(UPstream::worldComm) << nl;
|
||||
UPstream::printCommTree(UPstream::commWorld());
|
||||
}
|
||||
|
||||
@ -102,6 +103,34 @@ int main(int argc, char *argv[])
|
||||
<< flatOutput(UPstream::procID(UPstream::commLocalNode())) << nl;
|
||||
}
|
||||
|
||||
if (UPstream::parRun() && args.found("split"))
|
||||
{
|
||||
Info<< "split: alternative ranks" << nl;
|
||||
|
||||
const auto myRank = UPstream::myProcNo();
|
||||
|
||||
int colour =
|
||||
(
|
||||
(myRank == 5 || myRank == 6) // Exclude these ones
|
||||
? -1
|
||||
: (myRank % 2)
|
||||
);
|
||||
|
||||
UPstream::communicator comm =
|
||||
UPstream::communicator::split(UPstream::commWorld(), colour, true);
|
||||
|
||||
Pout<< "split ranks (colour=" << colour << ") "
|
||||
<< flatOutput(UPstream::procID(comm.comm())) << nl;
|
||||
|
||||
comm.reset();
|
||||
comm =
|
||||
UPstream::communicator::split(UPstream::commWorld(), colour, false);
|
||||
|
||||
Pout<< "Split ranks (colour=" << colour << ") "
|
||||
<< flatOutput(UPstream::procID(comm.comm())) << nl;
|
||||
}
|
||||
|
||||
|
||||
if (args.found("info"))
|
||||
{
|
||||
Info<< nl;
|
||||
@ -135,8 +164,8 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
|
||||
{
|
||||
Info<< "host-master: "
|
||||
<< UPstream::whichCommunication(commInterNode) << endl;
|
||||
// Info<< "host-master: "
|
||||
// << UPstream::whichCommunication(commInterNode) << endl;
|
||||
|
||||
UPstream::printCommTree(commInterNode);
|
||||
UPstream::printCommTree(commLocalNode);
|
||||
Reference in New Issue
Block a user