source:
CIVL/examples/translation/openclversion2.1/openSimp.cvl@
764d472
| Last change on this file since 764d472 was e1b39409, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 427 bytes | |
| Rev | Line | |
|---|---|---|
| [da70bc2] | 1 | #include <civlc.h> |
| [e1b39409] | 2 | void square(int global_id, int input[], int 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] | 10 | int main(int argc, char** argv) |
| [da70bc2] | 11 | { |
| [1acabb5] | 12 | int global = 4; |
| 13 | ||
| [e1b39409] | 14 | int input[global]; |
| 15 | int output[global]; | |
| [1acabb5] | 16 | |
| 17 | for(int i = 0; i < global; i++) | |
| [da70bc2] | 18 | { |
| [1acabb5] | 19 | input[i] = i; |
| [da70bc2] | 20 | } |
| [e1b39409] | 21 | |
| [1acabb5] | 22 | for(int i = 0; i < global; i++) |
| [da70bc2] | 23 | { |
| [e1b39409] | 24 | square(i, input, output, global); |
| [da70bc2] | 25 | } |
| [e1b39409] | 26 | return 0; |
| [da70bc2] | 27 | } |
Note:
See TracBrowser
for help on using the repository browser.
