scotchDecomp Class Reference

Scotch domain decomposition. More...

Inheritance diagram for scotchDecomp:
[legend]
Collaboration diagram for scotchDecomp:
[legend]

Public Member Functions

 TypeName ("scotch")
 Runtime type information. More...
 
 scotchDecomp (const dictionary &decompDict, const word &regionName="")
 Construct given decomposition dictionary and optional region name. More...
 
virtual ~scotchDecomp ()=default
 Destructor. More...
 
virtual bool parallelAware () const
 Knows about coupled boundaries. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const
 Return for every coordinate the wanted processor number. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &agglom, const pointField &regionPoints, const scalarField &regionWeights) const
 Return for every coordinate the wanted processor number. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc, const scalarField &cWeights) const
 Return for every coordinate the wanted processor number. More...
 
virtual labelList decompose (const pointField &points, const scalarField &pointWeights) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const pointField &points) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const=0
 Inherit all decompose methods. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints, const scalarField &regionWeights) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc, const scalarField &cWeights) const=0
 Inherit all decompose methods. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc) const
 Inherit all decompose methods. More...
 
virtual labelList decompose (const polyMesh &mesh, const scalarField &cellWeights, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections) const
 Inherit all decompose methods. More...
 
labelList decompose (const polyMesh &mesh, const scalarField &cWeights) const
 Inherit all decompose methods. More...
 
- Public Member Functions inherited from metisLikeDecomp
virtual ~metisLikeDecomp ()=default
 Destructor. More...
 
virtual labelList decompose (const pointField &points, const scalarField &pointWeights) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const pointField &points) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const=0
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints, const scalarField &regionWeights) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc, const scalarField &cWeights) const=0
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc) const
 Inherit decompose from decompositionMethod. More...
 
virtual labelList decompose (const polyMesh &mesh, const scalarField &cellWeights, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections) const
 Inherit decompose from decompositionMethod. More...
 
labelList decompose (const polyMesh &mesh, const scalarField &cWeights) const
 Inherit decompose from decompositionMethod. More...
 
- Public Member Functions inherited from decompositionMethod
 TypeName ("decompositionMethod")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, decompositionMethod, dictionary,(const dictionary &decompDict, const word &regionName),(decompDict, regionName))
 
 decompositionMethod (const dictionary &decompDict, const word &regionName="")
 
virtual ~decompositionMethod ()=default
 Destructor. More...
 
label nDomains () const noexcept
 Number of domains. More...
 
virtual labelList decompose (const pointField &points, const scalarField &pointWeights) const
 Return the wanted processor number for every coordinate. More...
 
virtual labelList decompose (const pointField &points) const
 Decompose with uniform weights on the points. More...
 
virtual labelList decompose (const polyMesh &mesh, const pointField &points) const
 Decompose with uniform weights on the points. More...
 
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints) const
 Like decompose but with uniform weights on the regions. More...
 
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc) const
 Like decompose but with uniform weights on the cells. More...
 
