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_in_parallel.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
/*
6
* Checks that false is returned when called from serial region
7
* and true is returned when called within parallel region.
8
*/
9
int
test_omp_in_parallel
()
10
{
11
int
serial;
12
int
isparallel;
13
14
serial = 1;
15
isparallel = 0;
16
serial = omp_in_parallel();
17
18
#pragma omp parallel
19
{
20
#pragma omp single
21
{
22
isparallel = omp_in_parallel();
23
}
24
}
25
return
(!(serial) && isparallel);
26
}
27
28
int
main
()
29
{
30
int
i
;
31
int
num_failed=0;
32
33
// the test requires more than 1 thread to pass
34
omp_set_dynamic
(0);
// disable dynamic adjustment of threads
35
if
(
omp_get_max_threads
() == 1)
36
omp_set_num_threads
(2);
// set 2 threads if no HW resources available
37
38
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
39
if
(!
test_omp_in_parallel
()) {
40
num_failed++;
41
}
42
}
43
return
num_failed;
44
}
i
#define i
Definition:
kmp_stub.cpp:87
omp_set_num_threads
#define omp_set_num_threads
Definition:
kmp_stub.cpp:34
omp_set_dynamic
#define omp_set_dynamic
Definition:
kmp_stub.cpp:35
main
int main()
Definition:
omp_in_parallel.c:28
test_omp_in_parallel
int test_omp_in_parallel()
Definition:
omp_in_parallel.c:9
omp_testsuite.h
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
omp_get_max_threads
int omp_get_max_threads()
Generated on Fri Jun 6 2025 23:29:16 for LLVM OpenMP by
1.9.6