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.
6 .. _omp_get_num_threads:
8 omp_get_num_threads -- Size of the active team
9 **********************************************
12 Returns the number of threads in the current team. In a sequential section of
13 the program ``omp_get_num_threads`` returns 1.
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.
26 - ``int omp_get_num_threads(void);``
32 - ``integer function omp_get_num_threads()``
35 :ref:`omp_get_max_threads`, :ref:`omp_set_num_threads`, :ref:`OMP_NUM_THREADS`
38 :openmp:`4.5`, Section 3.2.2.