fvMeshDistributors::loadBalancer: Prototype general CPU load balancer

used in conjunction with the new loadBalancing option in constant/chemistryProperties:

    loadBalancing   on;

which enables per-cell CPU time caching used by the loadBalancer to redistribute
the mesh.  Currently this option is only provided for chemistry integration but
the implementation is general and in future options will be provided to balance
other local cell loads, in particular Lagrangian particles.

The loadBalancer in enabled by specifying a distributor entry in
constant/dynamicMeshDict, e.g.

distributor
{
    type            loadBalancer;

    libs            ("libfvMeshDistributors.so");

    multiConstraint true;

    // How often to redistribute
    redistributionInterval  10;

    // Maximum fractional cell distribution imbalance
    // before rebalancing
    maxImbalance    0.1;
}

with which the mesh is checked for more than 10% load-imbalance every 10
time-steps and redistributed using a multi-constraint method, i.e. separate CPU
load weights are provided for each of the loads, currently that is the chemistry
integration load and the CPU time taken for the rest of the simulation,
transport equations solution etc.

The fvMeshDistributors::loadBalancer uses the distributor specified in
system/decomposeParDict to redistribute the mesh based on the cell CPU loads,
e.g. to use the Zoltan RCB method specify:

distributor     zoltan;
libs            ("libzoltanDecomp.so");

zoltanCoeffs
{
    lb_method   rcb;
}

Unfortunately only a few available redistribution methods support
multi-constraints: Zoltan::RCB, MeTiS, parMeTiS and xtraPuLP, of these only
Zoltan::RCB is currently available in OpenFOAM.  Load-balancing is possible
without using a multi-constraint method (i.e. using any of the other
decomposition methods provided with OpenFOAM and Zoltan) by summing the various
CPU loads which is selected by setting:

    multiConstraint false;

but the load-balancing is likely to be a lot less effective with this option.

Due to the licencing issues with parMeTiS interfacing to xtraPuLP might be the
best option for further work on load-balancing in OpenFOAM, or MeTiS could be
used in parallel by first agglomerating the distribution graph on the master
processor and redistributing the result; this pseudo-parallel option is already
provided for the Scotch method.
This commit is contained in:
Henry Weller
2022-01-17 11:31:12 +00:00
parent 3c353761ed
commit 472ce5ace6
29 changed files with 533 additions and 63 deletions

View File

@ -20,6 +20,8 @@ internalField uniform 0.0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 1;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 2000;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 0.0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type fixedValue;

View File

@ -20,6 +20,8 @@ internalField uniform 1e5;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
fuel
{
type zeroGradient;

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication decomposePar
runParallel $(getApplication)
#------------------------------------------------------------------------------

View File

@ -21,6 +21,8 @@ chemistryType
chemistry on;
loadBalancing on;
initialChemicalTimeStep 1e-07;
odeCoeffs

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
distributor
{
type loadBalancer;
libs ("libfvMeshDistributors.so");
multiConstraint true;
redistributionInterval 10;
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
distributor
{
type loadBalancer;
libs ("libfvMeshDistributors.so");
multiConstraint true;
redistributionInterval 10;
}
// ************************************************************************* //

View File

@ -68,6 +68,12 @@ boundary
(0 3 2 1)
);
}
internal
{
type internal;
faces ();
}
);

View File

@ -14,14 +14,22 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
numberOfSubdomains 12;
method hierarchical;
decomposer hierarchical;
distributor zoltan;
libs ("libzoltanDecomp.so");
hierarchicalCoeffs
{
n (2 2 1);
n (6 2 1);
order xyz;
}
zoltanCoeffs
{
lb_method rcb;
}
// ************************************************************************* //