reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
// RUN: %libomp-compile && env KMP_ENABLE_TASK_THROTTLING=0 %libomp-run

#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;
}