[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / worksharing / for / omp_for_collapse.c
bloba08086dccefb49792c1d75f4029a4c173659d1a7
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include <math.h>
4 #include "omp_testsuite.h"
6 /* Utility function to check that i is increasing monotonically
7 with each call */
8 static int check_i_islarger (int i)
10 static int last_i;
11 int islarger;
12 if (i==1)
13 last_i=0;
14 islarger = ((i >= last_i)&&(i - last_i<=1));
15 last_i = i;
16 return (islarger);
19 int test_omp_for_collapse()
21 int is_larger = 1;
23 #pragma omp parallel
25 int i,j;
26 int my_islarger = 1;
27 #pragma omp for private(i,j) schedule(static,1) collapse(2) ordered
28 for (i = 1; i < 100; i++) {
29 for (j =1; j <100; j++) {
30 #pragma omp ordered
31 my_islarger = check_i_islarger(i)&&my_islarger;
34 #pragma omp critical
35 is_larger = is_larger && my_islarger;
37 return (is_larger);
40 int main()
42 int i;
43 int num_failed=0;
45 for(i = 0; i < REPETITIONS; i++) {
46 if(!test_omp_for_collapse()) {
47 num_failed++;
50 return num_failed;