Class CombiParameters

Class Documentation

class CombiParameters

Class for the parameters of the combination technique.

This class contains all the parameters that describe a combination technique setup. The class is serializable and can be sent over MPI. It is used, for instance, by ProcessManager to distribute the combination technique information to the ProcessGroupWorkers.

Public Functions

CombiParameters() = default

default constructor for serialization

inline CombiParameters(DimType dim, const LevelVector &lmin, const LevelVector &lmax, const std::vector<BoundaryType> &boundary, const std::vector<LevelVector> &levels, const std::vector<real> &coeffs, const std::vector<size_t> &taskIDs, size_t numberOfCombinations, IndexType numGrids = 1, CombinationVariant combinationVariant = CombinationVariant::sparseGridReduce, const std::vector<int> &parallelization = {0}, const LevelVector &reduceCombinationDimsLmin = LevelVector(0), const LevelVector &reduceCombinationDimsLmax = LevelVector(0), uint32_t sizeForChunkedCommunicationInMebibyte = 64, bool forwardDecomposition = false, const std::string &thirdLevelHost = "", unsigned short thirdLevelPort = 0, size_t thirdLevelPG = 0)

Constructor for CombiParameters.

the constructor variant with levels, coeffs and taskIDs specified, such that Tasks can be created and tracked suitable for manager-worker setups

Parameters:
  • dim – dimensionality of the PDE solver domain

  • lmin – minimum level vector, size dim

  • lmax – maximum level vector, size dim

  • boundary – boundary conditions, size dim

  • levels – level vectors for each task

  • coeffs – coefficients for each task

  • taskIDs – IDs for each task

  • numberOfCombinations – total number of combinations, only used if reduceCombinationDimsLmax is used

  • numGrids – number of grids per task,

  • combinationVariant – variant of the combination reduction

  • parallelization – number of processes in (Cartesian) communicator

  • reduceCombinationDimsLmin – unused

  • reduceCombinationDimsLmax – reduce the maximum level vector for the distributed sparse grid (to avoid unnecessary storage / communication use (1, 1, 1, …))

  • sizeForChunkedCommunicationInMebibyte – size of the chunks for chunked reductions in MiB

  • forwardDecomposition – in case of ambiguity, decompose the full grid such that the middle grid points are on the “lower” process

  • thirdLevelHost – hostname of the third level manager (deprecated)

  • thirdLevelPort – port to connect to third level manager (deprecated)

  • thirdLevelPG – process group that should connect to the third level manager (deprecated)

inline CombiParameters(DimType dim, const LevelVector &lmin, const LevelVector &lmax, const std::vector<BoundaryType> &boundary, size_t numberOfCombinations, IndexType numGrids = 1, CombinationVariant combinationVariant = CombinationVariant::sparseGridReduce, const std::vector<int> &parallelization = {0}, const LevelVector &reduceCombinationDimsLmin = LevelVector(0), const LevelVector &reduceCombinationDimsLmax = LevelVector(0), uint32_t sizeForChunkedCommunicationInMebibyte = 64, bool forwardDecomposition = false, const std::string &thirdLevelHost = "", unsigned short thirdLevelPort = 0, size_t thirdLevelPG = 0)

Constructor for CombiParameters.

constructor variant w/o combination scheme specified &#8212; the workers have their partial list imlpicitly as tasks vector, e.g. worker-only setups

Parameters:
  • dim – dimensionality of the PDE solver domain

  • lmin – minimum level vector, size dim

  • lmax – maximum level vector, size dim

  • boundary – boundary conditions, size dim

  • numberOfCombinations – total number of combinations, only used if reduceCombinationDimsLmax is used

  • numGrids – number of grids per task,

  • combinationVariant – variant of the combination reduction

  • parallelization – number of processes in (Cartesian) communicator

  • reduceCombinationDimsLmin – unused

  • reduceCombinationDimsLmax – reduce the maximum level vector for the distributed sparse grid (to avoid unnecessary storage / communication use (1, 1, 1, …))

  • sizeForChunkedCommunicationInMebibyte – size of the chunks for chunked reductions in MiB

  • forwardDecomposition – in case of ambiguity, decompose the full grid such that the middle grid points are on the “lower” process

  • thirdLevelHost – hostname of the third level manager (deprecated)

  • thirdLevelPort – port to connect to third level manager (deprecated)

  • thirdLevelPG – process group that should connect to the third level manager (deprecated)

inline CombiParameters(DimType dim, const LevelVector &lmin, const LevelVector &lmax, const std::vector<BoundaryType> &boundary, const std::vector<LevelVector> &levels, const std::vector<real> &coeffs, const std::vector<bool> &hierarchizationDims, const std::vector<size_t> &taskIDs, size_t numberOfCombinations, IndexType numGrids = 1, CombinationVariant combinationVariant = CombinationVariant::sparseGridReduce, const LevelVector &reduceCombinationDimsLmin = LevelVector(0), const LevelVector &reduceCombinationDimsLmax = LevelVector(0), uint32_t sizeForChunkedCommunicationInMebibyte = 64, bool forwardDecomposition = false, const std::string &thirdLevelHost = "", unsigned short thirdLevelPort = 0, size_t thirdLevelPG = 0)

