Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::MetisMeshPartitioner Class Reference

Mesh partitioner using the PARMetis library. More...

Inheritance diagram for Arcane::MetisMeshPartitioner:
Collaboration diagram for Arcane::MetisMeshPartitioner:

Public Member Functions

 MetisMeshPartitioner (const ServiceBuildInfo &sbi)
void build () override
 Build-level construction of the service.
void partitionMesh (bool initial_partition) override
void partitionMesh (bool initial_partition, Int32 nb_part) override
Public Member Functions inherited from Arcane::ArcaneMetisMeshPartitionerObject
 ArcaneMetisMeshPartitionerObject (const Arcane::ServiceBuildInfo &sbi)
 Constructeur.
virtual ~ArcaneMetisMeshPartitionerObject ()
 Destructeur.
CaseOptionsMetisMeshPartitioneroptions () const
 Options du jeu de données du service.
Public Member Functions inherited from Arcane::MeshPartitionerBase
 MeshPartitionerBase (const ServiceBuildInfo &sbi)
ISubDomainsubDomain () const
IMeshmesh () const override
 Mesh associated with the partitioner.
void setMaximumComputationTime (Real v) override
 Sets the proportion of computation time.
Real maximumComputationTime () const override
void setImbalance (Real v) override
 Sets the computation time imbalance.
Real imbalance () const override
 Computation time imbalance.
void setMaxImbalance (Real v) override
 Sets the maximum allowed imbalance.
Real maxImbalance () const override
 Maximum allowed imbalance.
void setComputationTimes (RealConstArrayView v) override
 Computation time of this subdomain. The first element indicates the computation time of the subdomain corresponding to calculations whose cost is proportional to the cells. The following must be associated with a variable (to be done).
RealConstArrayView computationTimes () const override
void setCellsWeight (ArrayView< float > weights, Integer nb_weight) override
 Allows defining the weights of objects to be partitioned: ILoadBalanceMng must now be used.
ArrayView< float > cellsWeight () const override
Integer nbCellWeight () const
void setILoadBalanceMng (ILoadBalanceMng *mng) override
 Changes the ILoadBalanceMng to use.
ILoadBalanceMngloadBalanceMng () const override
void notifyEndPartition () override
 Notification when a re-partitioning finishes (after entity exchange).
virtual void changeOwnersFromCells ()
 Positions the new owners of nodes, edges and faces based on the cells.
virtual void initConstraints (bool uidref=true)
virtual void freeConstraints ()
virtual Int32 nbOwnCellsWithConstraints () const
virtual Real getNeighbourCellsUidWithConstraints (Cell cell, Int64Array &neighbourcells, Array< float > *commWeights=NULL, bool noCellContrib=false)
virtual Integer nbNeighbourCellsWithConstraints (Cell cell)
virtual void getNeighbourNodesUidWithConstraints (Cell cell, Int64UniqueArray neighbournodes)
virtual Int32 localIdWithConstraints (Cell cell)
virtual Int32 localIdWithConstraints (Int32 cell_lid)
virtual void invertArrayLid2LidCompacted ()
virtual SharedArray< float > cellsWeightsWithConstraints (Int32 max_nb_weight=0, bool ask_lb_cells=false)
virtual SharedArray< float > cellsSizeWithConstraints ()
virtual bool cellUsedWithConstraints (Cell cell)
virtual bool cellUsedWithWeakConstraints (std::pair< Int64, Int64 > &paired_item)
virtual void changeCellOwner (Item cell, VariableItemInt32 &cells_new_owner, Int32 new_owner)
virtual bool haveConstraints ()
virtual bool haveWeakConstraints ()
Public Member Functions inherited from Arcane::AbstractService
 ~AbstractService () override
 Destructor.
IServiceInfoserviceInfo () const override
 Access to service information. See IServiceInfo for details.
IBaseserviceParent () const override
 Access to the base interface of main Arcane objects.
IServiceserviceInterface () override
 Returns the low-level IService interface of the service.
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const
Public Member Functions inherited from Arcane::IService
virtual ~IService ()
 Releases resources.
Public Member Functions inherited from Arcane::IMeshPartitioner
virtual IPrimaryMeshprimaryMesh () override
 Associated mesh.
Public Member Functions inherited from Arcane::IMeshPartitionerBase
virtual ~IMeshPartitionerBase ()=default
 Releases resources.

Private Member Functions

void _partitionMesh (bool initial_partition, Int32 nb_part)
void _removeEmptyPartsV1 (Int32 nb_part, Int32 nb_own_cell, ArrayView< idxtype > metis_part)
 Fills empty partitions (version 1).
void _removeEmptyPartsV2 (Int32 nb_part, ArrayView< idxtype > metis_part)
 Fills empty partitions (version 2).
