1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <civlc.h>
|
|---|
| 2 | void square(int global_id, int input[], int output[], int count)
|
|---|
| 3 | {
|
|---|
| 4 | int i = global_id;
|
|---|
| 5 | if (i < count)
|
|---|
| 6 | {
|
|---|
| 7 | output[i] = input[i] * input[i];
|
|---|
| 8 | }
|
|---|
| 9 | }
|
|---|
| 10 | int main(int argc, char** argv)
|
|---|
| 11 | {
|
|---|
| 12 | int global = 4;
|
|---|
| 13 |
|
|---|
| 14 | int input[global];
|
|---|
| 15 | int output[global];
|
|---|
| 16 |
|
|---|
| 17 | for(int i = 0; i < global; i++)
|
|---|
| 18 | {
|
|---|
| 19 | input[i] = i;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | for(int i = 0; i < global; i++)
|
|---|
| 23 | {
|
|---|
| 24 | square(i, input, output, global);
|
|---|
| 25 | }
|
|---|
| 26 | return 0;
|
|---|
| 27 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.