summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test/tasking/omp_task_depend_resize_hashmap.c
blob: 971f8c0126b0c54c4d1f1ca7d3b1f90656629b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// RUN: %libomp-compile && env KMP_ENABLE_TASK_THROTTLING=0 %libomp-run

// This test is known to be fragile on NetBSD kernel at the moment,
// https://bugs.llvm.org/show_bug.cgi?id=42020.
// UNSUPPORTED: netbsd
#include<omp.h>
#include<stdlib.h>
#include<string.h>

// The first hashtable static size is 997
#define NUM_DEPS 4000


int main()
{
  int *deps = calloc(NUM_DEPS, sizeof(int));
  int i;
  int failed = 0;

  #pragma omp parallel
  #pragma omp master
  {
    for (i = 0; i < NUM_DEPS; i++) {
      #pragma omp task firstprivate(i) depend(inout: deps[i])
      {
        deps[i] = 1;
      }
      #pragma omp task firstprivate(i) depend(inout: deps[i])
      {
        deps[i] = 2;
      }
    }
  }

  for (i = 0; i < NUM_DEPS; i++) {
    if (deps[i] != 2)
      failed++;
  }

  return failed;
}
OpenPOWER on IntegriCloud