Int32 _removeEmptyPartsV2Helper (Int32 nb_part, ArrayView< idxtype > metis_part, Int32 algo_iteration)
 Applies one iteration of the empty partition removal algorithm.
int _writeGraph (IParallelMng *pm, Span< const idxtype > metis_vtkdist, Span< const idxtype > metis_xadj, Span< const idxtype > metis_adjncy, Span< const idxtype > metis_vwgt, Span< const idxtype > metis_ewgt, const String &Name) const

Private Attributes

IParallelMngm_parallel_mng = nullptr
Integer m_nb_refine = -1
Integer m_random_seed = 15
bool m_disable_floatingexception = false

Additional Inherited Members

Public Types inherited from Arcane::MeshPartitionerBase
enum  eMarkCellWithConstraint {
  eCellClassical , eCellReference , eCellGrouped , eCellGhost ,
  eCellInAConstraint
}
Static Public Member Functions inherited from Arcane::ArcaneMetisMeshPartitionerObject
template<typename ServiceClassType>
static void fillServiceInfo (Arcane::ServiceInfo *si)
Protected Member Functions inherited from Arcane::MeshPartitionerBase
virtual void dumpObject (String filename="toto")
 Dumps the partitioning information to disk.
virtual void * getCommunicator () const
virtual Parallel::Communicator communicator () const
virtual bool cellComm ()
virtual void _initArrayCellsWithConstraints ()
virtual void _initFilterLidCells ()
virtual void _initUidRef ()
virtual void _initUidRef (VariableCellInteger &cell_renum_uid)
virtual void _initLid2LidCompacted ()
virtual void _initNbCellsWithConstraints ()
virtual void _clearCellWgt ()
bool _isNonManifoldMesh () const
Int32 _meshDimension () const
Protected Member Functions inherited from Arcane::AbstractService
 AbstractService (const ServiceBuildInfo &)
 Constructor from a ServiceBuildInfo.
Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const
Protected Member Functions inherited from Arcane::IService
 IService ()
 Constructor.
Protected Attributes inherited from Arcane::MeshPartitionerBase
IItemFamilym_cell_family = nullptr

Detailed Description

Mesh partitioner using the PARMetis library.

Definition at line 75 of file MetisMeshPartitioner.cc.

Constructor & Destructor Documentation

◆ MetisMeshPartitioner()

Arcane::MetisMeshPartitioner::MetisMeshPartitioner ( const ServiceBuildInfo & sbi)
explicit

Definition at line 113 of file MetisMeshPartitioner.cc.

Member Function Documentation

◆ _partitionMesh()

void Arcane::MetisMeshPartitioner::_partitionMesh ( bool initial_partition,
Int32 nb_part )
private

The following loop is used to fix a ParMetis bug: ParMetis does not know how to deal with several imbalances ... If we detect that load imbalance cannot be insured, we increase all load imbalances.

Definition at line 153 of file MetisMeshPartitioner.cc.

References _removeEmptyPartsV1(), _removeEmptyPartsV2(), _writeGraph(), Arcane::Array< T >::add(), Arcane::IParallelMng::allGather(), ARCANE_FATAL, ARCANE_THROW, Arcane::Array< T >::begin(), Arcane::MetisWrapper::callAdaptiveRepart(), Arcane::MetisWrapper::callPartKway(), Arcane::MeshPartitionerBase::changeOwnersFromCells(), Arcane::ISubDomain::commonVariables(), Arcane::IParallelMng::commRank(), Arcane::IParallelMng::commSize(), Arcane::IParallelMng::communicator(), Arcane::Array< T >::constView(), Arcane::Array< T >::data(), ENUMERATE_, ENUMERATE_CELL, Arcane::Array< T >::fill(), Arcane::platform::getEnvironmentVariable(), Arcane::CommonVariables::globalIteration(), Arcane::Item::hasFlags(), Arcane::IK_Cell, Arcane::MeshPartitionerBase::imbalance(), Arcane::TraceAccessor::info(), Arcane::GraphDistributor::initWithOneRankPerNode(), Arcane::IParallelMng::isThreadImplementation(), Arcane::String::localstr(), Arcane::MeshPartitionerBase::maxImbalance(), Arcane::Cell::nbEdge(), Arcane::Cell::nbFace(), Arcane::String::null(), Arcane::ArcaneMetisMeshPartitionerObject::options(), Arcane::IVariable::PNoDump, Arcane::MessagePassing::ReduceMax, Arcane::Array< T >::reserve(), Arcane::Array< T >::resize(), Arcane::AbstractArray< T >::size(), Arcane::Convert::toInteger(), Arcane::StringBuilder::toString(), and Arcane::String::upper().

Here is the call graph for this function:

◆ _removeEmptyPartsV1()

void Arcane::MetisMeshPartitioner::_removeEmptyPartsV1 ( Int32 nb_part,
Int32 nb_own_cell,
ArrayView< idxtype > metis_part )
private

