Version: 9.14.0
MEDCoupling::MPIProcessorGroup Class Reference
Inheritance diagram for MEDCoupling::MPIProcessorGroup:
Collaboration diagram for MEDCoupling::MPIProcessorGroup:

Public Member Functions

bool containsMyRank () const
 
ProcessorGroupcreateComplementProcGroup () const
 
ProcessorGroupcreateProcGroup () const
 
virtual MPIProcessorGroupdeepCopy () const
 
virtual ProcessorGroupfuse (const ProcessorGroup &) const
 
const MPI_Comm * getComm () const
 
MPI_Comm getWorldComm ()
 
void intersect (ProcessorGroup &)
 
 MPIProcessorGroup (const CommInterface &interface)
 
 MPIProcessorGroup (const CommInterface &interface, int pstart, int pend, const MPI_Comm &world_comm=MPI_COMM_WORLD)
 
 MPIProcessorGroup (const CommInterface &interface, std::map< std::string, std::set< int >> proc_ids_by_name, const std::string &simCodeTag, const MPI_Comm &world_comm=MPI_COMM_WORLD)
 
 MPIProcessorGroup (const CommInterface &interface, std::set< int > proc_ids, const MPI_Comm &world_comm=MPI_COMM_WORLD)
 
 MPIProcessorGroup (const MPIProcessorGroup &other)
 
 MPIProcessorGroup (const ProcessorGroup &proc_group, std::set< int > proc_ids)
 
int myRank () const
 
void release ()
 
int translateRank (const ProcessorGroup *group, int rank) const
 
virtual ~MPIProcessorGroup ()
 
- Public Member Functions inherited from MEDCoupling::ProcessorGroup
bool contains (int rank) const
 
const CommInterfacegetCommInterface () const
 
virtual const std::set< int > & getProcIDs () const
 
virtual const std::set< int > & getProcIDsByName (const std::string &simCodeTag) const
 
 ProcessorGroup (const CommInterface &interface)
 
 ProcessorGroup (const CommInterface &interface, int start, int end)
 
 ProcessorGroup (const CommInterface &interface, std::map< std::string, std::set< int >> proc_ids_by_name, const std::string &simCodeTag)
 
 ProcessorGroup (const CommInterface &interface, std::set< int > proc_ids)
 
 ProcessorGroup (const ProcessorGroup &other)
 
 ProcessorGroup (const ProcessorGroup &proc_group, std::set< int > proc_ids)
 
int size () const
 
virtual ~ProcessorGroup ()
 

Additional Inherited Members

- Protected Attributes inherited from MEDCoupling::ProcessorGroup
const CommInterface _comm_interface
 
std::set< int > _proc_ids
 
std::map< std::string, std::set< int > > _proc_ids_by_name
 

Detailed Description

The MPIProcessorGroup class represents a set of distinct "processors" (computation nodes) in a MPI code. It is used to define the MPI topology of code couplings.

Groups can be set up in various ways, the most common being the use of the MPIProcessorGroup(Comminterface, int pfirst, int plast) constructor.

The following code excerpt creates two processor groups on respectively 3 and 2 processors.

int main()
{
MPI_Init(&argc,&argv);
CommInterface comm_interface;
MPIProcessorGroup codeA_group(comm_interface, 0, 2);  // groups processors 0, 1 and 2
MPIProcessorGroup codeB_group(comm_interface, 3, 4);  // groups processors 3 and 4

...
}

Constructor & Destructor Documentation

◆ MPIProcessorGroup() [1/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const CommInterface interface)

Creates a processor group that is based on all the processors of MPI_COMM_WORLD .This routine must be called by all processors in MPI_COMM_WORLD.

Parameters
interfaceCommInterface object giving access to the MPI communication layer

References MEDCoupling::ProcessorGroup::_comm_interface, MEDCoupling::ProcessorGroup::_proc_ids, MEDCoupling::CommInterface::commGroup(), MEDCoupling::CommInterface::commSize(), and MEDCoupling::ProcessorGroup::size().

Referenced by createComplementProcGroup(), createProcGroup(), deepCopy(), and fuse().

◆ MPIProcessorGroup() [2/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const CommInterface interface,
std::set< int >  proc_ids,
const MPI_Comm &  world_comm = MPI_COMM_WORLD 
)

Creates a processor group that is based on the processors included in proc_ids. This routine must be called by all processors in MPI_COMM_WORLD.

Parameters
interfaceCommInterface object giving access to the MPI communication layer
proc_idsset of ids that are to be integrated in the group. The ids number are to be understood in terms of MPI_COMM_WORLD ranks.

