metis_interface Module

module~~metis_interface~~UsesGraph module~metis_interface metis_interface iso_c_binding iso_c_binding iso_c_binding->module~metis_interface
Help

A Fortran interface to the METIS graph partitioning library.

http://glaros.dtc.umn.edu/gkhome/node/877

Used By

module~~metis_interface~~UsedByGraph module~metis_interface metis_interface program~test_partmeshnodal2 test_PartMeshNodal2 module~metis_interface->program~test_partmeshnodal2 program~test_partgraphkway test_PartGraphKway module~metis_interface->program~test_partgraphkway program~test_partgraphrecursive1 test_PartGraphRecursive1 module~metis_interface->program~test_partgraphrecursive1 program~test_partgraphrecursive2 test_PartGraphRecursive2 module~metis_interface->program~test_partgraphrecursive2 module~metis_oo_interface metis_oo_interface module~metis_interface->module~metis_oo_interface program~test_partmeshnodal1 test_PartMeshNodal1 module~metis_interface->program~test_partmeshnodal1 program~test_nodend test_NodeND module~metis_interface->program~test_nodend
Help


Variables

TypeVisibility AttributesNameInitial
integer, public, parameter:: idx_t =c_int32_t
integer, public, parameter:: real_t =c_float
integer(kind=idx_t), public, parameter:: METIS_NOPTIONS =40

Number of METIS OPTIONS

integer(kind=idx_t), public, parameter:: METIS_OK =1

Returned normally.

integer(kind=idx_t), public, parameter:: METIS_ERROR_INPUT =-2

Returned due to erroneous inputs and/or options.

integer(kind=idx_t), public, parameter:: METIS_ERROR_MEMORY =-3

Returned due to insufficient memory.

integer(kind=idx_t), public, parameter:: METIS_ERROR =-4

Return status: some other type of error.

integer(kind=idx_t), public, parameter:: METIS_OPTION_PTYPE =0

Specifies the partitioning method.

integer(kind=idx_t), public, parameter:: METIS_OPTION_OBJTYPE =1

Specifies the type of objective.

integer(kind=idx_t), public, parameter:: METIS_OPTION_CTYPE =2

Specifies the matching scheme to be used during coarsening.

integer(kind=idx_t), public, parameter:: METIS_OPTION_IPTYPE =3

Determines the algorithm used during initial partitioning.

integer(kind=idx_t), public, parameter:: METIS_OPTION_RTYPE =4

Determines the algorithm used for refinement.

integer(kind=idx_t), public, parameter:: METIS_OPTION_DBGLVL =5

Specifies the amount of progress/debugging information will be printed.

integer(kind=idx_t), public, parameter:: METIS_OPTION_NITER =6

Specifies the number of iterations for the refinement algorithm.

integer(kind=idx_t), public, parameter:: METIS_OPTION_NCUTS =7

Specifies the number of different partitionings that it will compute.

integer(kind=idx_t), public, parameter:: METIS_OPTION_SEED =8

Specifies the seed for the random number generator.

integer(kind=idx_t), public, parameter:: METIS_OPTION_NO2HOP =9

Specifies that the coarsening will not perform any 2–hop matchings when the standard matching approach fails to sufficiently coarsen the graph.

integer(kind=idx_t), public, parameter:: METIS_OPTION_MINCONN =10

Specifies that the partitioning routines should try to minimize the maximum degree of the subdomain graph.

integer(kind=idx_t), public, parameter:: METIS_OPTION_CONTIG =11

Specifies that the partitioning routines should try to produce partitions that are contigous.

integer(kind=idx_t), public, parameter:: METIS_OPTION_COMPRESS =12

Specifies that the graph should be compressed by combining together vertices that have identical adjacency lists.

integer(kind=idx_t), public, parameter:: METIS_OPTION_CCORDER =13

Specifies if the connected components of the graph should first be identifies and ordered separately.

integer(kind=idx_t), public, parameter:: METIS_OPTION_PFACTOR =14

Specifies the minimum degree of the vertices that will be ordered last.

