Sha256: a316884c762d2fe71aac811d0604d97038c92e893cc03480f7a19cb73e8bbae8
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 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...........shared/example2.c // Author.............Cedric Nugteren // Last modified on...09-May-2012 // #include <stdio.h> // This is 'example2', demonstrating a 3D input reduction to scalar int main(void) { int a,b,c; // Declare input/output arrays float in[8][16][32]; float out[1]; // Set the input data for(a=0;a<8;a++) { for(b=0;b<16;b++) { for(c=0;c<32;c++) { in[a][b][c] = 1; } } } // Perform the computation out[0] = 0; #pragma scop { #pragma species kernel out[0:0]|full ^ in[0:7,0:15,0:31]|element -> out[0:0]|shared for (a = 0; a < 8; a++) { for (b = 0; b < 16; b++) { for (c = 0; c < 32; c++) { out[0] = out[0] + in[a][b][c]; } } } #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/shared/example02_species.c |