Skip to main content
`Ctrl`+`K`

# PetscSubcomm

A decomposition of an MPI communicator into subcommunicators

## Synopsis

    typedef struct _n_PetscSubcomm *PetscSubcomm;

## Values

- `PETSC_SUBCOMM_GENERAL` - similar to `MPI_Comm_split()` each process sets the new communicator (color) they will belong to and the order within that communicator

- `PETSC_SUBCOMM_CONTIGUOUS` - each new communicator contains a set of process with contiguous ranks in the original MPI communicator

- `PETSC_SUBCOMM_INTERLACED` - each new communictor contains a set of processes equally far apart in rank from the others in that new communicator

## Sample Usage

           PetscSubcommCreate()
           PetscSubcommSetNumber()
           PetscSubcommSetType(PETSC_SUBCOMM_INTERLACED);
           ccomm = PetscSubcommChild()
           PetscSubcommDestroy()

## Example

Consider a communicator with six processes split into 3 subcommunicators.

       PETSC_SUBCOMM_CONTIGUOUS - the first communicator contains rank 0,1  the second rank 2,3 and the third rank 4,5 in the original ordering of the original communicator
       PETSC_SUBCOMM_INTERLACED - the first communicator contains rank 0,3, the second 1,4 and the third 2,5

## Note

After a call to `PetscSubcommSetType()`, `PetscSubcommSetTypeGeneral()`, or `PetscSubcommSetFromOptions()` one may call

         PetscSubcommChild() returns the associated subcommunicator on this process
         PetscSubcommContiguousParent() returns a parent communitor but with all child of the same subcommunicator having contiguous rank

## Developer Note

This is used in objects such as `PCREDUNDANT` to manage the subcommunicators on which the redundant computations are performed.

## See Also

`PetscSubcommCreate()`, `PetscSubcommSetNumber()`, `PetscSubcommSetType()`, `PetscSubcommView()`, `PetscSubcommSetFromOptions()`

## Level

advanced

## Location

include/petscsystypes.h

## Examples

src/ksp/ksp/tutorials/ex73.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages