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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.c/] [appendix-a/] [a.15.1.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* { dg-do run } */
2
 
3
#include <stdio.h>
4
 
5
void
6
work (int n)
7
{
8
  printf ("[%d of %d], nested = %d, n = %d\n", omp_get_thread_num (), omp_get_num_threads(), omp_get_nested (), n);
9
}
10
 
11
void
12
sub3 (int n)
13
{
14
  work (n);
15
#pragma omp barrier
16
  work (n);
17
}
18
 
19
void
20
sub2 (int k)
21
{
22
#pragma omp parallel shared(k)
23
  sub3 (k);
24
}
25
 
26
void
27
sub1 (int n)
28
{
29
  int i;
30
#pragma omp parallel private(i) shared(n)
31
  {
32
#pragma omp for
33
    for (i = 0; i < n; i++)
34
      sub2 (i);
35
  }
36
}
37
int
38
main ()
39
{
40
  sub1 (2);
41
  sub2 (15);
42
  sub3 (20);
43
  return 0;
44
}

powered by: WebSVN 2.1.0

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