brintos

brintos / llvm-project-archived public Read only

0
0
Text · 626 B · fc54051 Raw
34 lines · c
1// RUN: %libomp-compile && env OMP_MAX_TASK_PRIORITY=42 %libomp-run2 3#include <stdio.h>4#include <stdlib.h>5#include <omp.h>6 7int a = 0;8 9int main(void) {10  int i;11  int max_task_priority = omp_get_max_task_priority();12  if (max_task_priority != 42) {13    fprintf(stderr,14            "error: omp_get_max_task_priority() returned %d instead of 42\n",15            max_task_priority);16    exit(EXIT_FAILURE);17  }18 19  for (i = 0; i < 250; ++i) {20    #pragma omp parallel21    {22      #pragma omp task priority(42)23      {24        #pragma omp atomic25        a++;26      }27    }28  }29 30  printf("a = %d\n", a);31 32  return EXIT_SUCCESS;33}34