Proto
3.2
|
#include <Proto_BoxPartition.H>
Public Member Functions | |
BoxPartition (const ProblemDomain &a_patchDomain) | |
BoxPartition (const ProblemDomain &a_patchDomain, const std::vector< Point > &a_patches) | |
Constructor. More... | |
BoxPartition (const ProblemDomain &a_patchDomain, const std::vector< Point > &a_patches, unsigned int a_startProc, unsigned int a_endProc) | |
Constructor. More... | |
BoxPartition (const ProblemDomain &a_patchDomain, const std::vector< std::pair< Point, unsigned int >> &a_assignedPatches) | |
Constructor (Exteral Load Balancing) More... | |
void | define (const ProblemDomain &a_patchDomain, const std::vector< Point > &a_patches, unsigned int a_startProc, unsigned int a_endProc) |
Define. More... | |
void | define (const ProblemDomain &a_patchDomain, const std::vector< std::pair< Point, unsigned int >> &a_assignedPatches) |
Define. More... | |
std::shared_ptr< BoxPartition > | sortByProc () const |
Sort By Processor. More... | |
bool | isSorted () const |
void | loadBalance (std::vector< Point > &a_patches, unsigned int a_startProc, unsigned int a_endProc) |
Load Balance. More... | |
template<typename... vals> | |
void | loadAssign (std::vector< Point > &a_patches, vals... args) |
Load Assign. More... | |
void | loadAssign (std::vector< std::pair< int, unsigned int >> &a_assignment, std::vector< Point > &a_patches) |
Load Assign. More... | |
void | loadAssign (std::vector< std::pair< int, unsigned int >> &a_assignment) |
Load Assign. More... | |
bool | compatible (const BoxPartition &a_rhs) |
Compatibility Query. More... | |
unsigned int | numProcs () const |
Number of Processes. More... | |
unsigned int | numBoxes () const |
Number of Boxes (Global) More... | |
unsigned int | numBoxes (unsigned int a_proc) const |
Number of Boxes (Local) More... | |
const std::vector< std::pair< Point, unsigned int > > & | partition () const |
Access Partition. More... | |
unsigned int | procStartIndex (unsigned int a_proc) const |
Get Processor Starting Index. More... | |
unsigned int | procEndIndex (unsigned int a_proc) const |
Get Processor Ending Index. More... | |
unsigned int | globalIndex (unsigned int a_localIndex, unsigned int a_proc) |
Get Global Index. More... | |
unsigned int | localIndex (unsigned int a_globalIndex, unsigned int a_proc) |
Get Local Index. More... | |
unsigned int | find (Point a_pt) |
Get Patch Index. More... | |
const ProblemDomain & | domain () const |
void | print () const |
Print. More... | |
bool | doLoadBalance () const |
Check If This Controls Load Balancing. More... | |
template<> | |
void | unpack (std::vector< Point > &a_patches, unsigned int a_globalIndex, int a_proc, unsigned int a_num) |
Private Member Functions | |
bool | checkProcSorting (const std::vector< std::pair< Point, unsigned int >> a_data) |
template<typename... vals> | |
void | unpack (std::vector< Point > &a_patches, unsigned int a_globalIndex, int a_proc, unsigned int a_num, vals... a_args) |
void | assign (std::vector< Point > &a_patches, unsigned int a_globalIndex, int a_proc, unsigned int a_num) |
Private Attributes | |
bool | m_procSorted = true |
bool | m_doLoadBalance = true |
ProblemDomain | m_patchDomain |
Domain in patch space. More... | |
std::unordered_map< uint64_t, int > | m_indexMap |
Maps Morton index to global index. More... | |
std::unordered_map< unsigned int, std::pair< unsigned int, unsigned int > > | m_procMap |
Maps processor number to global index. More... | |
std::vector< std::pair< Point, unsigned int > > | m_partition |
Maps each patch to a proc. More... | |
std::unordered_map< unsigned int, std::vector< unsigned int > > | m_procMapUnsorted |
Same as procMap for unsorted data. More... | |
Box Partition.
This data structure defines the "layoutness" of a collection of patches. More concretely, Box Partition encapsulates the information of which tile locations in a domain have a patch, which tiles are empty, and which MPI processes are responsible for which patch.
Two objects with the same (or equivalent) Box Partitions are "compatible" with one another in the sense of DataIterator because the two objects in question are guaranteed to have the same number of patches for a given MPI process.
|
inline |
Referenced by BoxPartition().
|
inline |
Constructor.
Create a BoxPartition from a "patch domain" and an array of patches in that domain. Here patches are assumed to have a uniform size so as to evenly tile a rectangular layout. By default, patches will be distributed evenly across all available processes.
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_patches | A vector of Point each representing a patch |
|
inline |
Constructor.
Create a BoxPartition from a "patch domain" and an array of patches in that domain. Here patches are assumed to have a uniform size so as to evenly tile a rectangular layout. Patches will be distributed evenly across the range of processes in [a_startProc, a_endProc)
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_patches | A vector of Point each representing a patch |
References BoxPartition().
|
inline |
Constructor (Exteral Load Balancing)
|
inline |
Define.
Create a BoxPartition from a "patch domain" and an array of patches in that domain. Here patches are assumed to have a uniform size so as to evenly tile a rectangular layout. Patches will be distributed evenly across the range of processes in [a_startProc, a_endProc)
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_patches | A vector of Point each representing a patch |
|
inline |
Define.
Create a BoxPartition from a set of patches that have already been assigned to processors. Use this function if load balancing is executed externally.
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_assignedPatches | A vector of patch-processor pairs |
|
inline |
Sort By Processor.
Return a new BoxPartition that is identical to *this except that it is sorted by processor
|
inline |
References loadBalance(), and m_procSorted.
|
inline |
Load Balance.
Rebalance the load of this by distributing the input patches evenly across the range of processes in [a_startProc, a_endProc)
The input patches must be contained in the existing ProblemDomain of this
a_patches | A vector of patches represented as Points |
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_patches | A vector of Point each representing a patch |
Referenced by isSorted().
|
inline |
Load Assign.
Manually assign the load of this using the syntax loadAssign(patches, P0, N0, P1, N1, ..., Pk, Nk)
where process Pi is assigned Ni boxes. The sum over all Ni should be equal to the length of the patch vector.
a_patches | A vector of patches represented as Points |
a_patchDomain | A ProblemDomain where each Point corresponds to a Box |
a_patches | A vector of Point each representing a patch |
|
inline |
Load Assign.
Manually assign the load of this layout. The first input is a vector of pair<int, unsigned int>
where the first entry of each pair is a process and the second is the number of boxes to be assigned to that process. The second input is the set of patches themselves represented as Points.
a_assignment | A vector of proc-assignment pairs |
a_patches | A vector of patches represented as Points |
|
inline |
Load Assign.
Manually (re)assign the load of this layout. The input is a vector of pair<int, unsigned int>
where the first entry of each pair is a process and the second is the number of boxes to be assigned to that process. The patches themselves are unchanged by this function.
a_assignment | A vector of proc-assignment pairs |
a_patches | A vector of patches represented as Points |
|
inline |
Compatibility Query.
Determine if this has the same layout structure as another BoxPartition.
|
inline |
Number of Processes.
Query the number of processes assigned to this BoxPartition
|
inline |
Number of Boxes (Global)
Query the number of patches in this BoxPartition across all processes
|
inline |
Number of Boxes (Local)
Query the number of patches in this BoxPartition on a specified process
|
inline |
Access Partition.
Access the vector of pair<Point, unsigned int> which maps each patch (represented as a Point) to a process number
References m_partition, and procStartIndex().
|
inline |
Get Processor Starting Index.
Get the index in global array at which a specified process's data begins. Returns this->size() if the processor is not assigned to this.
Referenced by partition().
|
inline |
Get Processor Ending Index.
Get the index in global array at which a specified process's data ends Returns this->size() if the processor is not assigned to this.
|
inline |
Get Global Index.
Get the global index from a local index and processor number. Works even if the data in this is unsorted.
|
inline |
Get Local Index.
Get the global index from a local index and processor number. Works even if the data in this is unsorted.
|
inline |
Get Patch Index.
Get the index in global array corresponding to a specified patch. Returns this->size() if the patch is not in this partition's domain.
|
inline |
References m_patchDomain.
|
inline |
Print.
|
inline |
Check If This Controls Load Balancing.
References assign(), checkProcSorting(), m_doLoadBalance, and unpack().
|
inlineprivate |
Referenced by doLoadBalance().
|
inlineprivate |
Referenced by doLoadBalance().
|
inlineprivate |
Referenced by doLoadBalance().
|
inline |
|
private |
Referenced by isSorted().
|
private |
Referenced by doLoadBalance().
|
private |
Domain in patch space.
Referenced by domain().
|
private |
Maps Morton index to global index.
|
private |
Maps processor number to global index.
|
private |
Maps each patch to a proc.
Referenced by partition().
|
private |
Same as procMap for unsorted data.