source: CIVL/examples/translation/opencl/setup/openCL.cvl@ 6777880

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

Moved some code and non-code for clarity

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

  • Property mode set to 100644
File size: 2.3 KB
Line 
1
2#include "cl.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
9
10int clGetDeviceIDs(cl_platform_id platform,
11 cl_device_type device_type,
12 cl_uint num_entries,
13 cl_device_id *devices,
14 cl_uint *num_devices)
15 {
16 //$assume device_type == CL_DEVICE_TYPE_DEFAULT;
17 int i = 0;
18 //cl_platform_id int value can be null
19
20 //num_entries number of devices that can be added
21 /*
22 if(num_entries == 0 && devices != 0)
23 {
24 return CL_INVALID_VALUE;
25 }
26
27 if(num_entries == 0 && devices == 0)
28 {
29 return CL_INVALID_VALUE;
30 }
31 */
32 //device_type type a bitfield that somehow gets type of OpenCL device
33 //use the device types, look in openCLtypes and look for CL_DEVICE_TYPE_...
34
35 /*
36 if(device_type & (CL_DEVICE_TYPE_DEFAULT | CL_DEVICE_TYPE_CPU |
37 CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR |
38 CL_DEVICE_TYPE_CUSTOM | CL_DEVICE_TYPE_ALL))
39 {
40 */
41 while (i < num_entries)
42 {
43 //if devices not null/0? What does that even mean?
44 //If there isn't anything there, you can't add in?
45 if(devices)
46 {
47 devices[0] = (cl_device_id)(&DEVICE_ID);
48 //how to say "use anything"?
49 i++;
50 }
51 else
52 {
53 break;
54 }
55
56 }
57 if (num_devices)
58 {
59 *num_devices = i;
60 }
61 //}
62/*
63 else
64 {
65 return CL_DEVICE_NOT_FOUND;
66 }
67*/
68 //*devices list of devices found, use
69 //cl_device_id device_id;
70 //&device_id
71
72 return CL_SUCCESS;
73
74 }
75
76
77
78 /*
79cl_context clCreateContext(const cl_context_properties *properties,
80 cl_uint num_devices,
81 const cl_device_id * devices,
82 void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
83 void * user_data,
84 cl_int * errcode_ret)
85{
86//Anything to do with the void parameters is not implemented yet
87 cl_int default_errcode_ret;
88 if(!errcode_ret)
89 errcode_ret = &default_errcode_ret;
90
91 if (!devices || !num_devices || !pfn_notify && user_data}}
92 {
93 *errcode_ret = CL_INVALID_VALUE;
94 return 0;
95 }
96 *errcode_ret = CL_SUCCESS;
97 *ctx = new
98
99 if(*errcode_ret != CL_SUCCESS)
100 {
101 delete ctx;
102 return 0;
103 }
104 return(_cl_context*) ctx;
105
106}
107*/
108
109
Note: See TracBrowser for help on using the repository browser.