Static class which contains various load balancing routines.
More...
#include <CD_LoadBalancing.H>
|
| template<class T > |
| static void | makeBalance (Vector< int > &a_ranks, const Vector< T > &a_loads, const Vector< Box > &a_boxes) |
| | Load balancing, assigning ranks to boxes.
|
| |
| template<class T > |
| static void | makeBalance (Vector< int > &a_ranks, Loads &a_rankLoads, const Vector< T > &a_boxLoads, const Vector< Box > &a_boxes) |
| | Load balancing, assigning ranks to boxes.
|
| |
| template<typename T > |
| static void | sort (Vector< Vector< Box > > &a_boxes, Vector< Vector< T > > &a_loads, const BoxSorting a_whichSorting) |
| | Sorts boxes and loads over a hierarchy according to some sorting criterion.
|
| |
| template<typename T > |
| static void | sort (Vector< Box > &a_boxes, Vector< T > &a_loads, const BoxSorting a_which) |
| | Sorting function for sorting boxes and loads.
|
| |
| static void | sort (Vector< Box > &a_boxes, const BoxSorting a_which) |
| | Sorts boxes (according to sorting argument)
|
| |
| static void | gatherBoxes (Vector< Box > &a_boxes) |
| | Gather boxes.
|
| |
| static void | gatherLoads (Vector< Real > &a_loads) |
| | Gather computational loads.
|
| |
| static void | gatherLoads (Vector< int > &a_loads) |
| | Gather compute loads.
|
| |
| static void | gatherLoads (Vector< long > &a_loads) |
| | Gather compute loads.
|
| |
| static void | gatherBoxesAndLoads (Vector< Box > &a_boxes, Vector< int > &a_loads) |
| | Gather boxes and loads.
|
| |
| template<int DIM> |
| static uint64_t | mortonIndex (const std::array< uint32_t, DIM > &a_coords) noexcept |
| | Compute a Morton (Z-order) code from integer coordinates, using 21 bits per direction.
|
| |
| template<int DIM> |
| static uint64_t | hilbertIndex (const std::array< uint32_t, DIM > &a_coords) |
| | Compute a Hilbert-curve index from integer coordinates, using 21 bits per direction.
|
| |
|
| template<class T > |
| static std::vector< std::pair< Box, T > > | packPairs (const Vector< Box > &a_boxes, const Vector< T > &a_loads) |
| | Utility function which packs boxes and loads into a vector of pairs.
|
| |
| template<class T > |
| static void | unpackPairs (Vector< Box > &a_boxes, Vector< T > &a_loads, const std::vector< std::pair< Box, T > > &a_pairs) |
| | Splits vector pair into separate boxes and loads.
|
| |
| template<class T > |
| static void | standardSort (Vector< Box > &a_boxes, Vector< T > &a_loads) |
| | Standard box sorting, calls C++ std::sort.
|
| |
| template<class T > |
| static void | shuffleSort (Vector< Box > &a_boxes, Vector< T > &a_loads) |
| | Randomly shuffles boxes and loads.
|
| |
| template<class T , int DIM> |
| static void | sortSFC (Vector< Box > &a_boxes, Vector< T > &a_loads, const std::function< uint64_t(const std::array< uint32_t, DIM >)> &a_sfcEncoder) noexcept |
| | Generic SFC sorting function.
|
| |
Static class which contains various load balancing routines.
◆ gatherBoxes()
| void LoadBalancing::gatherBoxes |
( |
Vector< Box > & |
a_boxes | ) |
|
|
static |
Gather boxes.
- Parameters
-
| [in,out] | a_boxes | Local boxes |
◆ gatherBoxesAndLoads()
| void LoadBalancing::gatherBoxesAndLoads |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< int > & |
a_loads |
|
) |
| |
|
static |
Gather boxes and loads.
- Parameters
-
| [in,out] | a_boxes | Grid boxes |
| [in,out] | a_loads | Computational loads |
◆ gatherLoads() [1/3]
| void LoadBalancing::gatherLoads |
( |
Vector< int > & |
a_loads | ) |
|
|
static |
Gather compute loads.
- Parameters
-
| [in,out] | a_loads | Computational loads |
◆ gatherLoads() [2/3]
| void LoadBalancing::gatherLoads |
( |
Vector< long > & |
a_loads | ) |
|
|
static |
Gather compute loads.
- Parameters
-
| [in,out] | a_loads | Computational loads |
◆ gatherLoads() [3/3]
| void LoadBalancing::gatherLoads |
( |
Vector< Real > & |
a_loads | ) |
|
|
static |
Gather computational loads.
- Parameters
-
| [in,out] | a_loads | Computational loads |
◆ hilbertIndex()
template<int DIM>
| uint64_t LoadBalancing::hilbertIndex |
( |
const std::array< uint32_t, DIM > & |
a_coords | ) |
|
|
static |
Compute a Hilbert-curve index from integer coordinates, using 21 bits per direction.
- Parameters
-
| [in] | a_coords | Integer coordinates (each < 2^21). |
- Returns
- The Hilbert index.
◆ makeBalance() [1/2]
template<class T >
| void LoadBalancing::makeBalance |
( |
Vector< int > & |
a_ranks, |
|
|
const Vector< T > & |
a_loads, |
|
|
const Vector< Box > & |
a_boxes |
|
) |
| |
|
static |
Load balancing, assigning ranks to boxes.
This version does not take into loads already assigned to ranks and will thus always start assigning from rank 0.
- Parameters
-
| [out] | a_ranks | Vector containing processor IDs corresponding to boxes (and loads) |
| [in] | a_loads | Computational loads |
| [in] | a_boxes | Grid boxes |
◆ makeBalance() [2/2]
template<class T >
| void LoadBalancing::makeBalance |
( |
Vector< int > & |
a_ranks, |
|
|
Loads & |
a_rankLoads, |
|
|
const Vector< T > & |
a_boxLoads, |
|
|
const Vector< Box > & |
a_boxes |
|
) |
| |
|
static |
Load balancing, assigning ranks to boxes.
This version takes into account loads already assigned to ranks, and assigns grid subsets to the least loaded ranks.
- Parameters
-
| [out] | a_ranks | Vector containing processor IDs corresponding to boxes (and loads) |
| [in,out] | a_rankLoads | MPI rank loads so far |
| [in] | a_boxLoads | Computational loads for each box |
| [in] | a_boxes | Grid boxes |
◆ mortonIndex()
template<int DIM>
| uint64_t LoadBalancing::mortonIndex |
( |
const std::array< uint32_t, DIM > & |
a_coords | ) |
|
|
staticnoexcept |
Compute a Morton (Z-order) code from integer coordinates, using 21 bits per direction.
- Parameters
-
| [in] | a_coords | Integer coordinates (each < 2^21). |
- Returns
- The interleaved Morton index.
◆ packPairs()
template<class T >
| std::vector< std::pair< Box, T > > LoadBalancing::packPairs |
( |
const Vector< Box > & |
a_boxes, |
|
|
const Vector< T > & |
a_loads |
|
) |
| |
|
staticprotected |
Utility function which packs boxes and loads into a vector of pairs.
- Parameters
-
| [in] | a_boxes | Grid boxes |
| [in] | a_loads | Computational loads |
- Returns
- Return value
◆ shuffleSort()
template<class T >
| void LoadBalancing::shuffleSort |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< T > & |
a_loads |
|
) |
| |
|
staticprotected |
Randomly shuffles boxes and loads.
- Parameters
-
| [in,out] | a_boxes | Grid boxes to be shuffled. |
| [in,out] | a_loads | Computational loads to be shuffled. |
This shuffles the boxes and loads so that the box distribution is random.
◆ sort() [1/3]
| void LoadBalancing::sort |
( |
Vector< Box > & |
a_boxes, |
|
|
const BoxSorting |
a_which |
|
) |
| |
|
static |
Sorts boxes (according to sorting argument)
- Parameters
-
| [in,out] | a_boxes | Grid boxes |
| [in] | a_which | Description |
◆ sort() [2/3]
template<typename T >
| void LoadBalancing::sort |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< T > & |
a_loads, |
|
|
const BoxSorting |
a_which |
|
) |
| |
|
static |
Sorting function for sorting boxes and loads.
- Parameters
-
| [in,out] | a_boxes | Grid boxes |
| [in,out] | a_loads | Computational loads |
| [in] | a_which | Which |
◆ sort() [3/3]
template<typename T >
| void LoadBalancing::sort |
( |
Vector< Vector< Box > > & |
a_boxes, |
|
|
Vector< Vector< T > > & |
a_loads, |
|
|
const BoxSorting |
a_whichSorting |
|
) |
| |
|
static |
Sorts boxes and loads over a hierarchy according to some sorting criterion.
- Parameters
-
| [in,out] | a_boxes | Grid boxes |
| [in,out] | a_loads | Computational loads |
| [in] | a_whichSorting | |
◆ sortSFC()
template<class T , int DIM>
| void LoadBalancing::sortSFC |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< T > & |
a_loads, |
|
|
const std::function< uint64_t(const std::array< uint32_t, DIM >)> & |
a_sfcEncoder |
|
) |
| |
|
staticprotectednoexcept |
Generic SFC sorting function.
- Parameters
-
| [in,out] | a_boxes | Grid boxes to be sorted |
| [in,out] | a_loads | Computational loads to be sorted along with the boxes. |
| [in] | a_sfcEncoder | Function for turning a grid index into an SFC index. |
◆ standardSort()
template<class T >
| void LoadBalancing::standardSort |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< T > & |
a_loads |
|
) |
| |
|
staticprotected |
Standard box sorting, calls C++ std::sort.
- Parameters
-
| [in,out] | a_boxes | Boxes to be sorted. |
| [in,out] | a_loads | Loads to be sorted. |
This uses lexicographical indexing of boxes. On output, the boxes/loads are sorted with this ordering.
◆ unpackPairs()
template<class T >
| void LoadBalancing::unpackPairs |
( |
Vector< Box > & |
a_boxes, |
|
|
Vector< T > & |
a_loads, |
|
|
const std::vector< std::pair< Box, T > > & |
a_pairs |
|
) |
| |
|
staticprotected |
Splits vector pair into separate boxes and loads.
- Parameters
-
| [out] | a_boxes | Boxes. |
| [out] | a_loads | Loads. |
| [out] | a_pairs | Boxes and loads, stored as a pair. |
The documentation for this class was generated from the following files: