Zoltan2
Public Types | Public Member Functions | Protected Attributes
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]

List of all members.

Public Types

typedef Adapter::scalar_t scalar_t
typedef Adapter::zgid_t zgid_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)
 Constructor where communicator is the Teuchos default.
 PartitioningProblem (Adapter *A, ParameterList *p, RCP< const Teuchos::Comm< int > > &comm)
 Constructor where Teuchos communicator is specified.
 ~PartitioningProblem ()
 Destructor.
void solve (bool updateInputData=true)
 Direct the problem to create a solution.
part_t pointAssign (int dim, scalar_t *point)
 Return the part overlapping a given point in space;.
void boxAssign (int dim, scalar_t *lower, scalar_t *upper, size_t &nPartsFound, part_t **partsFound)
 Return an array of all parts overlapping a given box in space.
const PartitioningSolution
< Adapter > & 
getSolution ()
 Get the solution to the problem.
const scalar_t getWeightImbalance (int idx=0) const
 Returns the imbalance of the solution.
ArrayRCP< const MetricValues
< scalar_t > > 
getMetrics () const
 Get the array of metrics Metrics were only computed if user requested metrics with a parameter.
void printMetrics (std::ostream &os) const
 Print the array of metrics.
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.
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.
void resetParameters (ParameterList *params)
 Reset the list of parameters.
const RCP< const Environment > & getEnvironment () const
 Get the current Environment. Useful for testing.
RCP< const Comm< int > > getComm ()
 Return the communicator used by the problem.
void printTimers () const
 Return the communicator passed to the problem.

Protected Attributes

Adapter * inputAdapter_
base_adapter_tbaseInputAdapter_
RCP< GraphModel< base_adapter_t > > graphModel_
RCP< IdentifierModel
< base_adapter_t > > 
identifierModel_
RCP< CoordinateModel
< base_adapter_t > > 
coordinateModel_
RCP< const Model
< base_adapter_t > > 
baseModel_
RCP< Algorithm< Adapter > > algorithm_
RCP< ParameterList > params_
RCP< const Comm< int > > comm_
RCP< Environmentenv_
RCP< const EnvironmentenvConst_

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, and rcb_C.cpp.

Definition at line 95 of file Zoltan2_PartitioningProblem.hpp.


Member Typedef Documentation

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

Definition at line 99 of file Zoltan2_PartitioningProblem.hpp.

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

Definition at line 100 of file Zoltan2_PartitioningProblem.hpp.

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

Definition at line 101 of file Zoltan2_PartitioningProblem.hpp.

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

Definition at line 102 of file Zoltan2_PartitioningProblem.hpp.

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

Definition at line 103 of file Zoltan2_PartitioningProblem.hpp.

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

Definition at line 104 of file Zoltan2_PartitioningProblem.hpp.

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

Reimplemented from Zoltan2::Problem< Adapter >.

Definition at line 105 of file Zoltan2_PartitioningProblem.hpp.


Constructor & Destructor Documentation

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

Constructor where communicator is the Teuchos default.

Definition at line 126 of file Zoltan2_PartitioningProblem.hpp.

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

Constructor where Teuchos communicator is specified.

Definition at line 141 of file Zoltan2_PartitioningProblem.hpp.

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

Destructor.

Definition at line 158 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::Problem< Adapter >.

Definition at line 550 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
Adapter::part_t Zoltan2::Zoltan2_AlgMJ< Adapter >::pointAssign ( int  dim,
scalar_t point 
) [inline]

Return the part overlapping a given point in space;.

Definition at line 192 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
void Zoltan2::PartitioningProblem< Adapter >::boxAssign ( int  dim,
scalar_t lower,
scalar_t upper,
size_t &  nPartsFound,
part_t **  partsFound 
) [inline]

Return an array of all parts overlapping a given box in space.

