source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/jacobiinitialize-orig-no.c@ af3b8e4

1.23 2.0 main test-branch
Last change on this file since af3b8e4 was 36a61f3, checked in by Ziqing Luo <ziqing@…>, 9 years ago

Commit DataRaceBench into CIVL examples

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@4225 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 797 bytes
Line 
1// using of private() clause
2
3#include <stdio.h>
4#include <math.h>
5
6#define MSIZE 200
7int n=MSIZE, m=MSIZE;
8double alpha = 0.0543;
9double u[MSIZE][MSIZE], f[MSIZE][MSIZE], uold[MSIZE][MSIZE];
10double dx, dy;
11
12void
13initialize ()
14{
15 int i, j, xx, yy;
16
17 dx = 2.0 / (n - 1); // -->dx@112:2
18 dy = 2.0 / (m - 1); //-->dy@113:2
19
20 /* Initialize initial condition and RHS */
21#pragma omp parallel for private(i,j,xx,yy)
22 for (i = 0; i < n; i++)
23 for (j = 0; j < m; j++)
24 {
25 xx = (int) (-1.0 + dx * (i - 1)); /* -1 < x < 1 */
26 yy = (int) (-1.0 + dy * (j - 1)); /* -1 < y < 1 */
27 u[i][j] = 0.0;
28 f[i][j] = -1.0 * alpha * (1.0 - xx * xx) * (1.0 - yy * yy)
29 - 2.0 * (1.0 - xx * xx) - 2.0 * (1.0 - yy * yy);
30
31 }
32}
33
34int main()
35{
36 initialize();
37 return 0;
38}
Note: See TracBrowser for help on using the repository browser.