source:
CIVL/examples/translation/openclversion2.1/openCLshared.cvl@
764d472
| Last change on this file since 764d472 was d508f18, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 904 bytes | |
| Rev | Line | |
|---|---|---|
| [4686c50] | 1 | #include "cl.cvl" |
| 2 | #include <stdio.h> | |
| 3 | #include <stdlib.h> | |
| 4 | #include <string.h> | |
| 5 | ||
| [d508f18] | 6 | |
| [863d90b] | 7 | /* |
| 8 | Defined in cl.cvl: (+ means that it will be used) | |
| 9 | + cl_device_id | |
| 10 | cl_context | |
| 11 | + cl_command_queue | |
| 12 | cl_program | |
| 13 | cl_kernel | |
| 14 | ? cl_mem | |
| 15 | ||
| 16 | Methods that will be shared: | |
| 17 | clGetDeviceIDs | |
| [141e866] | 18 | clCreateCommandQueue |
| [863d90b] | 19 | clEnqueueNDRangeKernel |
| 20 | ||
| 21 | workfunc goes into main program, but a method | |
| 22 | ||
| 23 | Methods that will be replaced with simple parts, see wiki: | |
| 24 | clCreateBuffer | |
| 25 | setKernelArgs | |
| 26 | clGetKernelWorkGroupInfo | |
| 27 | clEnqueueReadBuffer | |
| [4686c50] | 28 | */ |
| [1e4e5da] | 29 | int clGetDeviceIDs(int numEntries, cl_device_id * devices) |
| [863d90b] | 30 | { |
| [1e4e5da] | 31 | for (int i=0; i<numEntries; i++) { |
| 32 | devices[i].id = i; | |
| 33 | // exactly equivalent to: (devices+i)->id = i | |
| 34 | } | |
| 35 | return CL_SUCCESS; | |
| [863d90b] | 36 | } |
| [4686c50] | 37 | |
| [141e866] | 38 | cl_command_queue clCreateCommandQueue(cl_device_id devices) |
| 39 | { | |
| 40 | cl_command_queue queue; | |
| 41 | ||
| 42 | queue.device = devices; | |
| 43 | ||
| 44 | return queue; | |
| 45 | } | |
| [d508f18] | 46 | //would pick the kernel by name, but not currently in place |
| [141e866] | 47 | |
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 |
Note:
See TracBrowser
for help on using the repository browser.
