Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zoltan2::PartitioningProblem< Adapter > Class Template Reference

PartitioningProblem sets up partitioning problems for the user. More...

#include <Zoltan2_PartitioningProblem.hpp>

Inheritance diagram for Zoltan2::PartitioningProblem< Adapter >:
Inheritance graph
[legend]
Collaboration diagram for Zoltan2::PartitioningProblem< Adapter >:
Collaboration graph
[legend]

Public Types

typedef Adapter::scalar_t scalar_t
 
typedef Adapter::gno_t gno_t
 
typedef Adapter::lno_t lno_t
 
typedef Adapter::part_t part_t
 
typedef Adapter::user_t user_t
 
typedef Adapter::base_adapter_t base_adapter_t
 

Public Member Functions

 PartitioningProblem (Adapter *A, ParameterList *p, const RCP< const Teuchos::Comm< int > > &comm)
 Constructor where Teuchos communicator is specified. More...
 
 PartitioningProblem (Adapter *A, ParameterList *p)
 Constructor where communicator is the Teuchos default. More...
 
 ~PartitioningProblem ()
 Destructor. More...
 
void solve (bool updateInputData=true)
 Direct the problem to create a solution. More...
 
const PartitioningSolution
< Adapter > & 
getSolution ()
 Get the solution to the problem. More...
 
void setPartSizes (int len, part_t *partIds, scalar_t *partSizes, bool makeCopy=true)
 Set or reset relative sizes for the parts that Zoltan2 will create. More...
 
void setPartSizesForCriteria (int criteria, int len, part_t *partIds, scalar_t *partSizes, bool makeCopy=true)
 Set or reset the relative sizes (per weight) for the parts that Zoltan2 will create. More...
 
- Public Member Functions inherited from Zoltan2::Problem< Adapter >
 Problem (const Adapter *input, ParameterList *params, const RCP< const Comm< int > > &comm)
 Constructor where Teuchos communicator is specified. More...
 
virtual ~Problem ()
 Destructor. More...
 
RCP< const Comm< int > > getComm ()
 Return the communicator used by the problem. More...
 
void resetParameters (ParameterList *params)
 Reset the list of parameters. More...
 
void printTimers () const
 Return the communicator passed to the problem. More...
 
const RCP< const Environment > & getEnvironment () const
 Get the current Environment. Useful for testing. More...
 
- Public Member Functions inherited from Zoltan2::ProblemRoot
virtual ~ProblemRoot ()
 

Static Public Member Functions

static void getValidParameters (ParameterList &pl)
 Set up validators specific to this Problem. More...
 
- Static Public Member Functions inherited from Zoltan2::Problem< Adapter >
static void getValidParameters (ParameterList &pl)
 

Protected Member Functions

void initializeProblem ()
 
virtual void processAlgorithmName (const std::string &algorithm, const std::string &defString, const std::string &model, Environment &env, bool &removeSelfEdges, bool &isGraphType, bool &needConsecutiveGlobalIds)
 
void createPartitioningProblem (bool newData)
 
virtual void createAlgorithm ()
 

Protected Attributes

RCP< PartitioningSolution
< Adapter > > 
solution_
 
BaseAdapterType inputType_
 
modelFlag_t graphFlags_
 
modelFlag_t idFlags_
 
modelFlag_t coordFlags_
 
std::string algName_
 
int numberOfWeights_
 
ArrayRCP< ArrayRCP< part_t > > partIds_
 
ArrayRCP< ArrayRCP< scalar_t > > partSizes_
 
int numberOfCriteria_
 
ArrayRCP< int > levelNumberParts_
 
bool hierarchical_
 
- Protected Attributes inherited from Zoltan2::Problem< Adapter >
RCP< const Adapter > inputAdapter_
 
RCP< const base_adapter_tbaseInputAdapter_
 
RCP< Algorithm< Adapter > > algorithm_
 
RCP< ParameterList > params_
 
RCP< const Comm< int > > comm_
 
RCP< Environmentenv_
 
RCP< const EnvironmentenvConst_
 
RCP< TimerManagertimer_
 

Additional Inherited Members

- Protected Types inherited from Zoltan2::Problem< Adapter >
typedef Adapter::base_adapter_t base_adapter_t
 

Detailed Description