integer(kind=idx_t), public, parameter:: METIS_OPTION_NSEPS =15

Specifies the number of different separators that it will compute at each level of nested dissection.

integer(kind=idx_t), public, parameter:: METIS_OPTION_UFACTOR =16

Specifies the maximum allowed load imbalance among the partitions.

integer(kind=idx_t), public, parameter:: METIS_OPTION_NUMBERING =17

Used to indicate which numbering scheme is used for the adjacency structure of a graph or the element-node structure of a mesh

integer(kind=idx_t), public, parameter:: METIS_PTYPE_RB =0

Multilevel recursive bisectioning.

integer(kind=idx_t), public, parameter:: METIS_PTYPE_KWAY =1

Multilevel \(k\)-way partitioning.

integer(kind=idx_t), public, parameter:: METIS_CTYPE_RM =0

Random matching.

integer(kind=idx_t), public, parameter:: METIS_CTYPE_SHEM =1

Sorted heavy-edge matching.

integer(kind=idx_t), public, parameter:: METIS_IPTYPE_GROW =0

Grows a bisection using a greedy strategy.

integer(kind=idx_t), public, parameter:: METIS_IPTYPE_RANDOM =1

Computes a bisection at random followed by a refinement.

integer(kind=idx_t), public, parameter:: METIS_IPTYPE_EDGE =2

Derives a separator form an edge cut.

integer(kind=idx_t), public, parameter:: METIS_IPTYPE_NODE =3

Grows a bisection using a greedy node-based strategy.

integer(kind=idx_t), public, parameter:: METIS_IPTYPE_METISRB =4
integer(kind=idx_t), public, parameter:: METIS_RTYPE_FM =0

FM-based cut refinement.

integer(kind=idx_t), public, parameter:: METIS_RTYPE_GREEDY =1

Greedy-based cut and volume refinement.

integer(kind=idx_t), public, parameter:: METIS_RTYPE_SEP2SIDED =2

Two-sided node FM refinement.

integer(kind=idx_t), public, parameter:: METIS_RTYPE_SEP1SIDED =3

One-sided node FM refinement.

integer(kind=idx_t), public, parameter:: METIS_DBG_INFO =1

Shows various diagnostic messages.

integer(kind=idx_t), public, parameter:: METIS_DBG_TIME =2

Perform timing analysis.

integer(kind=idx_t), public, parameter:: METIS_DBG_COARSEN =4

Show the coarsening progress.

integer(kind=idx_t), public, parameter:: METIS_DBG_REFINE =8

Show the refinement progress.

integer(kind=idx_t), public, parameter:: METIS_DBG_IPART =16

Show info on initial partitioning.

integer(kind=idx_t), public, parameter:: METIS_DBG_MOVEINFO =32

Show info on vertex moves during refinement.

integer(kind=idx_t), public, parameter:: METIS_DBG_SEPINFO =64

Show info on vertex moves during sep refinement.

integer(kind=idx_t), public, parameter:: METIS_DBG_CONNINFO =128

Show info on minimization of subdomain connectivity.

integer(kind=idx_t), public, parameter:: METIS_DBG_CONTIGINFO =256

Show info on elimination of connected components.

integer(kind=idx_t), public, parameter:: METIS_DBG_MEMORY =2048

Show info related to wspace allocation.

integer(kind=idx_t), public, parameter:: METIS_OBJTYPE_CUT =0

Edge-cut minimization.

integer(kind=idx_t), public, parameter:: METIS_OBJTYPE_VOL =1

Total communication volume minimization.

integer(kind=idx_t), public, parameter:: METIS_OBJTYPE_NODE =2

Interfaces

