Skip to main content
`Ctrl`+`K`

# PetscBLASSetNumThreads

set the number of threads for calls to BLAS to use

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscBLASSetNumThreads(PetscInt nt)

## Input Parameter

- nt - the number of threads

## Options Database Key

- -blas_num_threads nt - set the number of threads when PETSc is initialized

## Notes

The environmental variables `BLIS_NUM_THREADS`, `MKL_NUM_THREADS`, or `OPENBLAS_NUM_THREADS`, `OMP_NUM_THREADS` may also affect the number of threads used depending on the BLAS libraries being used. A call to this function overwrites those values.

With the BLIS BLAS implementation one can use `BLIS_THREAD_IMPL=pthread` or `BLIS_THREAD_IMPL=openmp` to determine how BLIS implements the parallelism.

## See Also

`PetscInitialize()`, `PetscBLASGetNumThreads()`

## Level

intermediate

## Location

src/sys/objects/version.c

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