examples/neighbourhood/example03.c in bones-compiler-1.3.1 vs examples/neighbourhood/example03.c in bones-compiler-1.6.0

- old
+ new

@@ -6,13 +6,13 @@ // == More information on Bones // Contact............Cedric Nugteren <c.nugteren@tue.nl> // Web address........http://parse.ele.tue.nl/bones/ // // == File information -// Filename...........neighbourhood/example3.c +// Filename...........neighbourhood/example03.c // Author.............Cedric Nugteren -// Last modified on...16-April-2012 +// Last modified on...10-October-2014 // #include <stdio.h> #include <stdlib.h> #include <math.h> @@ -21,11 +21,11 @@ // Forward declarations of helper functions for statically allocated 2D memory float ** alloc_2D(int size1, int size2); void free_2D(float ** array_2D); -// This is 'example3', demonstrating a neighbourhood with only some values used (a cross) and a math.h square root function call +// This is 'example03', demonstrating a neighbourhood with only some values used (a cross) and a math.h square root function call int main(void) { int i,j; int sizea = A; int sizeb = B; @@ -39,11 +39,12 @@ in[i][j] = i+j; } } // Perform the computation - #pragma species kernel 0:sizea-1,0:sizeb-1|neighbourhood(-1:1,-1:1) -> 0:sizea-1,0:sizeb-1|element + #pragma scop + #pragma species kernel in[0:sizea-1,0:sizeb-1]|neighbourhood(-1:1,-1:1) -> out[0:sizea-1,0:sizeb-1]|element for(i=0;i<sizea;i++) { for(j=0;j<sizeb;j++) { if (i >= 1 && j >= 1 && i < (sizea-1) && j < (sizeb-1)) { out[i][j] = in[i+1][ j ] + in[ i ][j+1] + in[ i ][ j ] + in[ i ][j-1] + @@ -53,9 +54,10 @@ out[i][j] = sqrt(in[i][j]); } } } #pragma species endkernel example3 + #pragma endscop // Clean-up and exit the function free_2D(in); free_2D(out); fflush(stdout);