ug4
Domain Distribution Utility

creates partition maps of different structure and provides some easy to use domain distribution methods. More...

Functions

function util DistributeDomain (dom, partitioningMethod, verticalInterfaces, numTargetProcs, distributionLevel, wFct)
 
function util PartitionMapBisection (dom, partitionMapOut, numProcs)
 
function util PartitionMapLexicographic2D (dom, partitionMapOut, numNodesX, numNodesY, numProcsPerNode)
 
function util PartitionMapMetis (dom, partitionMapOut, numProcs, baseLevel)
 
function util PartitionMapMetisReweigh (dom, partitionMapOut, numProcs, baseLevel, wFct)
 
function util PartitionMapRegularGrid (dom, partitionMapOut, numNodesX, numNodesY, numNodesZ)
 

Detailed Description

creates partition maps of different structure and provides some easy to use domain distribution methods.

Author
Sebastian Reiter

Function Documentation

◆ DistributeDomain()

function util DistributeDomain ( dom  ,
partitioningMethod  ,
verticalInterfaces  ,
numTargetProcs  ,
distributionLevel  ,
wFct   
)

Distributes the top-level of a domain to the given number of processes. This method has to be called by all processes with the same parameters!

Note
Some paramters are optional. nil is a valid value for each optional parameter.
Returns
(bool) Returns whether the method was a success
Parameters
dom(Domain) A valid domain instance.
partitioningMethod(optional string) Choose the partitioning method. Valid values are: "bisection", "metis" default is "bisection". "metis" is only available, if ug has been built with metis support.
verticalInterfaces(optional bool) Trigger creation of vertical interfaces. vertical interfaces are required for multi-grid solvers. If you're only going to solve on the surface grid, vertical interfaces may introduce an unnecessary overhead. Default is true
numTargetProcs(optional integer) The number of target processes to which the domain will be distributed. This shouldn't be more than there are elements in the top-level. Default is NumProcs()
distributionLevel(optional integer) Sets the level on which distribution is performed. Default is the domains top-level. Currently only supported in partitioningMethod "metis".
wFct(optional SmartPtr<EdgeWeighting>) Sets the weighting function for the 'metisReweigh' partitioning method.

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :66-128

◆ PartitionMapBisection()

function util PartitionMapBisection ( dom  ,
partitionMapOut  ,
numProcs   
)

create a partition map by performing repeated bisection

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :132-165

◆ PartitionMapLexicographic2D()

function util PartitionMapLexicographic2D ( dom  ,
partitionMapOut  ,
numNodesX  ,
numNodesY  ,
numProcsPerNode   
)

performs lexicographic ordering from the lower left to the upper right. Since each node can consist of multiple processes, we can further perform a 'hierarchical' lexicographic ordering. Set numProcsPerNode to 1 to retrieve a default ordering. Set it to any square of n (n = 2, 3, ...) to retrieve lexicographic ordered subgrids in each node (a node is considered to be a square grid itself). If numProcsPerNode is not a square-number, then it will be defaulted to 1. Since this method adds target procs 0, ..., numNodesX * numNodesY * numProcsPerNode to the given partitionMap, it is not suited for redistribution.

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :201-236

◆ PartitionMapMetis()

function util PartitionMapMetis ( dom  ,
partitionMapOut  ,
numProcs  ,
baseLevel   
)

create a partition map by using metis graph partitioning. This only works if Metis is available in the current build. Use PartitionDomain_MetisKWay directly in this case.

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :170-176

function util.PartitionMapMetis(dom, partitionMapOut, numProcs, baseLevel)
if(partitionMapOut:num_target_procs() ~= numProcs) then
partitionMapOut:clear()
partitionMapOut:add_target_procs(0, numProcs)
end
PartitionDomain_MetisKWay(dom, partitionMapOut, numProcs, baseLevel, 1, 1)
end
static bool PartitionDomain_MetisKWay(TDomain &domain, PartitionMap &partitionMap, int numPartitions, size_t baseLevel=0, int hWeight=1, int vWeight=1)
partitions a domain by using graph-based partitioning by METIS

◆ PartitionMapMetisReweigh()

function util PartitionMapMetisReweigh ( dom  ,
partitionMapOut  ,
numProcs  ,
baseLevel  ,
wFct   
)

create a partition map by using metis graph partitioning and correct weights of dual graph edges by weighting function. This only works if Metis is available in the current build. Use PartitionDomain_MetisKWay directly in this case.

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :182-188

function util.PartitionMapMetisReweigh(dom, partitionMapOut, numProcs, baseLevel, wFct)
if(partitionMapOut:num_target_procs() ~= numProcs) then
partitionMapOut:clear()
partitionMapOut:add_target_procs(0, numProcs)
end
PartitionDomain_MetisKWay(dom, partitionMapOut, numProcs, baseLevel, wFct)
end

◆ PartitionMapRegularGrid()

function util PartitionMapRegularGrid ( dom  ,
partitionMapOut  ,
numNodesX  ,
numNodesY  ,
numNodesZ   
)

Partitions the grid by assigning each element to a process corresponding to the index of the cell in which the elements center lies. Make sure that numNodesX, numNodesY and numNodesZ are >= 1.

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / domain_distribution_util.lua :241-252

function util.PartitionMapRegularGrid(dom, partitionMapOut, numNodesX, numNodesY, numNodesZ)
local numProcsRequired = numNodesX * numNodesY * numNodesZ
if NumProcs() < (numProcsRequired) then
print("Not enough processes allocated. At least " .. numProcsRequired .. " processes are required!")
exit()
end
if(partitionMapOut:num_target_procs() ~= numProcsRequired) then
partitionMapOut:clear()
partitionMapOut:add_target_procs(0, numProcsRequired)
end
PartitionDomain_RegularGrid(dom, partitionMapOut, numNodesX, numNodesY, numNodesZ, true)
end
int NumProcs()
returns the number of processes
Definition: pcl_base.cpp:91
function table print(data, style)
if(!(yy_init))
Definition: lexer.cpp:997
int local(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:57
static bool PartitionDomain_RegularGrid(TDomain &domain, PartitionMap &partitionMap, int numCellsX, int numCellsY, int numCellsZ, bool surfaceOnly)
partitions a domain by sorting all elements into a regular grid