Constructor for CombiParameters.

constructor variant with hierarchizationDims specified, to only hierarchize certain dimensions

Parameters:
  • dim – dimensionality of the PDE solver domain

  • lmin – minimum level vector, size dim

  • lmax – maximum level vector, size dim

  • boundary – boundary conditions, size dim

  • levels – level vectors for each task

  • coeffs – coefficients for each task

  • hierarchizationDims – vector of bools, whether to hierarchize the dimension

  • taskIDs – IDs for each task

  • numberOfCombinations – total number of combinations, only used if reduceCombinationDimsLmax is used

  • numGrids – number of grids per task,

  • combinationVariant – variant of the combination reduction

  • reduceCombinationDimsLmin – unused

  • reduceCombinationDimsLmax – reduce the maximum level vector for the distributed sparse grid (to avoid unnecessary storage / communication use (1, 1, 1, …))

  • sizeForChunkedCommunicationInMebibyte – size of the chunks for chunked reductions in MiB

  • forwardDecomposition – in case of ambiguity, decompose the full grid such that the middle grid points are on the “lower” process

  • thirdLevelHost – hostname of the third level manager (deprecated)

  • thirdLevelPort – port to connect to third level manager (deprecated)

  • thirdLevelPG – process group that should connect to the third level manager (deprecated)

~CombiParameters() = default
inline const LevelVector &getLMin() const
inline const LevelVector &getLMax() const
inline const LevelVector &getLMaxReductionVector() const
inline const std::vector<BoundaryType> &getBoundary() const

get the boundary flags

inline real getCoeff(size_t taskID) const

get the combination coefficient for a specific task

inline void getCoeffs(std::vector<size_t> &taskIDs, std::vector<real> &coeffs) const

get the combination coefficients of all tasks

inline std::map<LevelVector, size_t> &getLevelsToIDs()

get a mapping from levels to task IDs

inline void setCoeff(size_t taskID, real coeff)

set a new combination coefficient for a task

only used for fault tolerance

inline void setLevelsCoeffs(const std::vector<size_t> &taskIDs, const std::vector<LevelVector> &levels, const std::vector<real> &coeffs)

set the levels and coefficients for the tasks

inline const LevelVector &getLevel(size_t taskID) const

get the level vector for a specific task by its taskID

inline size_t getID(LevelVector level)

get the task ID for a specific level vector

inline std::map<size_t, LevelVector> &getLevelsDict()

get a reference to a mappping of task IDs to level vectors

inline std::map<LevelVector, real> &getCombiDict()

get a reference to a mapping of level vectors to combination coefficients

inline DimType getDim() const

get the dimensionality of the PDE solver domain

inline size_t getNumLevels() const

get the number of levels / component grids in the combination technique

with fault tolerance, this number can change and may include grids with zero-coefficients

inline size_t getNumGrids() const

this method returns the number of grids a task contains in case we have multiple grids in our simulation, for instance multiple particle species in a plasma turbulence simulation

inline const std::vector<bool> &getHierarchizationDims() const

get the dimensions in which hierarchization should be performed, i.e., the combination technique will be used

inline void setHierarchicalBases(const std::vector<BasisFunctionType> &bases)

Set the Hierarchical Bases object.

set a vector of hierarchical bases, one for each dimension (not necessary if using hierarchical hats in all dimensions)

inline const std::vector<BasisFunctionType> &getHierarchicalBases() const

Get the hierarchical bases, one for each dimension (assuming all the dfgs are using the same number of dimensions and the same bases)

Returns:

std::vector<BasisFunctionType> the type of basis function for each dimension

inline const std::vector<int> &getParallelization() const

get the common (Cartesian) parallelization, assuming all component grids share the same parallelization

Returns:

const std::vector<int>& the number of processes in each dimension

inline const size_t &getNumberOfCombinations() const

get the number of combinations

inline CombinationVariant getCombinationVariant() const

get the combination variant used

inline HierarchizationBackend getHierarchizationBackend() const
inline void setHierarchizationBackend(HierarchizationBackend backend)
inline uint32_t getChunkSizeInMebibybtePerThread() const

get the reduction chunk size in MiB per OpenMP thread

for chunked reductions

inline const std::string &getThirdLevelHost()

get the URL where the third level manager is running

inline unsigned short getThirdLevelPort()

get the port where the third level manager is running

inline size_t getThirdLevelPG()

get the process group that should connect to the third level manager

inline void setParallelization(const std::vector<int> &p)

set the parallelization

inline bool isParallelizationSet() const
inline void setDecomposition(const std::vector<IndexVector> &decomposition)

Set the Decomposition, specified by 1d point indices at maximum resolution level.

Parameters:

decomposition – a vector of index vectors, specifying for each dimension the lowest 1d index (on a full grid of level lmax) that will belong to each cartesian communicator slice

inline const std::vector<IndexVector> &getDecomposition() const

get the decomposition, specified by 1d point indices at maximum resolution level

inline bool getForwardDecomposition() const

Friends

friend class boost::serialization::access