Refine a Cut (RaC)¶
Defined in algorithms/refine_a_cut.hpp
-
namespace
sarma
::
refine_a_cut
¶ Enums
Functions
-
template<typename
Ordinal
, typenameValue
>
autorefinement
(const Matrix<Ordinal, Value> &A, std::vector<Value> &prefix, const std::vector<Ordinal> &prev_cuts)¶ Implements a simplified refinement technique inspired from Nicol’s refinement precedure. Here instead of running simultaneous binary searches over prefix sum arrays of each interval we first compute the maximum of the each interval than apply an optimal one-dimensional partitioning.
- Return
a cut vector
- Parameters
A
: a matrixprefix
: prefix sum arrayprev_cuts
: cuts of the previous iteration
- Template Parameters
Ordinal
: data-type of indptr and indices structures in sarma::MatrixValue
: data-type of data structure in sarma::Matrix
-
template<typename
Ordinal
, typenameValue
>
autonic_refinement
(const Matrix<Ordinal, Value> &A, std::vector<std::vector<Value>> &prefixes, const std::vector<Ordinal> &prev_cuts)¶ Implements Nicol’s refinement precedure. This procedure runs simultaneous binary searches over prefix sum arrays of each interval.
- Return
a cut vector
- Parameters
A
: a matrixprefix
: prefix sum arrayprev_cuts
: cuts of the previous iteration
- Template Parameters
Ordinal
: data-type of indptr and indices structures in sarma::MatrixValue
: data-type of data structure in sarma::Matrix
-
template<class
Ordinal
, classValue
>
autopartition
(const Matrix<Ordinal, Value> &A, const std::vector<Ordinal> &p, bool pdf = true, int max_iteration = 0, bool nic_ref = false)¶ Implements the Refine a Cut algorithm. Applies row and column based mapping to map 2D into 1D chooses the direction that gives better load imbalance.
- Return
a cut vector
- Parameters
A
: Matrixp
: starting cut vector after choosing the directionpdf
: pick direction first if it is true.max_iteration
: limit on refinement iterations
- Template Parameters
Ordinal
: data-type of indptr and indices structures in sarma::MatrixValue
: data-type of data structure in sarma::Matrix
-
template<typename
Ordinal
, typenameValue
>
autobal
(const Matrix<Ordinal, Value> &A, const Value Z)¶ Implements Bound a Load (BaL) algorithm using RaC as the mLI algorithm.
- Return
a cut vector
- Parameters
A
: MatrixZ
: Target load
- Template Parameters
Ordinal
: data-type of indptr and indices structures in sarma::MatrixValue
: data-type of data structure in sarma::Matrix
-
template<class
Ordinal
, classValue
>
std::vector<Ordinal>partition
(const Matrix<Ordinal, Value> &A, const Ordinal P, const Value Z = 0, bool pdf = true, int max_iteration = 0, bool nic_ref = false)¶ Implements the Refine a Cut (RaC) algorithm. Applies row and column based mapping to map 2D into 1D chooses the direction that gives better load imbalance. Note that if Z is greater than zero then this function overrides P and calls the dual of the uniform partitioning that solves MNc problem. If pdf is false then in each iteration this algorithm applies row-wise and column-wise refinement and picks the best cuts for the next iteration.
- Return
a cut vector
- Parameters
A
: MatrixP
: number of cutsZ
: target loadpdf
: pick direction first if it is true.max_iteration
: limit on refinement iterations
- Template Parameters
Ordinal
: data-type of indptr and indices structures in sarma::MatrixValue
: data-type of data structure in sarma::Matrix
-
template<typename