LLVM OpenMP
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
c
d
e
g
h
i
m
n
p
r
s
t
u
Functions
c
d
e
g
i
m
n
p
r
s
u
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
i
k
l
m
n
o
p
r
t
u
Enumerations
_
b
c
d
f
k
l
n
o
s
t
Enumerator
_
a
b
c
d
e
f
k
l
n
o
p
r
s
t
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
runtime
test
api
omp_get_num_threads.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
#include <stdio.h>
3
#include "
omp_testsuite.h
"
4
5
int
test_omp_get_num_threads
()
6
{
7
/* checks that omp_get_num_threads is equal to the number of
8
threads */
9
int
nthreads_lib;
10
int
nthreads = 0;
11
12
nthreads_lib = -1;
13
14
#pragma omp parallel
15
{
16
#pragma omp critical
17
{
18
nthreads++;
19
}
/* end of critical */
20
#pragma omp single
21
{
22
nthreads_lib =
omp_get_num_threads
();
23
}
/* end of single */
24
}
/* end of parallel */
25
return
(nthreads == nthreads_lib);
26
}
27
28
int
main
()
29
{
30
int
i
;
31
int
num_failed=0;
32
33
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
34
if
(!
test_omp_get_num_threads
()) {
35
num_failed++;
36
}
37
}
38
return
num_failed;
39
}
i
#define i
Definition:
kmp_stub.cpp:87
test_omp_get_num_threads
int test_omp_get_num_threads()
Definition:
omp_get_num_threads.c:5
main
int main()
Definition:
omp_get_num_threads.c:28
omp_testsuite.h
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
omp_get_num_threads
int omp_get_num_threads()
Generated on Wed Jul 9 2025 12:38:31 for LLVM OpenMP by
1.9.6