# PetscOmpCtrlCreate
create a PETSc OpenMP controller, which manages PETSc's interaction with third party libraries that use OpenMP 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscOmpCtrlCreate(MPI_Comm petsc_comm, PetscInt nthreads, PetscOmpCtrl *pctrl)
```

## Input Parameters

- ***petsc_comm -*** a communicator some PETSc object (for example, a matrix) lives in
- ***nthreads   -*** number of threads per MPI rank to spawn in a library using OpenMP. If nthreads = -1, let PETSc decide a suitable value



## Output Parameter

- ***pctrl      -*** a PETSc OpenMP controller





## Developer Note
Possibly use the variable `PetscNumOMPThreads` to determine the number for threads to use


## See Also
 `PetscOmpCtrlDestroy()`, `PetscOmpCtrlGetOmpComms()`, `PetscOmpCtrlBarrier()`, `PetscOmpCtrlOmpRegionOnMasterBegin()`, `PetscOmpCtrlOmpRegionOnMasterEnd()`,

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/utils/mpishm.c.html#PetscOmpCtrlCreate">src/sys/utils/mpishm.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/utils/mpishm.c)


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