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
taskdep_if0.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
3
#include <stdio.h>
4
#include <stdlib.h>
5
#include <omp.h>
6
#include "
omp_my_sleep.h
"
7
8
int
a
= 0;
9
10
void
task1
() {
11
my_sleep
(0.5);
12
a
= 10;
13
}
14
15
void
task2
() {
16
a
++;
17
}
18
19
int
main
(
int
argc,
char
** argv)
20
{
21
#pragma omp parallel shared(argc) num_threads(2)
22
{
23
#pragma omp single
24
{
25
#pragma omp task depend(out: a)
26
task1
();
27
28
#pragma omp task if(0) depend(inout: a)
29
task2
();
30
}
31
}
32
if
(
a
!= 11) {
33
fprintf(stderr,
"fail: expected 11, but a is %d\n"
,
a
);
34
exit(1);
35
}
else
{
36
printf(
"pass\n"
);
37
}
38
return
0;
39
}
omp_my_sleep.h
my_sleep
static void my_sleep(double sleeptime)
Utility function to have a sleep function with better resolution and which only stops one thread.
Definition:
omp_my_sleep.h:24
a
int a
Definition:
taskdep_if0.c:8
task2
void task2()
Definition:
taskdep_if0.c:15
task1
void task1()
Definition:
taskdep_if0.c:10
main
int main()
Definition:
test-touch.c:21
Generated on Thu Jun 5 2025 04:45:57 for LLVM OpenMP by
1.9.6