1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include "cl.cvl"
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 | #include <string.h>
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 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
|
|---|
| 18 | clCreateCommandQueue
|
|---|
| 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
|
|---|
| 28 | */
|
|---|
| 29 | int clGetDeviceIDs(int numEntries, cl_device_id * devices)
|
|---|
| 30 | {
|
|---|
| 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;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 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 | }
|
|---|
| 46 | //would pick the kernel by name, but not currently in place
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.