FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Geometry::PartiZoltan Class Reference

Zoltan hypergraph partitioner backend. More...

#include <parti_zoltan.hpp>

Classes

class  Hypergraph
 internal data class to be used by callback functions More...
 

Public Member Functions

 PartiZoltan (const Dist::Comm &comm, Index min_elems=1000u, int max_procs=1000)
 Constructor. More...
 
virtual ~PartiZoltan ()
 virtual destructor
 
Adjacency::Graph build_elems_at_rank () const
 Builds and returns the elements-at-rank graph representing the partitioning. More...
 
bool execute (const Adjacency::Graph &faces_at_elem, const Index num_parts, const std::vector< Real > &weights)
 Executes the Zoltan partitioner. More...
 
template<int n_>
bool execute (const IndexSet< n_ > &faces_at_elem, const Index num_parts, const std::vector< Real > &weights)
 Executes the Zoltan partitioner. More...
 
int get_sub_comm_size () const
 Returns the size of the internal sub-communicator. More...
 

Protected Member Functions

bool _apply_zoltan ()
 auxiliary function: applies Zoltan onto the hypergraph
 
bool _broadcast_coloring (bool zoltan_ok)
 auxiliary function: broadcasts the coloring from the root process
 
void _create_hypergraph (const Adjacency::Graph &faces_at_elem, const std::vector< Real > &weights)
 auxiliary function: builds a hypergraph from the adjacency graph
 
bool _gather_coloring (const int num_export, const int *export_parts)
 auxiliary function: gathers the partitioned coloring onto the root process
 

Private Attributes

Adjacency::Coloring _coloring
 the element coloring More...
 
const Dist::Comm_comm
 our main communicator More...
 
Hypergraph _hypergraph
 our hypergraph structure More...
 
int _max_procs
 maximum number of MPI processes to use More...
 
Index _min_elems
 minimum number of elements per MPI process More...
 
Index _num_elems
 the total number of elements More...
 
Index _num_parts
 the desired number of partitions More...
 
Dist::Comm _zoltan_comm
 a sub-communicator for the partitioner More...
 
void * _zz
 zoltan internal data More...
 

Detailed Description

Zoltan hypergraph partitioner backend.

This class implements a backend for the Zoltan partitioner from the Sandia National Laboratories. This class only makes use for Zoltan's homebrew Hypergraph partitioners and does not use any of its other partitioning methods, although these could be integrated into this class later, if desired/required. This class is used by the Control::Domain::PartiDomainControl class and its functionality can be used by specifying the tag zoltan as a parameter to the –parti-type command line option.

Note that this class is only available if FEAT is configured and linked against the Zoltan third-party library, of course.

Todo:

figure out max_procs/min_elems

allow the user to configure more Zoltan parameters

Author
Peter Zajac

Definition at line 38 of file parti_zoltan.hpp.

Constructor & Destructor Documentation

◆ PartiZoltan()

FEAT::Geometry::PartiZoltan::PartiZoltan ( const Dist::Comm comm,
Index  min_elems = 1000u,
int  max_procs = 1000 
)
explicit

Constructor.

Parameters
[in]commA resident reference to the communicator to be used by the partitioner. In a recursive partitioning setting, this has to be the progeny communicator.

Note that this class might create a sub-communicator of comm internally if there are too many ranks in the communicator for the given number of mesh elements or desired number of partitions to improve the computation vs communication trade-off.

Member Function Documentation

◆ build_elems_at_rank()

Adjacency::Graph FEAT::Geometry::PartiZoltan::build_elems_at_rank ( ) const
inline

Builds and returns the elements-at-rank graph representing the partitioning.

Definition at line 145 of file parti_zoltan.hpp.

References _coloring, and FEAT::Adjacency::Coloring::create_partition_graph().

Referenced by FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::_apply_parti_zoltan().

◆ execute() [1/2]

bool FEAT::Geometry::PartiZoltan::execute ( const Adjacency::Graph faces_at_elem,
const Index  num_parts,
const std::vector< Real > &  weights 
)

Executes the Zoltan partitioner.

Parameters
[in]faces_at_elemA transient reference to the faces-at-element adjacency graph of the mesh that is to be partitioned. The face-dimension of the graph can be chosen freely, but typically in the finite element case this is the vertices-at-element index set of the mesh.
[in]num_partsThe desired number of partitions to create. Must be > 0, but it does not necessarily need to be equal to the number of processes in the communicator.
[in]weightsA vector containing the distribution weights for each element. May be empty if all elements are to be weighted equally.
Returns
true, if the partitioning was successful, or false, if some error occurred.

◆ execute() [2/2]

template<int n_>
bool FEAT::Geometry::PartiZoltan::execute ( const IndexSet< n_ > &  faces_at_elem,
const Index  num_parts,
const std::vector< Real > &  weights 
)
inline

Executes the Zoltan partitioner.

Parameters
[in]faces_at_elemA transient reference to the faces-at-element index set of the mesh that is to be partitioned. The face-dimension of the index set can be chosen freely, but typically in the finite element case this is the vertices-at-element index set of the mesh.
[in]num_partsThe desired number of partitions to create. Must be > 0, but it does not necessarily need to be equal to the number of processes in the communicator.
[in]weightsA vector containing the distribution weights for each element. May be empty if all elements are to be weighted equally.
Returns
true, if the partitioning was successful, or false, if some error occurred.

Definition at line 116 of file parti_zoltan.hpp.

References FEAT::Adjacency::as_is, and execute().

Referenced by FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::_apply_parti_zoltan(), and execute().

◆ get_sub_comm_size()

int FEAT::Geometry::PartiZoltan::get_sub_comm_size ( ) const
inline

Returns the size of the internal sub-communicator.

This only gives useful results after the execute() function has been called.

Definition at line 155 of file parti_zoltan.hpp.

References _zoltan_comm, and FEAT::Dist::Comm::size().

Member Data Documentation

◆ _coloring

Adjacency::Coloring FEAT::Geometry::PartiZoltan::_coloring
private

the element coloring

Definition at line 76 of file parti_zoltan.hpp.

Referenced by build_elems_at_rank().

◆ _comm

const Dist::Comm& FEAT::Geometry::PartiZoltan::_comm
private

our main communicator

Definition at line 62 of file parti_zoltan.hpp.

◆ _hypergraph

Hypergraph FEAT::Geometry::PartiZoltan::_hypergraph
private

our hypergraph structure

Definition at line 74 of file parti_zoltan.hpp.

◆ _max_procs

int FEAT::Geometry::PartiZoltan::_max_procs
private

maximum number of MPI processes to use

Definition at line 66 of file parti_zoltan.hpp.

◆ _min_elems

Index FEAT::Geometry::PartiZoltan::_min_elems
private

minimum number of elements per MPI process

Definition at line 68 of file parti_zoltan.hpp.

◆ _num_elems

Index FEAT::Geometry::PartiZoltan::_num_elems
private

the total number of elements

Definition at line 70 of file parti_zoltan.hpp.

◆ _num_parts

Index FEAT::Geometry::PartiZoltan::_num_parts
private

the desired number of partitions

Definition at line 72 of file parti_zoltan.hpp.

◆ _zoltan_comm

Dist::Comm FEAT::Geometry::PartiZoltan::_zoltan_comm
private

a sub-communicator for the partitioner

Definition at line 64 of file parti_zoltan.hpp.

Referenced by get_sub_comm_size().

◆ _zz

void* FEAT::Geometry::PartiZoltan::_zz
private

zoltan internal data

Definition at line 78 of file parti_zoltan.hpp.


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