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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [gomp/] [appendix-a/] [a.12.1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
 
3
#include <stdio.h>
4
extern float average (float, float, float);
5
void
6
a12 (float *x, float *xold, int n, float tol)
7
{
8
  int c, i, toobig;
9
  float error, y;
10
  c = 0;
11
#pragma omp parallel
12
  {
13
    do
14
      {
15
#pragma omp for private(i)
16
        for (i = 1; i < n - 1; ++i)
17
          {
18
            xold[i] = x[i];
19
          }
20
#pragma omp single
21
        {
22
          toobig = 0;
23
        }
24
#pragma omp for private(i,y,error) reduction(+:toobig)
25
        for (i = 1; i < n - 1; ++i)
26
          {
27
            y = x[i];
28
            x[i] = average (xold[i - 1], x[i], xold[i + 1]);
29
            error = y - x[i];
30
            if (error > tol || error < -tol)
31
              ++toobig;
32
          }
33
#pragma omp master
34
        {
35
          ++c;
36
          printf ("iteration %d, toobig=%d\n", c, toobig);
37
        }
38
      }
39
    while (toobig > 0);
40
  }
41
}

powered by: WebSVN 2.1.0

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