:orphan:
# PetscViewerASCIISynchronizedPrintf
Prints synchronized output to the specified `PETSCVIEWERASCII` file from several processors.  Output of the first processor is followed by that of the second, etc. 
## Synopsis
```
#include "petscviewer.h" 
PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer viewer, const char format[], ...)
```
Not Collective, must call collective `PetscViewerFlush()` to get the results flushed


## Input Parameters

- ***viewer -*** the `PETSCVIEWERASCII` `PetscViewer`
- ***format -*** the usual printf() format string





## Notes
You must have previously called `PetscViewerASCIIPushSynchronized()` to allow this routine to be called.
Then you can do multiple independent calls to this routine.

The actual synchronized print is then done using `PetscViewerFlush()`.
`PetscViewerASCIIPopSynchronized()` should be then called if we are already done with the synchronized output
to conclude the "synchronized session".

So the typical calling sequence looks like
```none
    PetscViewerASCIIPushSynchronized(viewer);
    PetscViewerASCIISynchronizedPrintf(viewer, ...);
    PetscViewerASCIISynchronizedPrintf(viewer, ...);
    ...
    PetscViewerFlush(viewer);
    PetscViewerASCIISynchronizedPrintf(viewer, ...);
    PetscViewerASCIISynchronizedPrintf(viewer, ...);
    ...
    PetscViewerFlush(viewer);
   PetscViewerASCIIPopSynchronized(viewer);
```



## Fortran Note
Can only print a single character* string


## See Also
 [](sec_viewers), `PetscViewerASCIIPushSynchronized()`, `PetscViewerFlush()`, `PetscViewerASCIIPopSynchronized()`,
`PetscSynchronizedPrintf()`, `PetscViewerASCIIPrintf()`, `PetscViewerASCIIOpen()`,
`PetscViewerCreate()`, `PetscViewerDestroy()`, `PetscViewerSetType()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/ascii/filev.c.html#PetscViewerASCIISynchronizedPrintf">src/sys/classes/viewer/impls/ascii/filev.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/swarm_ex1.c.html">src/dm/tutorials/swarm_ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1.c.html">src/vec/is/sf/tutorials/ex1.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/ascii/filev.c)


[Index of all Viewer routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
