[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / tasking / omp50_taskdep_depobj.c
blob3c7912bfe715d6cd99674fb3f56d72c8333d1079
1 // RUN: %clang %openmp_flags %flags-use-compiler-omp-h %s -o %t && %libomp-run
2 // UNSUPPORTED: gcc-5, gcc-6, gcc-7, gcc-8
3 // UNSUPPORTED: clang-5, clang-6, clang-7, clang-8, clang-9, clang-10
4 // UNSUPPORTED: icc
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <omp.h>
9 #include "omp_my_sleep.h"
11 int a, b;
13 void mutexinoutset_task() {
14 if (b != 0) {
15 fprintf(stderr, "mutexinoutset_task: b != 0 at start of task\n");
16 exit(EXIT_FAILURE);
18 b++;
19 if (b != 1) {
20 fprintf(stderr, "mutexinoutset_task: b != 1\n");
21 exit(EXIT_FAILURE);
23 my_sleep(0.1);
24 b--;
25 if (b != 0) {
26 fprintf(stderr, "mutexinoutset_task: b != 0 at end of task\n");
27 exit(EXIT_FAILURE);
31 int main(int argc, char** argv) {
32 omp_depend_t dep_a_in;
33 omp_depend_t dep_a_out;
34 omp_depend_t dep_a_inout;
35 omp_depend_t dep_a_mutexinoutset;
37 a = 0;
38 b = 0;
40 #pragma omp depobj(dep_a_in) depend(in: a)
41 #pragma omp depobj(dep_a_out) depend(out: a)
42 #pragma omp depobj(dep_a_inout) depend(inout: a)
43 #pragma omp depobj(dep_a_mutexinoutset) depend(mutexinoutset: a)
45 #pragma omp parallel
47 #pragma omp single
50 #pragma omp task depend(depobj: dep_a_out)
52 my_sleep(0.1);
53 a = 10;
56 #pragma omp task depend(depobj: dep_a_inout)
58 my_sleep(0.1);
59 a++;
62 #pragma omp task depend(depobj: dep_a_mutexinoutset)
63 mutexinoutset_task();
64 #pragma omp task depend(depobj: dep_a_mutexinoutset)
65 mutexinoutset_task();
66 #pragma omp task depend(depobj: dep_a_mutexinoutset)
67 mutexinoutset_task();
68 #pragma omp task depend(depobj: dep_a_mutexinoutset)
69 mutexinoutset_task();
70 #pragma omp task depend(depobj: dep_a_mutexinoutset)
71 mutexinoutset_task();
73 #pragma omp task depend(depobj: dep_a_in)
74 { a += 10; }
78 if (a != 21) {
79 fprintf(stderr, "a (%d) != 21\n", a);
80 exit(EXIT_FAILURE);
83 #pragma omp depobj(dep_a_in) destroy
84 #pragma omp depobj(dep_a_out) destroy
85 #pragma omp depobj(dep_a_inout) destroy
86 #pragma omp depobj(dep_a_mutexinoutset) destroy
88 return EXIT_SUCCESS;