source: CIVL/examples/translation/openclversion2.1/openSimp.cvl@ 1acabb5

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 1acabb5 was 1acabb5, checked in by Jacob Trieu <fuufusuu@…>, 12 years ago

How much simpler can it get?

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1234 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 532 bytes
RevLine 
[da70bc2]1#include <civlc.h>
[1acabb5]2void square(int global_id, float input[], float output[], int count)
[da70bc2]3{
4 int i = global_id;
5 if (i < count)
6 {
7 output[i] = input[i] * input[i];
8 }
9}
[1acabb5]10int main(int argc, char** argv)
[da70bc2]11{
[1acabb5]12 int global = 4;
13
14 float input[global];
15 float output[global];
16
17 for(int i = 0; i < global; i++)
[da70bc2]18 {
[1acabb5]19 input[i] = i;
[da70bc2]20 }
21
[1acabb5]22 $proc procs[global];
23 for(int i = 0; i < global; i++)
[da70bc2]24 {
[1acabb5]25 procs[i] = $spawn square(i, input, output, global);
[da70bc2]26 }
27
[1acabb5]28 for(int i = 0; i < global; i++)
[da70bc2]29 {
[1acabb5]30 $wait(procs[i]);
[da70bc2]31 }
32}
Note: See TracBrowser for help on using the repository browser.