void setConstraints (const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
 Helper: extract constraints: More...
 
void applyConstraints (const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &finalDecomp) const
 Helper: apply constraints to a decomposition. More...
 
virtual labelList decompose (const polyMesh &mesh, const scalarField &cellWeights, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections) const
 
labelList decompose (const polyMesh &mesh, const scalarField &cWeights) const
 Decompose a mesh. More...
 

Protected Member Functions

virtual label decomposeSerial (const labelList &adjncy, const labelList &xadj, const List< scalar > &cWeights, labelList &decomp) const
 Decompose non-parallel. More...
 
 scotchDecomp (const scotchDecomp &)=delete
 No copy construct. More...
 
void operator= (const scotchDecomp &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from metisLikeDecomp
virtual label decomposeGeneral (const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
 Serial and/or collect/distribute for parallel operation. More...
 
 metisLikeDecomp (const metisLikeDecomp &)=delete
 No copy construct. More...
 
void operator= (const metisLikeDecomp &)=delete
 No copy assignment. More...
 
 metisLikeDecomp (const word &derivedType, const dictionary &decompDict, int select=selectionType::NULL_DICT)
 Construct for derived type name and decomposition dictionary. More...
 
 metisLikeDecomp (const word &derivedType, const dictionary &decompDict, const word &regionName, int select=selectionType::NULL_DICT)
 
- Protected Member Functions inherited from decompositionMethod
const dictionaryfindCoeffsDict (const word &coeffsName, int select=selectionType::DEFAULT) const
 Locate coeffsName dictionary or the fallback "coeffs" dictionary. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from decompositionMethod
static label nDomains (const dictionary &decompDict, const word &regionName="")
 Return region-specific or top-level numberOfSubdomains entry. More...
 
static const dictionaryoptionalRegionDict (const dictionary &decompDict, const word &regionName)
 
static autoPtr< decompositionMethodNew (const dictionary &decompDict, const word &regionName="")
 
static void calcCellCells (const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
 Helper: determine (local or global) cellCells from mesh. More...
 
static void calcCellCells (const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells, CompactListList< scalar > &cellCellWeights)
 Helper: determine (local or global) cellCells and face weights. More...
 
- Protected Types inherited from decompositionMethod
enum  selectionType { DEFAULT = 0, EXACT = 1, MANDATORY = 2, NULL_DICT = 4 }
 Selection type when handling the coefficients dictionary. More...
 
- Static Protected Member Functions inherited from decompositionMethod
static const dictionaryfindCoeffsDict (const dictionary &dict, const word &coeffsName, int select=selectionType::DEFAULT)
 
- Protected Attributes inherited from metisLikeDecomp
const dictionarycoeffsDict_
 Coefficients for all derived methods. More...
 
- Protected Attributes inherited from decompositionMethod
const dictionarydecompDict_
 Top-level decomposition dictionary (eg, decomposeParDict) More...
 
const dictionarydecompRegionDict_
 Region-specific decomposition dictionary information. More...
 
label nDomains_
 Number of domains for the decomposition. More...
 
PtrList< decompositionConstraintconstraints_
 Optional constraints. More...
 

Detailed Description

Scotch domain decomposition.

When run in parallel will collect the whole graph on to the master, decompose and send back. Use ptscotchDecomp for proper distributed decomposition.

Coefficients dictionary: scotchCoeffs, coeffs.

Quoting from the Scotch forum, on the 2008-08-22 10:09, Francois PELLEGRINI posted the following details:

RE: Graph mapping 'strategy' string

Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:

1- Strategies are made up of "methods" which are combined by means of
"operators".

2- A method is of the form "m{param=value,param=value,...}", where "m"
is a single character (this is your first error: "f" is a method name,
not a parameter name).

3- There exist different sort of strategies : bipartitioning strategies,
mapping strategies, ordering strategies, which cannot be mixed. For
instance, you cannot build a bipartitioning strategy and feed it to a
mapping method (this is your second error).

To use the "mapCompute" routine, you must create a mapping strategy, not
a bipartitioning one, and so use stratGraphMap() and not
stratGraphBipart(). Your mapping strategy should however be based on the
"recursive bipartitioning" method ("b"). For instance, a simple (and
hence not very efficient) mapping strategy can be :

"b{sep=f}"

which computes mappings with the recursive bipartitioning method "b",
this latter using the Fiduccia-Mattheyses method "f" to compute its
separators.

If you want an exact partition (see your previous post), try
"b{sep=fx}".

However, these strategies are not the most efficient, as they do not
make use of the multi-level framework.

To use the multi-level framework, try for instance:

"b{sep=m{vert=100,low=h,asc=f}x}"

The current default mapping strategy in Scotch can be seen by using the
"-vs" option of program gmap. It is, to date:

r
{
    job=t,
    map=t,
    poli=S,
    sep=
    (
        m
        {
            asc=b
            {
                bnd=
                (
                    d{pass=40,dif=1,rem=1}
                 |
                )
                f{move=80,pass=-1,bal=0.002491},
                org=f{move=80,pass=-1,bal=0.002491},
                width=3
            },
            low=h{pass=10}
            f{move=80,pass=-1,bal=0.002491},
            type=h,
            vert=80,
            rat=0.8
        }
      | m
        {
            asc=b
            {
                bnd=
                (
                    d{pass=40,dif=1,rem=1}
                  |
                )
                f{move=80,pass=-1,bal=0.002491},
                org=f{move=80,pass=-1,bal=0.002491},
                width=3
            },
            low=h{pass=10}
            f{move=80,pass=-1,bal=0.002491},
            type=h,
            vert=80,
            rat=0.8
        }
    )
}

Given that this information was written in 2008, this example strategy will unlikely work as-is with the more recent Scotch versions. Therefore, the steps for getting the current default strategy from within Scotch, is to do the following steps:

  1. Edit the file system/decomposeParDict and use the following settings:

    method          scotch;
    
    scotchCoeffs
    {
        writeGraph true;
    }
    

  2. Run decomposePar. For example, it will write a file named region0.grf.

  3. Now, instead of using gmap, run gpart with the following command structure to get the default strategy:

    gpart \<nProcs\> -vs \<grfFile\>
    

    where:

    • <grfFile> is the file that was obtained with the option writeGraph=true, namely region0.grf.
    • <nProcs> is the numberOfSubdomains defined in the dictionary file.

  4. At the end of the execution will be shown a long string, similar to the following example (complete line was cropped at [...]):

    S    Strat=m{asc=b{width=3,bnd=d{pass=40,dif=1,rem=0}[...],type=h}
    

  5. Edit the file system/decomposeParDict once again and add the strategy entry as exemplified:

    method          scotch;
    
    scotchCoeffs
    {
        //writeGraph true;
        strategy "m{asc=b{width=3,bnd=d{pass=40,dif=1,rem=0}[...],type=h}";
    }
    

  6. Finally, run decomposePar once again, to at least test if it works as intended.

Note
gpart can be found in the current search path by adding the respective bin folder from the Scotch installation, namely by running the following commands:
source $(foamEtcFile config.sh/scotch)
export PATH=$PATH:$SCOTCH_ARCH_PATH/bin
Source files

Definition at line 230 of file scotchDecomp.H.

Constructor & Destructor Documentation

◆ scotchDecomp() [1/2]

scotchDecomp ( const scotchDecomp )
protecteddelete

No copy construct.

◆ scotchDecomp() [2/2]

scotchDecomp ( const dictionary decompDict,
const word regionName = "" 
)
explicit

Construct given decomposition dictionary and optional region name.

Definition at line 78 of file dummyScotchDecomp.C.

◆ ~scotchDecomp()

virtual ~scotchDecomp ( )
virtualdefault

Destructor.

Member Function Documentation

◆ decomposeSerial()

Foam::label decomposeSerial ( const labelList adjncy,
const labelList xadj,
const List< scalar > &  cWeights,
labelList decomp 
) const
protectedvirtual

Decompose non-parallel.

Hack to test clustering. Note that decomp is non-compact

numbers!

  • Set up variable sizes architecture check ( SCOTCH_archVcmplt(&archdat), "SCOTCH_archVcmplt" );
  • Stategy flags: go for quality or load balance (or leave default) SCOTCH_Num straval = 0; straval |= SCOTCH_STRATQUALITY; straval |= SCOTCH_STRATQUALITY;
  • Number of cells per agglomeration SCOTCH_Num agglomSize = SCOTCH_archSize(&archdat); SCOTCH_Num agglomSize = 3;
  • Build strategy for agglomeration check ( SCOTCH_stratGraphClusterBuild ( &stradat, // strategy to build straval, // strategy flags agglomSize, // cells per cluster 1.0, // weight? 0.01 // max load imbalance ), "SCOTCH_stratGraphClusterBuild" );

Implements metisLikeDecomp.

Definition at line 60 of file dummyScotchDecomp.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and notImplementedMessage.

Here is the call graph for this function:

◆ operator=()

void operator= ( const scotchDecomp )
protecteddelete

No copy assignment.

◆ TypeName()

TypeName ( "scotch"  )

Runtime type information.

◆ parallelAware()

virtual bool parallelAware ( ) const
inlinevirtual

Knows about coupled boundaries.

Implements decompositionMethod.

Definition at line 284 of file scotchDecomp.H.

◆ decompose() [1/13]

Foam::labelList decompose ( const polyMesh mesh,
const pointField points,
const scalarField pointWeights 
) const
virtual

Return for every coordinate the wanted processor number.

Reimplemented from metisLikeDecomp.

Definition at line 90 of file dummyScotchDecomp.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and notImplementedMessage.

Here is the call graph for this function:

◆ decompose() [2/13]

Foam::labelList decompose ( const polyMesh mesh,
const labelList agglom,
const pointField regionPoints,
const scalarField regionWeights 
) const
virtual

Return for every coordinate the wanted processor number.

Reimplemented from metisLikeDecomp.

Definition at line 104 of file dummyScotchDecomp.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and notImplementedMessage.

Here is the call graph for this function:

◆ decompose() [3/13]

Foam::labelList decompose ( const labelListList globalCellCells,
const pointField cc,
const scalarField cWeights 
) const
virtual

Return for every coordinate the wanted processor number.

Reimplemented from metisLikeDecomp.

Definition at line 119 of file dummyScotchDecomp.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and notImplementedMessage.

Here is the call graph for this function:

◆ decompose() [4/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 1325 of file decompositionMethod.C.

◆ decompose() [5/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 1336 of file decompositionMethod.C.

◆ decompose() [6/13]

virtual labelList decompose

Inherit all decompose methods.

◆ decompose() [7/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 384 of file decompositionMethod.C.

◆ decompose() [8/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 396 of file decompositionMethod.C.

◆ decompose() [9/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 437 of file decompositionMethod.C.

◆ decompose() [10/13]

virtual labelList decompose

Inherit all decompose methods.

◆ decompose() [11/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 456 of file decompositionMethod.C.

◆ decompose() [12/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 867 of file decompositionMethod.C.

◆ decompose() [13/13]

Foam::labelList decompose

Inherit all decompose methods.

Definition at line 1271 of file decompositionMethod.C.


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