SG++-Doxygen-Documentation

The methods in this class calculate size and offset of a segment for a partition of a domain. More...

#include <PartitioningTool.hpp>

## Public Member Functions

PartitioningTool ()

## Static Public Member Functions

static void calcAlmostBlockedDistribution (size_t totalSize, size_t numChunksPerProc, int *sizes, int *offsets, size_t blocksize)

static void calcDistribution (size_t totalSize, size_t numChunks, int *sizes, int *offsets, size_t blocksize=1)
calcDistribution calculates a distribution of a domain of size totalSize into numCunks chunks and fills the two arrays sizes and offsets with the respective offsets and sizes (both arrays have to be already allocated and must be of size numChunks). More...

static void getOpenMPPartitionSegment (size_t totalSize, size_t *size, size_t *offset, size_t blocksize=1)
getOpenMPLoopPartitionSegment uses the number of OpenMP Threads and the threads id for segmentCount and segmentNumber More...

static void getOpenMPPartitionSegment (size_t start, size_t end, size_t *segmentStart, size_t *segmentEnd, size_t blocksize=1)

static void getPartitionSegment (size_t totalSize, size_t segmentCount, size_t segmentNumber, size_t *size, size_t *offset, size_t blocksize=1)

static void getPartitionSegment (size_t start, size_t end, size_t segmentCount, size_t segmentNumber, size_t *segmentStart, size_t *segmentEnd, size_t blocksize=1)

## Detailed Description

The methods in this class calculate size and offset of a segment for a partition of a domain.

The domain can be either specified by its size (totalSize) or by start (including) and end (excluding) indexes. Then, the number of resulting segments (segmentCount) and the number of the desired segment (segmentNumber) have to be passed. The results are stored into size and offset. The last (and optional) parameter blocksize specifies how the segments should be aligned to blocks. The complete size must be evenly divisible by the blocksize.

Segments are distributed as equally as possible (the difference between the minimum and maximum number of items is at most blocksize). When just dividing (integer division) and leaving the rest to the last segment, this segment could have twice as much to do as all the others (example: totalSize=127, segmentCount = 16, blockSize = 1)

Parameters
 totalSize size of domain that's to be partitioned start start of domain that's to be partitioned, including end end of domain that's to be partitioned, excluding segmentCount number of segments to partition the domain into segmentNumber specifies the number of the fragment for which to calculate size and offset size output variable to put resulting size into offset output variable to put resulting offset into

## Member Function Documentation

 static void sgpp::datadriven::PartitioningTool::calcAlmostBlockedDistribution ( size_t totalSize, size_t numChunksPerProc, int * sizes, int * offsets, size_t blocksize )
static
 void sgpp::datadriven::PartitioningTool::calcDistribution ( size_t totalSize, size_t numChunks, int * sizes, int * offsets, size_t blocksize = 1 )
static

calcDistribution calculates a distribution of a domain of size totalSize into numCunks chunks and fills the two arrays sizes and offsets with the respective offsets and sizes (both arrays have to be already allocated and must be of size numChunks).

When blocksize greater than 1, then the resulting sizes are a multiple of this blocksize.

Example:

|. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .| calcDistribution(50, 3, sizes, offsets, 5) -> |. . . . .-. . . . .-. . . . .-. . . . .|. . . . .-. . . . .-. . . . .|. . . . .-. . . . .-. . . . .|

sizes: [20,15,15] offsets: [0,20,35]

Parameters
 totalSize size of domain to distribute numChunks sizes output array to store resulting distribution sizes (array size must be numChunks) offsets output array to store resulting distribution offsets (array size must be numChunks) blocksize resulting sizes are a multiple of this blocksize.

References getPartitionSegment().

 void sgpp::datadriven::PartitioningTool::getOpenMPPartitionSegment ( size_t totalSize, size_t * size, size_t * offset, size_t blocksize = 1 )
static

getOpenMPLoopPartitionSegment uses the number of OpenMP Threads and the threads id for segmentCount and segmentNumber

Call this function inside a parallel openmp region. Can also be called if only one Thread is active or even if OpenMP is disabled, then the result is one single partition.

 void sgpp::datadriven::PartitioningTool::getOpenMPPartitionSegment ( size_t start, size_t end, size_t * segmentStart, size_t * segmentEnd, size_t blocksize = 1 )
static

References getPartitionSegment().

 void sgpp::datadriven::PartitioningTool::getPartitionSegment ( size_t totalSize, size_t segmentCount, size_t segmentNumber, size_t * size, size_t * offset, size_t blocksize = 1 )
static
 void sgpp::datadriven::PartitioningTool::getPartitionSegment ( size_t start, size_t end, size_t segmentCount, size_t segmentNumber, size_t * segmentStart, size_t * segmentEnd, size_t blocksize = 1 )
static

References python.leja::start.

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