Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / thread_state_1.c
blob908b71638097fa834e75fca95164a5c027109631
1 // RUN: %libomptarget-compile-run-and-check-generic
2 // RUN: %libomptarget-compileopt-run-and-check-generic
4 #include <omp.h>
5 #include <stdio.h>
7 int main() {
8 // TODO: Test all ICVs on all levels
9 int o_lvl = 111, i_lvl = 222, o_tid = 333, i_tid = 333, o_nt = 444,
10 i_nt = 555;
11 #pragma omp target teams map(tofrom : o_lvl, i_lvl, o_tid, i_tid, o_nt, i_nt) \
12 num_teams(2) thread_limit(64)
14 if (omp_get_team_num() == 0) {
15 #pragma omp parallel num_threads(64)
16 if (omp_get_thread_num() == omp_get_num_threads() - 1) {
17 o_lvl = omp_get_level();
18 o_tid = omp_get_thread_num();
19 o_nt = omp_get_num_threads();
20 #pragma omp parallel num_threads(64)
21 if (omp_get_thread_num() == omp_get_num_threads() - 1) {
22 i_lvl = omp_get_level();
23 i_tid = omp_get_thread_num();
24 i_nt = omp_get_num_threads();
29 if (o_lvl == 1 && o_tid == o_nt - 1 && o_nt >= 1 && i_lvl == 2 &&
30 i_tid == 0 && i_nt == 1) {
31 // CHECK: Success
32 printf("Success\n");
33 return 0;
35 printf("outer: lvl: %i, tid: %i, nt: %i\n", o_lvl, o_tid, o_nt);
36 printf("inner: lvl: %i, tid: %i, nt: %i\n", i_lvl, i_tid, i_nt);
37 return 1;