]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/doc/openmp-runtime-library-routines/ompgetnumthreads.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / libgomp / doc / openmp-runtime-library-routines / ompgetnumthreads.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. _omp_get_num_threads:
7
8omp_get_num_threads -- Size of the active team
9**********************************************
10
11Description:
12 Returns the number of threads in the current team. In a sequential section of
13 the program ``omp_get_num_threads`` returns 1.
14
15 The default team size may be initialized at startup by the
16 :envvar:`OMP_NUM_THREADS` environment variable. At runtime, the size
17 of the current team may be set either by the ``NUM_THREADS``
18 clause or by ``omp_set_num_threads``. If none of the above were
19 used to define a specific value and :envvar:`OMP_DYNAMIC` is disabled,
20 one thread per CPU online is used.
21
22C/C++:
23 .. list-table::
24
25 * - *Prototype*:
26 - ``int omp_get_num_threads(void);``
27
28Fortran:
29 .. list-table::
30
31 * - *Interface*:
32 - ``integer function omp_get_num_threads()``
33
34See also:
35 :ref:`omp_get_max_threads`, :ref:`omp_set_num_threads`, :ref:`OMP_NUM_THREADS`
36
37Reference:
3ed1b4ce 38 :openmp:`4.5`, Section 3.2.2.