Definition at line 220 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 236 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
const scalar_t Zoltan2::PartitioningProblem< Adapter >::getWeightImbalance ( int  idx = 0) const [inline]

Returns the imbalance of the solution.

Parameters:
idxIf there are multiple weights per object, specify the index for which the imbalance is desired, ranging from zero to one less then number of weights per object. Imbalance was only computed if user requested metrics with a parameter.

Definition at line 248 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
ArrayRCP<const MetricValues<scalar_t> > Zoltan2::PartitioningProblem< Adapter >::getMetrics ( ) const [inline]

Get the array of metrics Metrics were only computed if user requested metrics with a parameter.

Definition at line 260 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
void Zoltan2::PartitioningProblem< Adapter >::printMetrics ( std::ostream &  os) const [inline]

Print the array of metrics.

Parameters:
osthe output stream for the report. Metrics were only computed if user requested metrics with a parameter.

Definition at line 274 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 319 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 506 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
void Zoltan2::PartitioningProblem< Adapter >::resetParameters ( ParameterList *  params) [inline]

Reset the list of parameters.

Reimplemented from Zoltan2::Problem< Adapter >.

Definition at line 366 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter>
const RCP<const Environment>& Zoltan2::PartitioningProblem< Adapter >::getEnvironment ( ) const [inline]

Get the current Environment. Useful for testing.

Definition at line 377 of file Zoltan2_PartitioningProblem.hpp.

template<typename Adapter >
RCP<const Comm<int> > Zoltan2::Problem< Adapter >::getComm ( ) [inline, inherited]

Return the communicator used by the problem.

Definition at line 120 of file Zoltan2_Problem.hpp.

template<typename Adapter >
void Zoltan2::Problem< Adapter >::printTimers ( ) const [inline, inherited]

Return the communicator passed to the problem.

If timer data was collected, print out global data.

If the parameter "timer_output_stream" or "timer_output_file" was set, then timing statistics are available and will be printed out to the requested output stream with this call.

All processes in the application must call this, even if they were not all in the problem communicator. All timers are reset back to zero after this call.

Timer starts, stops and displays are ignored if Zoltan2 is compiled with Z2_OMIT_ALL_ERROR_CHECKING.

Definition at line 149 of file Zoltan2_Problem.hpp.


Member Data Documentation

template<typename Adapter >
Adapter* Zoltan2::Problem< Adapter >::inputAdapter_ [protected, inherited]

Definition at line 167 of file Zoltan2_Problem.hpp.

template<typename Adapter >
base_adapter_t* Zoltan2::Problem< Adapter >::baseInputAdapter_ [protected, inherited]

Definition at line 168 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<GraphModel<base_adapter_t> > Zoltan2::Problem< Adapter >::graphModel_ [protected, inherited]

Definition at line 170 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<IdentifierModel<base_adapter_t> > Zoltan2::Problem< Adapter >::identifierModel_ [protected, inherited]

Definition at line 171 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<CoordinateModel<base_adapter_t> > Zoltan2::Problem< Adapter >::coordinateModel_ [protected, inherited]

Definition at line 172 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<const Model<base_adapter_t> > Zoltan2::Problem< Adapter >::baseModel_ [protected, inherited]

Definition at line 178 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<Algorithm<Adapter> > Zoltan2::Problem< Adapter >::algorithm_ [protected, inherited]

Definition at line 181 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<ParameterList> Zoltan2::Problem< Adapter >::params_ [protected, inherited]

Definition at line 183 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<const Comm<int> > Zoltan2::Problem< Adapter >::comm_ [protected, inherited]

Definition at line 184 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<Environment> Zoltan2::Problem< Adapter >::env_ [protected, inherited]

Definition at line 190 of file Zoltan2_Problem.hpp.

template<typename Adapter >
RCP<const Environment> Zoltan2::Problem< Adapter >::envConst_ [protected, inherited]

Definition at line 195 of file Zoltan2_Problem.hpp.


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