Fills empty partitions (version 1).

This version is the only one available in versions 2.18 (February 2020) and earlier of Arcane. The subdomain that has the most cells in gives one for each empty partition. This does not work if there are more empty partitions than cells in the most filled subdomain. To avoid this problem, version 2 of the algorithm applies this iteratively.

Definition at line 689 of file MetisMeshPartitioner.cc.

References Arcane::IParallelMng::commRank(), Arcane::IParallelMng::computeMinMaxSum(), and Arcane::TraceAccessor::info().

Referenced by _partitionMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeEmptyPartsV2()

void Arcane::MetisMeshPartitioner::_removeEmptyPartsV2 ( Int32 nb_part,
ArrayView< idxtype > metis_part )
private

Fills empty partitions (version 2).

This version applies version 1 iteratively to ensure that no empty partitions are left.

Definition at line 837 of file MetisMeshPartitioner.cc.

References _removeEmptyPartsV2Helper(), Arcane::TraceAccessor::info(), and Arcane::TraceAccessor::pwarning().

Referenced by _partitionMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeEmptyPartsV2Helper()

Int32 Arcane::MetisMeshPartitioner::_removeEmptyPartsV2Helper ( Int32 nb_part,
ArrayView< idxtype > metis_part,
Int32 algo_iteration )
private

Applies one iteration of the empty partition removal algorithm.

It is the same algorithm as _removeEmptyPartsLegacy() but by ensuring that at least one cell is left in the partition that gives its cells to the empty partitions.

Definition at line 754 of file MetisMeshPartitioner.cc.

References Arcane::Array< T >::add(), ARCANE_FATAL, Arcane::IParallelMng::commRank(), Arcane::IParallelMng::computeMinMaxSum(), Arcane::TraceAccessor::info(), and Arcane::ArrayView< T >::size().

Referenced by _removeEmptyPartsV2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _writeGraph()

int Arcane::MetisMeshPartitioner::_writeGraph ( IParallelMng * pm,
Span< const idxtype > metis_vtkdist,
Span< const idxtype > metis_xadj,
Span< const idxtype > metis_adjncy,
Span< const idxtype > metis_vwgt,
Span< const idxtype > metis_ewgt,
const String & name ) const
private

This function saves the graph in Scotch distributed file format.

Definition at line 866 of file MetisMeshPartitioner.cc.

References Arcane::IParallelMng::barrier(), Arcane::IParallelMng::commRank(), Arcane::IParallelMng::commSize(), Arcane::ITraceMng::flush(), Arcane::TraceAccessor::info(), Arcane::String::localstr(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceSum, Arcane::SpanImpl< T, SizeType, Extent >::size(), Arcane::StringBuilder::toString(), and Arcane::TraceAccessor::traceMng().

Referenced by _partitionMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build()

void Arcane::MetisMeshPartitioner::build ( void )
inlineoverridevirtual

Build-level construction of the service.

This method is called right after the constructor.

Reimplemented from Arcane::AbstractService.

Definition at line 84 of file MetisMeshPartitioner.cc.

◆ partitionMesh() [1/2]

void Arcane::MetisMeshPartitioner::partitionMesh ( bool initial_partition)
overridevirtual

Re-partitions the mesh mesh

This method changes the owners of the entities and fills the IItemFamily::itemsNewOwner() variable of each entity family of the mesh mesh with the number of the new owning subdomain.

Note
This method is reserved for Arcane developers. If a module wishes to perform a re-partitioning, it must call the method IMeshUtilities::partitionAndExchangeMeshWithReplication() which handles both the partitioning and the exchange of information and supports domain replication.

Reimplemented from Arcane::IMeshPartitioner.

Definition at line 126 of file MetisMeshPartitioner.cc.

References partitionMesh().

Referenced by partitionMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partitionMesh() [2/2]

void Arcane::MetisMeshPartitioner::partitionMesh ( bool initial_partition,
Int32 nb_part )
overridevirtual

Implements Arcane::IMeshPartitioner.

Definition at line 136 of file MetisMeshPartitioner.cc.

Member Data Documentation

◆ m_disable_floatingexception

bool Arcane::MetisMeshPartitioner::m_disable_floatingexception = false
private

Definition at line 96 of file MetisMeshPartitioner.cc.

◆ m_nb_refine

Integer Arcane::MetisMeshPartitioner::m_nb_refine = -1
private

Definition at line 94 of file MetisMeshPartitioner.cc.

◆ m_parallel_mng

IParallelMng* Arcane::MetisMeshPartitioner::m_parallel_mng = nullptr
private

Definition at line 93 of file MetisMeshPartitioner.cc.

◆ m_random_seed

Integer Arcane::MetisMeshPartitioner::m_random_seed = 15
private

Definition at line 95 of file MetisMeshPartitioner.cc.


The documentation for this class was generated from the following file: