1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | #include "openCLshared.cvl"
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 | #include <string.h>
|
|---|
| 5 |
|
|---|
| 6 | $input int NUM_DEVICES;
|
|---|
| 7 | $input int MAX_NUM_DEVICES;
|
|---|
| 8 | $assume 0 < NUM_DEVICES && NUM_DEVICES < MAX_NUM_DEVICES;
|
|---|
| 9 |
|
|---|
| 10 | //kernel
|
|---|
| 11 | void square(int workgroup, int global_id, int local_id, int* input, int* output, const unsigned int count)
|
|---|
| 12 | {
|
|---|
| 13 | //int i = get_global_id(0);
|
|---|
| 14 | int i = global_id;
|
|---|
| 15 | if (i < count)
|
|---|
| 16 | {
|
|---|
| 17 | output[i] = input[i] * input[i];
|
|---|
| 18 | //printf("output[%d] is %d\n", i, output[i]);
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | /*
|
|---|
| 22 | void workfunc(size_t local, size_t global, kernel param)
|
|---|
| 23 | {
|
|---|
| 24 | for(int i = local * param.workgroup; i < local * param.workgroup + local; i++)
|
|---|
| 25 | {
|
|---|
| 26 | param.local_id = i % local;
|
|---|
| 27 | param.global_id = i;
|
|---|
| 28 | //printf("My workgroup id is %d, my global id is %d, my local id is %d\n", param.workgroup, param.global_id, param.local_id);
|
|---|
| 29 | square(param.workgroup, param.global_id, param.local_id, param.input, param.output, param.count);
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 | */
|
|---|
| 33 | int main(int argc, char** argv)
|
|---|
| 34 | {
|
|---|
| 35 | cl_device_id devices;
|
|---|
| 36 | int err;
|
|---|
| 37 |
|
|---|
| 38 | err = clGetDeviceIDs(3, &devices);
|
|---|
| 39 |
|
|---|
| 40 | free(devices);
|
|---|
| 41 |
|
|---|
| 42 | return 0;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.