OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [nested-3.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 273 jeremybenn
#include <omp.h>
2
#include <stdlib.h>
3
#include <string.h>
4
 
5
int
6
main (void)
7
{
8
  int e[3];
9
 
10
  memset (e, '\0', sizeof (e));
11
  omp_set_nested (1);
12
  omp_set_dynamic (0);
13
  if (omp_in_parallel ()
14
      || omp_get_level () != 0
15
      || omp_get_ancestor_thread_num (0) != 0
16
      || omp_get_ancestor_thread_num (-1) != -1
17
      || omp_get_ancestor_thread_num (1) != -1
18
      || omp_get_team_size (0) != 1
19
      || omp_get_team_size (-1) != -1
20
      || omp_get_team_size (1) != -1
21
      || omp_get_active_level () != 0)
22
    abort ();
23
#pragma omp parallel num_threads (4)
24
  {
25
    int tn1 = omp_get_thread_num ();
26
    if (omp_in_parallel () != 1
27
        || omp_get_num_threads () != 4
28
        || tn1 >= 4 || tn1 < 0
29
        || omp_get_level () != 1
30
        || omp_get_ancestor_thread_num (0) != 0
31
        || omp_get_ancestor_thread_num (1) != tn1
32
        || omp_get_ancestor_thread_num (-1) != -1
33
        || omp_get_ancestor_thread_num (2) != -1
34
        || omp_get_team_size (0) != 1
35
        || omp_get_team_size (1) != omp_get_num_threads ()
36
        || omp_get_team_size (-1) != -1
37
        || omp_get_team_size (2) != -1
38
        || omp_get_active_level () != 1)
39
      #pragma omp atomic
40
        e[0] += 1;
41
    #pragma omp parallel if (0) num_threads(5) firstprivate(tn1)
42
    {
43
      int tn2 = omp_get_thread_num ();
44
      if (omp_in_parallel () != 1
45
          || omp_get_num_threads () != 1
46
          || tn2 != 0
47
          || omp_get_level () != 2
48
          || omp_get_ancestor_thread_num (0) != 0
49
          || omp_get_ancestor_thread_num (1) != tn1
50
          || omp_get_ancestor_thread_num (2) != tn2
51
          || omp_get_ancestor_thread_num (-1) != -1
52
          || omp_get_ancestor_thread_num (3) != -1
53
          || omp_get_team_size (0) != 1
54
          || omp_get_team_size (1) != 4
55
          || omp_get_team_size (2) != 1
56
          || omp_get_team_size (-1) != -1
57
          || omp_get_team_size (3) != -1
58
          || omp_get_active_level () != 1)
59
        #pragma omp atomic
60
          e[1] += 1;
61
      #pragma omp parallel num_threads(2) firstprivate(tn1, tn2)
62
      {
63
        int tn3 = omp_get_thread_num ();
64
        if (omp_in_parallel () != 1
65
            || omp_get_num_threads () != 2
66
            || tn3 > 1 || tn3 < 0
67
            || omp_get_level () != 3
68
            || omp_get_ancestor_thread_num (0) != 0
69
            || omp_get_ancestor_thread_num (1) != tn1
70
            || omp_get_ancestor_thread_num (2) != tn2
71
            || omp_get_ancestor_thread_num (3) != tn3
72
            || omp_get_ancestor_thread_num (-1) != -1
73
            || omp_get_ancestor_thread_num (4) != -1
74
            || omp_get_team_size (0) != 1
75
            || omp_get_team_size (1) != 4
76
            || omp_get_team_size (2) != 1
77
            || omp_get_team_size (3) != 2
78
            || omp_get_team_size (-1) != -1
79
            || omp_get_team_size (4) != -1
80
            || omp_get_active_level () != 2)
81
          #pragma omp atomic
82
            e[2] += 1;
83
      }
84
    }
85
  }
86
  if (e[0] || e[1] || e[2])
87
    abort ();
88
  return 0;
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.