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
for
omp_parallel_for_private.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
#include <stdio.h>
3
#include <math.h>
4
#include "
omp_testsuite.h
"
5
6
/*! Utility function to spend some time in a loop */
7
static
void
do_some_work
(
void
)
8
{
9
int
i
;
10
double
sum
= 0;
11
for
(
i
= 0;
i
< 1000;
i
++){
12
sum
+= sqrt (
i
);
13
}
14
}
15
16
int
test_omp_parallel_for_private
()
17
{
18
int
sum
;
19
int
i
;
20
int
i2;
21
int
known_sum;
22
23
sum
=0;
24
i2=0;
25
26
#pragma omp parallel for reduction(+:sum) schedule(static,1) private(i) private(i2)
27
for
(
i
=1;
i
<=
LOOPCOUNT
;
i
++)
28
{
29
i2 =
i
;
30
#pragma omp flush
31
do_some_work
();
32
#pragma omp flush
33
sum
=
sum
+ i2;
34
}
/*end of for*/
35
known_sum = (
LOOPCOUNT
* (
LOOPCOUNT
+ 1)) / 2;
36
return
(known_sum ==
sum
);
37
}
/* end of check_parallel_for_private */
38
39
int
main
()
40
{
41
int
i
;
42
int
num_failed=0;
43
44
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
45
if
(!
test_omp_parallel_for_private
()) {
46
num_failed++;
47
}
48
}
49
return
num_failed;
50
}
i
#define i
Definition:
kmp_stub.cpp:87
sum
int sum
Definition:
omp_for_schedule_runtime.c:19
test_omp_parallel_for_private
int test_omp_parallel_for_private()
Definition:
omp_parallel_for_private.c:16
do_some_work
static void do_some_work(void)
Utility function to spend some time in a loop.
Definition:
omp_parallel_for_private.c:7
main
int main()
Definition:
omp_parallel_for_private.c:39
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