template<typename Adapter>
class Zoltan2::PartitioningProblem< Adapter >

PartitioningProblem sets up partitioning problems for the user.

The PartitioningProblem is the core of the Zoltan2 partitioning API. Based on the the user's input and parameters, the PartitioningProblem sets up a computational Model, and a Solution object. When the user calls the solve() method, the PartitioningProblem runs the algorithm, after which the Solution object may be obtained by the user.

Todo:

include pointers to examples

repartition given an initial solution

follow partitioning with global or local ordering

allow unsetting of part sizes by passing in null pointers

add a parameter by which user tells us there are no self edges to be removed.

- Should Problems and Solution have interfaces for returning views and for returning RCPs? Or just one? At a minimum, we should have the word "View" in function names that return views.

The template parameter is the InputAdapter containing the data that is to be partitioned.

Todo:
hierarchical partitioning
Examples:
block.cpp, kokkosBlock.cpp, and rcb_C.cpp.

Definition at line 68 of file Zoltan2_PartitioningProblem.hpp.

Member Typedef Documentation

template<typename Adapter>
typedef Adapter::scalar_t Zoltan2::PartitioningProblem< Adapter >::scalar_t

Definition at line 72 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
typedef Adapter::gno_t Zoltan2::PartitioningProblem< Adapter >::gno_t

Definition at line 73 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
typedef Adapter::lno_t Zoltan2::PartitioningProblem< Adapter >::lno_t

Definition at line 74 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
typedef Adapter::part_t Zoltan2::PartitioningProblem< Adapter >::part_t

Definition at line 75 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
typedef Adapter::user_t Zoltan2::PartitioningProblem< Adapter >::user_t

Definition at line 76 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
typedef Adapter::base_adapter_t Zoltan2::PartitioningProblem< Adapter >::base_adapter_t

Definition at line 77 of file Zoltan2_PartitioningProblem.hpp.

Constructor & Destructor Documentation

template<typename Adapter>
Zoltan2::PartitioningProblem< Adapter >::PartitioningProblem ( Adapter *  A,
ParameterList *  p,
const RCP< const Teuchos::Comm< int > > &  comm 
)
inline

Constructor where Teuchos communicator is specified.

Definition at line 80 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
Zoltan2::PartitioningProblem< Adapter >::PartitioningProblem ( Adapter *  A,
ParameterList *  p 
)
inline

Constructor where communicator is the Teuchos default.

Definition at line 103 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
Zoltan2::PartitioningProblem< Adapter >::~PartitioningProblem ( )
inline

Destructor.

Definition at line 109 of file Zoltan2_PartitioningProblem.hpp.

Member Function Documentation

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::solve ( bool  updateInputData = true)
virtual

Direct the problem to create a solution.

Implements Zoltan2::ProblemRoot.

Definition at line 578 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
const PartitioningSolution<Adapter>& Zoltan2::PartitioningProblem< Adapter >::getSolution ( )
inline

Get the solution to the problem.

Definition at line 134 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
void Zoltan2::PartitioningProblem< Adapter >::setPartSizes ( int  len,
part_t partIds,
scalar_t partSizes,
bool  makeCopy = true 
)
inline

Set or reset relative sizes for the parts that Zoltan2 will create.

Parameters
lenThe size of the partIds and partSizes lists
partIdsA list of len part identifiers. Part identifiers range from zero to one less than the global number of identifiers.
partSizesA list of len relative sizes corresponding to the partIds.
makeCopyIf true, Zoltan2 will make a copy of the ids and sizes that are provided in this call. If false, Zoltan2 will just save the pointers to to the caller's lists. If the pointers will remain remain valid throughout the lifetime of the PartitioningProblem, and memory use is an issue, then set makeCopy to false. By default, Zoltan2 will copy the caller's list of ids and sizes.

A given partid should be provided only once across all ranks. Duplicate partIds will generate a std::runtime_error exception when the PartitioningSolution is created. Part ids that are omitted will be assigned the average of the sizes that have been specified.

Subsequent calls to setPartSizes will replace the list of part ids and part sizes provided previously.

If the application has set multiple weights per object, then the part sizes supplied in this method are applied to the first weight.

