Sha256: c7d69502a70da047a0869430b9f489aee4ca6a3318215219423aa07feb6c9f3c
Contents?: true
Size: 1.13 KB
Versions: 2
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...........element/example4.c // Author.............Cedric Nugteren // Last modified on...16-April-2012 // #include <stdio.h> // This is 'example4', demonstrating two input arrays and an inner-loop as the computational body int main(void) { int i,l; float factor = 0; // Declare input/output arrays float A[700]; float B[700]; float C[700]; // Set the input data for(i=0;i<700;i++) { A[i] = i*2.3; B[i] = i+6.0; } // Perform the computation #pragma species kernel 0:699|element ^ 0:699|element -> 0:699|element for(i=0;i<700;i++) { factor = 0.5; for (l=0;l<3;l++) { factor = factor + 0.2*factor; } C[i] = factor*A[i] + factor*B[i]; } #pragma species endkernel example4 // 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/example04.c |
bones-compiler-1.1.0 | examples/element/example4.c |