◆ MPIProcessorGroup() [3/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const CommInterface interface,
std::map< std::string, std::set< int >>  proc_ids_by_name,
const std::string &  simCodeTag,
const MPI_Comm &  world_comm = MPI_COMM_WORLD 
)

◆ MPIProcessorGroup() [4/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const ProcessorGroup proc_group,
std::set< int >  proc_ids 
)

◆ MPIProcessorGroup() [5/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const CommInterface comm_interface,
int  pstart,
int  pend,
const MPI_Comm &  world_comm = MPI_COMM_WORLD 
)

Creates a processor group that is based on the processors between pstart and pend. This routine must be called by all processors in MPI_COMM_WORLD.

Parameters
comm_interfaceCommInterface object giving access to the MPI communication layer
pstartid in MPI_COMM_WORLD of the first processor in the group
pendid in MPI_COMM_WORLD of the last processor in the group

References MEDCoupling::ProcessorGroup::_comm_interface, MEDCoupling::CommInterface::commCreate(), MEDCoupling::CommInterface::commGroup(), MEDCoupling::CommInterface::commRank(), MEDCoupling::CommInterface::commSize(), MEDCoupling::CommInterface::groupFree(), and MEDCoupling::CommInterface::groupIncl().

◆ MPIProcessorGroup() [6/6]

MEDCoupling::MPIProcessorGroup::MPIProcessorGroup ( const MPIProcessorGroup other)

◆ ~MPIProcessorGroup()

MEDCoupling::MPIProcessorGroup::~MPIProcessorGroup ( )
virtual

References release().

Member Function Documentation

◆ release()

void MEDCoupling::MPIProcessorGroup::release ( )

Destructor involves MPI operations: make sure this is accessible from a proper method for Python wrapping.

References MEDCoupling::ProcessorGroup::_comm_interface, MEDCoupling::CommInterface::commFree(), and MEDCoupling::CommInterface::groupFree().

Referenced by ~MPIProcessorGroup().

◆ deepCopy()

MPIProcessorGroup * MEDCoupling::MPIProcessorGroup::deepCopy ( ) const
virtual

◆ fuse()

ProcessorGroup * MEDCoupling::MPIProcessorGroup::fuse ( const ProcessorGroup group) const
virtual

Adding processors of group group to local group.

Parameters
groupgroup that is to be fused with current group
Returns
new group formed by the fusion of local group and group.

Implements MEDCoupling::ProcessorGroup.

References MEDCoupling::ProcessorGroup::_comm_interface, MEDCoupling::ProcessorGroup::_proc_ids, MEDCoupling::ProcessorGroup::getProcIDs(), and MPIProcessorGroup().

◆ intersect()

void MEDCoupling::MPIProcessorGroup::intersect ( ProcessorGroup )
virtual

◆ myRank()

int MEDCoupling::MPIProcessorGroup::myRank ( ) const
virtual

◆ containsMyRank()

bool MEDCoupling::MPIProcessorGroup::containsMyRank ( ) const
virtual

◆ translateRank()

int MEDCoupling::MPIProcessorGroup::translateRank ( const ProcessorGroup group,
int  rank 
) const
virtual

Translation of the rank id between two processor groups. This method translates rank rank on the current processor group to the rank on group pointed by group.

Parameters
groupgroup from which the rank is expected
rankrank on group group of the processor which is to be translated
Returns
rank on local group

Implements MEDCoupling::ProcessorGroup.

Referenced by MEDCoupling::StructuredCoincidentDEC::prepareSourceDE(), MEDCoupling::ExplicitCoincidentDEC::prepareTargetDE(), MEDCoupling::StructuredCoincidentDEC::prepareTargetDE(), MEDCoupling::ExplicitCoincidentDEC::recvData(), MEDCoupling::StructuredCoincidentDEC::recvData(), MEDCoupling::BlockTopology::serialize(), and MEDCoupling::ExplicitCoincidentDEC::transferMappingToSource().

◆ getComm()

◆ createComplementProcGroup()

ProcessorGroup * MEDCoupling::MPIProcessorGroup::createComplementProcGroup ( ) const
virtual

Creates a processor group that is the complement of the current group inside MPI_COMM_WORLD

Returns
pointer to the new ProcessorGroup structure.

Implements MEDCoupling::ProcessorGroup.

References MEDCoupling::ProcessorGroup::_comm_interface, MEDCoupling::ProcessorGroup::_proc_ids, MPIProcessorGroup(), and MEDCoupling::CommInterface::worldSize().

◆ createProcGroup()

ProcessorGroup * MEDCoupling::MPIProcessorGroup::createProcGroup ( ) const
virtual

◆ getWorldComm()

MPI_Comm MEDCoupling::MPIProcessorGroup::getWorldComm ( )