examples/chunk/example04.c in bones-compiler-1.3.1 vs examples/chunk/example04.c in bones-compiler-1.6.0

- old
+ new

@@ -6,19 +6,19 @@ // == More information on Bones // Contact............Cedric Nugteren <c.nugteren@tue.nl> // Web address........http://parse.ele.tue.nl/bones/ // // == File information -// Filename...........chunk/example4.c +// Filename...........chunk/example04.c // Author.............Cedric Nugteren -// Last modified on...16-April-2012 +// Last modified on...10-October-2014 // #include <stdio.h> #define SIZE 1024 -// This is 'example4', a basic element to chunk example with an if-statement in the body +// This is 'example04', a basic element to chunk example with an if-statement in the body int main(void) { int i; int threshold = 19; // Declare input/output arrays @@ -34,20 +34,23 @@ for(i=0;i<SIZE*2;i++) { B[i] = 0; } // Perform the computation - #pragma species kernel 0:SIZE-1|element -> 0:SIZE*2-1|chunk(0:1) + #pragma scop + #pragma species kernel A[0:SIZE-1]|element -> B[0:SIZE*2-1]|chunk(0:1) for(i=0;i<SIZE;i++) { + float a = A[i]; B[i*2] = A[i]; - if (A[i] > threshold) { + if (a > threshold) { B[i*2+1] = A[i]; } else { B[i*2+1] = 0; } } #pragma species endkernel example4 + #pragma endscop // Clean-up and exit the function fflush(stdout); return 0; }