examples/neighbourhood/example01.c in bones-compiler-1.3.1 vs examples/neighbourhood/example01.c in bones-compiler-1.6.0
- old
+ new
@@ -6,20 +6,20 @@
// == More information on Bones
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
// Web address........http://parse.ele.tue.nl/bones/
//
// == File information
-// Filename...........neighbourhood/example1.c
+// Filename...........neighbourhood/example01.c
// Author.............Cedric Nugteren
-// Last modified on...16-April-2012
+// Last modified on...10-October-2014
//
#include <stdio.h>
#define SIZE 60000
#define NB 2
-// This is 'example1', demonstrating a basic 1D neighbourhood-based computation whose size is set by a define
+// This is 'example01', demonstrating a basic 1D neighbourhood-based computation whose size is set by a define
int main(void) {
int i,n;
float result = 0;
// Declare input/output arrays
@@ -30,11 +30,12 @@
for(i=0;i<SIZE;i++) {
A[i] = i/2.0;
}
// Perform the computation
- #pragma species kernel 0:SIZE-1|neighbourhood(-NB:NB) -> 0:SIZE-1|element
+ #pragma scop
+ #pragma species kernel A[0:SIZE-1]|neighbourhood(-NB:NB) -> B[0:SIZE-1]|element
for(i=0;i<SIZE;i++) {
if (i >= NB && i < SIZE-NB) {
result = 0;
for (n=-NB;n<=NB;n++) {
result = result + A[i+n];
@@ -44,9 +45,10 @@
else {
B[i] = A[i];
}
}
#pragma species endkernel example1
+ #pragma endscop
// Clean-up and exit the function
fflush(stdout);
return 0;
}