Sha256: bb69091990e1dd6f563cc471833e1c2cd423a2cff273c0f28a2a3786623d512e

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

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

#include <stdio.h>

// This is 'example11', demonstrating an inner-loop which is dependent on an outer-loop variable and a classification of the inner-loop only
int main(void) {
	int i,j;
	
	// Declare input/output arrays
	int A[128][128];
	int B[128][128];
	
	// Set the input data
	for(i=0;i<128;i++) {
		for(j=0;j<128;j++) {
			A[i][j] = i+j;
			B[i][j] = 999;
		}
	}
	
	// Perform the computation
	for(i=0;i<128;i++) {
		#pragma species kernel i:i,i:127|element -> i:i,i:127|element
		for(j=i;j<128;j++) {
			B[i][j] = 2*A[i][j];
		}
		#pragma species endkernel example11
	}
	
	// Clean-up and exit the function
	fflush(stdout);
	return 0;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bones-compiler-1.3.1 examples/element/example11.c
bones-compiler-1.1.0 examples/element/example11.c