Sha256: 0b3f8c06cb8cd8f61b0abab7c8bf5292120751ef579c8fac3072319a1256adee

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

//
// This file is part of the Bones source-to-source compiler examples. This C-code
// example is meant to illustrate the use of Bones. For more information on Bones
// use the contact information below.
//
// == More information on Bones
// Contact............Cedric Nugteren <c.nugteren@tue.nl>
// Web address........http://parse.ele.tue.nl/bones/
//
// == File information
// Filename...........neighbourhood/example05.c
// Author.............Cedric Nugteren
// Last modified on...07-May-2013
//

#include <stdio.h>

// This is 'example05', an unrolled one-sided neighbourhood
int main(void) {
	int i;
	int N = 256;
	
	// Declare input/output arrays
	int A[N];
	int B[N];
	
	// Set the input data
	for(i=0;i<N;i++) {
		A[i] = i;
		B[i] = i+5;
	}
	
	// Perform the computation
	#pragma species kernel A[2:N]|neighbourhood(0:1) -> B[2:N-1]|element
	for (i=2; i<N; i++) {
		B[i] = A[i] + A[i+1];
	}
	#pragma species endkernel example05
	
	// Clean-up and exit the function
	fflush(stdout);
	return 0;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bones-compiler-1.3.1 examples/neighbourhood/example05.c