Sha256: 2e43b776f57fbbd3c34a2fb5b74d2cb06dad20186d686d3460eb7de5de24cf64

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

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...........chunk/example07.c
// Author.............Cedric Nugteren
// Last modified on...07-May-2013
//

#include <stdio.h>

// This is 'example07', a chunk/chunk with a step of 2
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 scop
	{
		#pragma species kernel A[2:N-1]|chunk(0:1) -> B[2:N-1]|chunk(0:1)
		for (i = 2; i < N - 1; i = i + 2) {
			temp = 0;
			for (j = 0; j < 2; j++) {
				temp += A[i + j];
			}
			B[i] = temp;
			B[i + 1] = temp;
		}
		#pragma species endkernel example07_k1
	}
	#pragma endscop
	
	// 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 test/examples/chunk/example07_species.c