Skip to content

Commit 800734e

Browse files
committed
Add 1-d Jacobi stencil perfect nest example with time dimension in array
1 parent 65e79a3 commit 800734e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/jacobi-1d.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#define N 1000
2+
#define T 1000
3+
4+
#include <stdio.h>
5+
6+
int main() {
7+
unsigned t, i;
8+
double A[T][N];
9+
#pragma scop
10+
for (t = 1; t < T; t++) {
11+
for (i = 1; i < N - 1; i++) {
12+
A[t][i] = A[t - 1][i - 1] + A[t - 1][i] + A[t - 1][i + 1];
13+
}
14+
}
15+
#pragma endscop
16+
printf("%lf\n", A[T-1][0]);
17+
return 0;
18+
}

0 commit comments

Comments
 (0)