PetscSequentialPhaseBegin — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscSequentialPhaseBegin

Begins a sequential section of code.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm comm, int ng)

Collective

## Input Parameters

- comm - Communicator to sequentialize over

- ng - Number in processor group. This many processes are allowed to execute at the same time (usually 1)

## Notes

`PetscSequentialPhaseBegin()` and `PetscSequentialPhaseEnd()` provide a way to force a section of code to be executed by the processes in rank order. Typically, this is done with

          PetscSequentialPhaseBegin(comm, 1);
          <code to be executed sequentially>
          PetscSequentialPhaseEnd(comm, 1);

You should use `PetscSynchronizedPrintf()` to ensure output between MPI ranks is properly order and not these routines.

## See Also

`PetscSequentialPhaseEnd()`, `PetscSynchronizedPrintf()`

## Level

intermediate

## Location

src/sys/utils/mpiu.c

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