Skip to content
Snippets Groups Projects
Commit 8478595a authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: new broadcast version of Pstreams (#2371)

- The idea of broadcast streams is to replace multiple master to
  subProcs communications with a single MPI_Bcast.

    if (Pstream::master())
    {
        OPBstream toAll(Pstream::masterNo());
        toAll << data;
    }
    else
    {
        IPBstream fromMaster(Pstream::masterNo());
        fromMaster >> data;
    }

    // vs.
    if (Pstream::master())
    {
        for (const int proci : Pstream::subProcs())
        {
            OPstream os(Pstream::commsTypes::scheduled, proci);
            os << data;
        }
    }
    else
    {
        IPstream is(Pstream::commsTypes::scheduled, Pstream::masterNo());
        is >> data;
    }

  Can simply use UPstream::broadcast() directly for contiguous data
  with known lengths.

Based on ideas from T.Aoyagi(RIST), A.Azami(RIST)
parent a9cdaa1b
No related branches found
No related tags found
Loading
Showing
with 956 additions and 8 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment