LLVM OpenMP
20.0.0git
runtime
test
tasking
nested_parallel_tasking.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
#include <stdio.h>
3
#include <omp.h>
4
5
/*
6
* This test would hang when level instead of active level
7
* used to push task state.
8
*/
9
10
int
main
()
11
{
12
// If num_threads is changed to a value greater than 1, then the test passes
13
#pragma omp parallel num_threads(1)
14
{
15
#pragma omp parallel
16
printf(
"Hello World from thread %d\n"
, omp_get_thread_num());
17
}
18
19
printf(
"omp_num_threads: %d\n"
,
omp_get_max_threads
());
20
21
#pragma omp parallel
22
{
23
#pragma omp master
24
#pragma omp task default(none)
25
{
26
printf(
"%d is executing this task\n"
, omp_get_thread_num());
27
}
28
}
29
30
printf(
"pass\n"
);
31
return
0;
32
}
main
int main()
Definition:
nested_parallel_tasking.c:10
omp_get_max_threads
int omp_get_max_threads()
Generated on Wed Jan 29 2025 20:58:02 for LLVM OpenMP by
1.9.6