interface

  • public function METIS_PartGraphRecursive(nvtxs, ncon, xadj, adjncy, vwgt, vsize, adjwgt, nparts, tpwgts, ubvec, options, objval, part) result(ierr) bind(C,name="METIS_PartGraphRecursive")

    This function is used to partition a graph into nparts parts using recursive bisection.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: nvtxs

    The number of vertices in the graph.

    integer(kind=idx_t), intent(in) :: ncon

    The number of balancing constraints. It should be atleast 1.

    integer(kind=idx_t), intent(in), dimension(*):: xadj

    The adjacency structure of the graph as described in section 5.5 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: adjncy

    The adjacency structure of the graph as described in section 5.5 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: vwgt

    The weights of the vertices as described in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: vsize

    The size of the vertices for computing the total communication volume as described in section 5.7 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: adjwgt

    The weights of the edges as describe in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in) :: nparts

    The number of parts to partition the graph.

    real(kind=real_t), intent(in), optional :: tpwgts(nparts*ncon)

    An array of size nparts*ncon that specifies the desired weight for each partition and constraint. If not present, the graph is divided equally among the partitions. More in the description.

    real(kind=real_t), intent(in), optional :: ubvec(ncon)

    An array of size ncon that specifies the allowed load imbalance for each constraint. For the i-th partition and j-th constraint the allowed weight is the ubvec(j)*tpwgts(i*ncon+j) fraction of the j-th's constraint total weight. If not present, the load imbalance tolerance is 1.001 (for ncon = 1) or 1.01 (for ncon > 1).

    integer(kind=idx_t), intent(in), optional :: options(METIS_NOPTIONS)

    An array of options as described in Section 5.4 of the METIS manual. See description for valid options.

    integer(kind=idx_t), intent(out) :: objval

    Upon successful completion, this variable stores the edge-cut or the total communication volume of the partitioning solution. The value returned depends on the partitioning's objective function.

    integer(kind=idx_t), intent(out) :: part(nvtxs)

    This is a vector of size nvtxs that upon successful completion stores the partition vector of the graph. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_PartGraphKway(nvtxs, ncon, xadj, adjncy, vwgt, vsize, adjwgt, nparts, tpwgts, ubvec, options, objval, part) result(ierr) bind(C,name="METIS_PartGraphKway")

    This function is used to partition a graph into nparts parts using multilevel \(k\)-way partitioning.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: nvtxs

    The number of vertices in the graph.

    integer(kind=idx_t), intent(in) :: ncon

    The number of balancing constraints. It should be at least 1.

    integer(kind=idx_t), intent(in), dimension(*):: xadj

    The adjacency structure of the graph as described in section 5.5 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: adjncy

    The adjacency structure of the graph as described in section 5.5 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: vwgt

    The weights of the vertices as described in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: vsize

    The size of the vertices for computing the total communication volume as described in section 5.7 of the manual.

    integer(kind=idx_t), intent(in), optional dimension(*):: adjwgt

    The weights of the edges as describe in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in) :: nparts

    The number of parts to partition the graph.

    real(kind=real_t), intent(in), optional :: tpwgts(nparts*ncon)

    An array of size nparts*ncon that specifies the desired weight for each partition and constraint. If not present, the graph is divided equally among the partitions. More in the description.

    real(kind=real_t), intent(in), optional :: ubvec(ncon)

    An array of size ncon that specifiew the allowed load imbalance for each constraint. For the i-th partition and j-th constraint the allowed weight is the ubvec(j)*tpwgts(i*ncon+j) fraction of the j-th's constraint total weight. If not present, the load imbalance tolerance is 1.001 (for ncon == 1) or 1.01 (for ncon > 1).

    integer(kind=idx_t), intent(in), optional :: options(METIS_NOPTIONS)

    An array of options as described in Section 5.4 of the manual. See description for valid options.

    integer(kind=idx_t), intent(out) :: objval

    Upon successful completion, this variable stores the edge-cut or the total communication volume of the partitioning solution. The value returned depends on the partitioning's objective function.

    integer(kind=idx_t), intent(out) :: part(nvtxs)

    This is a vector of size nvtxs that upon successful completion stores the partition vector of the graph. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_PartMeshDual(ne, nn, eptr, eind, vwgt, vsize, ncommon, nparts, tpwgts, options, objval, epart, npart) result(ierr) bind(C,name="METIS_PartMeshDual")

    This function is used to partition a mesh into nparts parts based on a partitioning of the mesh's dual graph.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: ne

    The number of elements in the mesh.

    integer(kind=idx_t), intent(in) :: nn

    The number of nodes in the mesh.

    integer(kind=idx_t), intent(in), dimension(*):: eptr

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: eind

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), optional :: vwgt(ne)

    An array of size ne specifying the weights of the elements. If not present, all elements have an equal weight.

    integer(kind=idx_t), intent(in), optional :: vsize(ne)

    An array of size ne specifying the size of the elements that is used for computing the total comunication volume as described in Section 5.7 of the manual. If not present, the objective is cut or all elements have an equal size.

    integer(kind=idx_t), intent(in) :: ncommon
    integer(kind=idx_t), intent(in) :: nparts

    The number of parts to partition the mesh.

    integer(kind=idx_t), intent(in), optional :: tpwgts(nparts)

    An array of size nparts that specifies the desired weight for each partition. The target partition weight for the i-th partition is specified at tpwgts(i) (the numbering for the partitions starts from 0). The sum of the tpwgts entries must be 1.0.
    If not present, the graph is divided equally among the partitions.

    integer(kind=idx_t), intent(in), optional :: options(METIS_NOPTIONS)

    An array of options as described in Section 5.4 of the manual. See description for valid options.

    integer(kind=idx_t), intent(out) :: objval

    Upon successful completion, this variable stores either the edgecut or the total communication volume of the dual graph's partitioning.

    integer(kind=idx_t), intent(out) :: epart(ne)

    A vector of size ne that upon successful completion stores the partition vector for the elements of the mesh. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    integer(kind=idx_t), intent(out) :: npart(nn)

    A vector of size nn that upon successful completion stores the partition vector for the nodes of the mesh. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_PartMeshNodal(ne, nn, eptr, eind, vwgt, vsize, nparts, tpwgts, options, objval, epart, npart) result(ierr) bind(C,name="METIS_PartMeshNodal")

    This function us used to partition a mesh into nparts parts based on a partitioning of the mesh's nodal graph.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: ne

    The number of elements in the mesh.

    integer(kind=idx_t), intent(in) :: nn

    The number of nodes in the mesh.

    integer(kind=idx_t), intent(in), dimension(*):: eptr

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: eind

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), optional :: vwgt(nn)

    An array of size nn specifying weights of the nodes. If not passed, all nodes have an equal weight.

    integer(kind=idx_t), intent(in), optional :: vsize(nn)

    An array of size nn specifying the size of the nodes that is used for computing the total comunication volume as described in Section 5.7 of the manual. If not passed, the objective is cut or all nodes have an equal size.

    integer(kind=idx_t), intent(in) :: nparts

    The number of parts to partition the mesh.

    integer(kind=idx_t), intent(in), optional :: tpwgts(nparts)

    An array of size nparts that specifies the desired weight for each partition. The target partition weight for the i-th partition is specified at tpwgts(i) (the numbering for the partitions starts from 0). The sum of the tpwgts entries must be 1.0. If not passed, the graph is divided equally among the partitions.

    integer(kind=idx_t), intent(in), optional :: options(METIS_NOPTIONS)

    An array of options as described in Section 5.4 of the manual. See description for valid options.

    integer(kind=idx_t), intent(out) :: objval

    Upon successful completion, this variable stores either the edgecut or the total communication volume of the nodal graph's partitioning.

    integer(kind=idx_t), intent(out) :: epart(ne)

    A vector of size ne that upon successful completion stores the partition vector for the elements of the mesh. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    integer(kind=idx_t), intent(out) :: npart(nn)

    A vector of size nn that upon successful completion stores the partition vector for the nodes of the mesh. The numbering of this vector starts from either 0 or 1, depending on the value of options(METIS_OPTION_NUMBERING).

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_NodeND(nvtxs, xadj, adjncy, vwgt, options, perm, iperm) result(ierr) bind(C,name="METIS_NodeND")

    This function computes fill reducing orderings of sparse matrices using the multilevel nested dissection algorithm.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: nvtxs

    The number of vertices in the graph.

    integer(kind=idx_t), intent(in), dimension(*):: xadj

    The adjacency structure of the graph as described in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: adjncy

    The adjacency structure of the graph as described in Section 5.5 of the manual.

    integer(kind=idx_t), intent(in), optional :: vwgt(nvtxs)

    An array of size nvtxs specifying the weights of the vertices.

    integer(kind=idx_t), intent(in), optional :: options(METIS_NOPTIONS)

    This is the array of options as described in Section 5.4 of the manual. See description for valid options.

    integer(kind=idx_t), intent(out) :: perm(nvtxs)

    Vectors of size nvtxs. Upon successful completion, they store the fill-reducing permutation and inverse-permutation. More in the description.

    integer(kind=idx_t), intent(out) :: iperm(nvtxs)

    Vectors of size nvtxs. Upon successful completion, they store the fill-reducing permutation and inverse-permutation. More in the description.

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_MeshToDual(ne, nn, eptr, eind, ncommon, numflag, xadj, adjncy) result(ierr) bind(C,name="METIS_MeshToDual")

    This function is used to generate the dual graph of a mesh.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: ne

    The number of elements in the mesh.

    integer(kind=idx_t), intent(in) :: nn

    The number of nodes in the mesh.

    integer(kind=idx_t), intent(in), dimension(*):: eptr

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: eind

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in) :: ncommon

    The number of common nodes that two elements must have in order to put an edge between them in the dual graph.

    integer(kind=idx_t), intent(in) :: numflag

    Used to indicate which numbering scheme is used for eptr and eind. The possible values are:
    0 - C-style numbering is assumed that starts from 0
    1 - Fortran-style numbering is assumed that starts from 1

    type(c_ptr), intent(out) :: xadj

    These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

    type(c_ptr), intent(out) :: adjncy

    These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_MeshToNodal(ne, nn, eptr, eind, numflag, xadj, adjncy) result(ierr) bind(C,name="METIS_MeshToNodal")

    This function is used to generate the nodal graph of a mesh.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(in) :: ne

    The number of elements in the mesh.

    integer(kind=idx_t), intent(in) :: nn

    The number of nodes in the mesh.

    integer(kind=idx_t), intent(in), dimension(*):: eptr

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in), dimension(*):: eind

    The pair of arrays storing the mesh as described in Section 5.6 of the manual.

    integer(kind=idx_t), intent(in) :: numflag

    Used to indicate which numbering scheme is used for eptr and eind. The possible values are:
    0 - C-style numbering is assumed that starts from 0
    1 - Fortran-style numbering is assumed that starts from 1

    type(c_ptr), intent(out) :: xadj

    These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

    type(c_ptr), intent(out) :: adjncy

    These arrays store the adjacency structure of the generated dual graph. The format of the adjacency structure is described in Section 5.5 of the manual.

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.
    METIS_ERROR_INPUT - Indicates an input error.
    METIS_ERROR_MEMORY - Indicates that it could not allocate the required memory.
    METIS_ERROR - Indicates some other type of error.

interface

  • public function METIS_SetDefaultOptions(options) result(ierr) bind(C,name="METIS_SetDefaultOptions")

    Initializes the options array into its default values.

    Arguments

    Type IntentOptional AttributesName
    integer(kind=idx_t), intent(out) :: options(METIS_NOPTIONS)

    The array of options that will be initialized.

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.

interface

  • public function METIS_Free(ptr) result(ierr) bind(C,name="METIS_Free")

    Frees the memory that was allocated by either the METIS_MeshToDual or the METIS_MeshToNodal routines for returning the dual or nodal graph of a mesh.

    Arguments

    Type IntentOptional AttributesName
    type(c_ptr), value:: ptr

    The pointer to be freed. This pointer should be one of the xadj or adjncy arrays returned by METIS' API routines.

    Return Value integer(kind=idx_t)

    METIS_OK - Indicates that the function returned normally.