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
worksharing
single
omp_single_private.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
myit
= 0;
6
#pragma omp threadprivate(myit)
7
int
myresult
= 0;
8
#pragma omp threadprivate(myresult)
9
10
int
test_omp_single_private
()
11
{
12
int
nr_threads_in_single;
13
int
result
;
14
int
nr_iterations;
15
int
i
;
16
17
myit
= 0;
18
nr_threads_in_single = 0;
19
nr_iterations = 0;
20
result
= 0;
21
22
#pragma omp parallel private(i)
23
{
24
myresult
= 0;
25
myit
= 0;
26
for
(
i
= 0;
i
<
LOOPCOUNT
;
i
++) {
27
#pragma omp single private(nr_threads_in_single) nowait
28
{
29
nr_threads_in_single = 0;
30
#pragma omp flush
31
nr_threads_in_single++;
32
#pragma omp flush
33
myit
++;
34
myresult
=
myresult
+ nr_threads_in_single;
35
}
36
}
37
#pragma omp critical
38
{
39
result
+= nr_threads_in_single;
40
nr_iterations +=
myit
;
41
}
42
}
43
return
((
result
== 0) && (nr_iterations ==
LOOPCOUNT
));
44
}
/* end of check_single private */
45
46
int
main
()
47
{
48
int
i
;
49
int
num_failed=0;
50
51
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
52
if
(!
test_omp_single_private
()) {
53
num_failed++;
54
}
55
}
56
return
num_failed;
57
}
result
int result[2]
Definition:
cancellation_for_sections.c:13
i
#define i
Definition:
kmp_stub.cpp:87
myresult
int myresult
Definition:
omp_single_private.c:7
myit
int myit
Definition:
omp_single_private.c:5
main
int main()
Definition:
omp_single_private.c:46
test_omp_single_private
int test_omp_single_private()
Definition:
omp_single_private.c:10
omp_testsuite.h
LOOPCOUNT
#define LOOPCOUNT
Definition:
omp_testsuite.h:12
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Sun Jun 8 2025 18:26:08 for LLVM OpenMP by
1.9.6