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
task_reduction3.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
3
// XFAIL: icc
4
// UNSUPPORTED: clang-4, clang-5, clang-6, clang-7, clang-8, clang-9, clang-10
5
// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8
6
7
#include <stdio.h>
8
#include <stdlib.h>
9
10
int
a
= 0,
b
= 1;
11
12
int
main
(
int
argc,
char
**argv) {
13
14
#pragma omp parallel
15
{
16
#pragma omp sections reduction(task, +: a) reduction(task, *: b)
17
{
18
#pragma omp section
19
{
20
#pragma omp task in_reduction(+: a) in_reduction(*: b)
21
{
22
a
+= 1;
23
b
*= 1;
24
}
25
}
26
#pragma omp section
27
{
28
#pragma omp task in_reduction(+: a) in_reduction(*: b)
29
{
30
a
+= 2;
31
b
*= 2;
32
}
33
}
34
#pragma omp section
35
{
36
#pragma omp task in_reduction(+: a) in_reduction(*: b)
37
{
38
a
+= 3;
39
b
*= 3;
40
}
41
}
42
#pragma omp section
43
{
44
#pragma omp task in_reduction(+: a) in_reduction(*: b)
45
{
46
a
+= 4;
47
b
*= 4;
48
}
49
}
50
#pragma omp section
51
{
52
#pragma omp task in_reduction(+: a) in_reduction(*: b)
53
{
54
a
+= 5;
55
b
*= 5;
56
}
57
}
58
}
59
}
60
61
if
(
a
!= 15) {
62
fprintf(stderr,
"error: a != 15. Instead a = %d\n"
,
a
);
63
exit(EXIT_FAILURE);
64
}
65
if
(
b
!= 120) {
66
fprintf(stderr,
"error: b != 120. Instead b = %d\n"
,
b
);
67
exit(EXIT_FAILURE);
68
}
69
70
return
EXIT_SUCCESS;
71
}
b
int b
Definition:
task_reduction3.c:10
a
int a
Definition:
task_reduction3.c:10
main
int main()
Definition:
test-touch.c:21
Generated on Tue Jun 10 2025 14:23:50 for LLVM OpenMP by
1.9.6