source: CIVL/examples/translation/opencl/openCL.cvl@ dcdf9aa

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since dcdf9aa was e01b89d, checked in by Jacob Trieu <fuufusuu@…>, 12 years ago

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1067 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.4 KB
Line 
1
2#include "openCLtypes.cvl"
3
4$input int DEVICE_ID;
5$input int DEVICE_ID_BOUND;
6
7$assume 0 < DEVICE_ID && DEVICE_ID < DEVICE_ID_BOUND;
8
9int clGetDEVICE_IDs(cl_platform_id platform,
10 cl_device_type device_type,
11 cl_uint num_entries,
12 cl_device_id *devices,
13 cl_uint *num_devices)
14 {
15 int i = 0;
16 //cl_platform_id int value can be null
17
18 //num_entries number of devices that can be added
19
20 if(num_entries == 0 && devices != 0)
21 {
22 return CL_INVALID_VALUE;
23 }
24
25 if(num_entries == 0 && devices == 0)
26 {
27 return CL_INVALID_VALUE;
28 }
29
30 //device_type type a bitfield that somehow gets type of OpenCL device
31 //use the device types, look in openCLtypes and look for CL_DEVICE_TYPE
32 //-> CPU, GPU, ACCELERATOR, DEFAULT, ALL
33
34 if(device_type & (CL_DEVICE_TYPE_DEFAULT | CL_DEVICE_TYPE_CPU |
35 CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR |
36 CL_DEVICE_TYPE_CUSTOM | CL_DEVICE_TYPE_ALL)
37 {
38 while (i < num_entries)
39 {
40 //if devices not null/0? What does that even mean?
41 //If there isn't anything there, you can't add in?
42 if(devices)
43 {
44 devices[i] = DEVICE_ID;
45 //how to say "use anything"?
46 i++;
47 }
48 else
49 {
50 break;
51 }
52
53 }
54 if (num_devices)
55 {
56 *num_devices = i;
57 }
58 }
59
60 else
61 {
62 return CL_DEVICE_NOT_FOUND;
63 }
64
65
66 //*devices list of devices found, use
67 //cl_device_id device_id;
68 //&device_id
69
70
71
72 return CL_SUCCESS;
73
74
75 }
76
Note: See TracBrowser for help on using the repository browser.