Zoltan2 assumes that uniform part sizes are desired by the caller, unless specified otherwise in a call to setPartSizes or setPartSizesForCriteria.

Todo:
A user should be able to give us one set of part sizes that applies to all weight indices. Right now for each weight index that does not have uniform part sizes, the user has to give us the part sizes once for each.

Definition at line 176 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::setPartSizesForCriteria ( int  criteria,
int  len,
part_t partIds,
scalar_t partSizes,
bool  makeCopy = true 
)

Set or reset the relative sizes (per weight) for the parts that Zoltan2 will create.

Parameters
criteriathe criteria for which these part sizes apply. Criteria range from zero to one less than the number of weights per object specified in the caller's InputAdapter.
lenThe size of the partIds and partSizes lists
partIdsA list of len part identifiers. Part identifiers range from zero to one less than the global number of identifiers.
partSizesA list of len relative sizes corresponding to the partIds.
makeCopyIf true, Zoltan2 will make a copy of the ids and sizes that are provided in this call. If false, Zoltan2 will just save the pointers to to the caller's lists. If the pointers will remain remain valid throughout the lifetime of the PartitioningProblem, and memory use is an issue, then set makeCopy to false. By default, Zoltan2 will copy the caller's list of ids and sizes.

A given partid should only be provided once across the application. Duplicate partIds will generate a std::runtime_error exception when the PartitioningSolution is created. Part ids that are omitted will be assigned the average of the sizes that have been specified.

Subsequent calls to setPartSizes for the same criteria will replace the list of part ids and part sizes provided for that criteria previously.

Zoltan2 assumes that uniform part sizes are desired by the caller, unless specified otherwise in a call to setPartSizes or setPartSizesForCriteria.

Definition at line 450 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
static void Zoltan2::PartitioningProblem< Adapter >::getValidParameters ( ParameterList &  pl)
inlinestatic

Set up validators specific to this Problem.

Definition at line 224 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::initializeProblem ( )
protected

Definition at line 394 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::processAlgorithmName ( const std::string &  algorithm,
const std::string &  defString,
const std::string &  model,
Environment env,
bool &  removeSelfEdges,
bool &  isGraphType,
bool &  needConsecutiveGlobalIds 
)
protectedvirtual

Reimplemented in Zoltan2::SphynxProblem< Adapter >.

Definition at line 679 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::createPartitioningProblem ( bool  newData)
protected

Definition at line 784 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
void Zoltan2::PartitioningProblem< Adapter >::createAlgorithm ( )
protectedvirtual

Reimplemented in Zoltan2::SphynxProblem< Adapter >.

Definition at line 494 of file Zoltan2_PartitioningProblem.hpp.

Member Data Documentation

template<typename Adapter>
RCP<PartitioningSolution<Adapter> > Zoltan2::PartitioningProblem< Adapter >::solution_
protected

Definition at line 351 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
BaseAdapterType Zoltan2::PartitioningProblem< Adapter >::inputType_
protected

Definition at line 356 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
modelFlag_t Zoltan2::PartitioningProblem< Adapter >::graphFlags_
protected

Definition at line 358 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
modelFlag_t Zoltan2::PartitioningProblem< Adapter >::idFlags_
protected

Definition at line 359 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
modelFlag_t Zoltan2::PartitioningProblem< Adapter >::coordFlags_
protected

Definition at line 360 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
std::string Zoltan2::PartitioningProblem< Adapter >::algName_
protected

Definition at line 361 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
int Zoltan2::PartitioningProblem< Adapter >::numberOfWeights_
protected

Definition at line 363 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
ArrayRCP<ArrayRCP<part_t> > Zoltan2::PartitioningProblem< Adapter >::partIds_
protected

Definition at line 374 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
ArrayRCP<ArrayRCP<scalar_t> > Zoltan2::PartitioningProblem< Adapter >::partSizes_
protected

Definition at line 375 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
int Zoltan2::PartitioningProblem< Adapter >::numberOfCriteria_
protected

Definition at line 376 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
ArrayRCP<int> Zoltan2::PartitioningProblem< Adapter >::levelNumberParts_
protected

Definition at line 380 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
bool Zoltan2::PartitioningProblem< Adapter >::hierarchical_
protected

Definition at line 381 of file Zoltan2_PartitioningProblem.hpp.


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