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
tasking
issue-87307.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <omp.h>
5
6
int
a
;
7
8
void
inc_a
() {
9
#pragma omp task
10
{
11
#pragma omp atomic
12
a
++;
13
}
14
}
15
16
int
main
() {
17
int
n;
18
int
nth_outer;
19
omp_set_max_active_levels
(2);
20
omp_set_dynamic
(0);
21
22
for
(n = 0; n < 200; ++n) {
23
a
= 0;
24
#pragma omp parallel num_threads(8)
25
{
26
if
(omp_get_thread_num() == 0)
27
nth_outer =
omp_get_num_threads
();
28
#pragma omp parallel num_threads(2)
29
{
30
int
i
;
31
#pragma omp master
32
for
(
i
= 0;
i
< 50; ++
i
)
33
inc_a
();
34
}
35
}
36
if
(
a
!= nth_outer * 50) {
37
fprintf(stderr,
"error: a (%d) != %d\n"
,
a
, nth_outer * 50);
38
return
EXIT_FAILURE;
39
}
40
}
41
42
return
EXIT_SUCCESS;
43
}
inc_a
void inc_a()
Definition:
issue-87307.c:8
a
int a
Definition:
issue-87307.c:6
main
int main()
Definition:
issue-87307.c:16
i
#define i
Definition:
kmp_stub.cpp:87
omp_set_max_active_levels
#define omp_set_max_active_levels
Definition:
kmp_stub.cpp:29
omp_set_dynamic
#define omp_set_dynamic
Definition:
kmp_stub.cpp:35
omp_get_num_threads
int omp_get_num_threads()
Generated on Wed Jun 18 2025 02:28:07 for LLVM OpenMP by
1.9.6