Sha256: 25612bb82390fd5a57294da9183d914244c22cdba5bb8766cb9bd5f30d822af6

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 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/example2.c
// Author.............Cedric Nugteren
// Last modified on...16-April-2012
//

#include <stdio.h>
#define SIZE 2048
#define HALFSIZE (SIZE/2)

// This is 'example2', demonstrating a chunk-example without an inner-loop, everything is unrolled manually
int main(void) {
	int i;
	
	// Declare input/output arrays
	float A[SIZE];
	float B[HALFSIZE];
	
	// Set the input data
	for(i=0;i<SIZE;i++) {
		A[i] = i%6+i;
	}
	
	// Perform the computation
	#pragma scop
	{
		#pragma species kernel A[0:2*HALFSIZE-1]|chunk(0:1) -> B[0:HALFSIZE-1]|element
		for (i = 0; i < HALFSIZE; i++) {
			B[i] = A[i * 2] + A[i * 2 + 1];
		}
		#pragma species endkernel example02_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/example02_species.c