source: CIVL/examples/translation/opencl/openCL.cvl@ 9c7b25c

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

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1072 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 while (i < num_entries)
41 {
42 //if devices not null/0? What does that even mean?
43 //If there isn't anything there, you can't add in?
44 if(devices)
45 {
46 devices[0] = (cl_device_id)(&DEVICE_ID);
47 //how to say "use anything"?
48 i++;
49 }
50 else
51 {
52 break;
53 }
54
55 }
56 if (num_devices)
57 {
58 *num_devices = i;
59 }
60 }
61/*
62 else
63 {
64 return CL_DEVICE_NOT_FOUND;
65 }
66*/
67 //*devices list of devices found, use
68 //cl_device_id device_id;
69 //&device_id
70
71 return CL_SUCCESS;
72
73 }
74
75
76
77 /*
78cl_context clCreateContext(const cl_context_properties *properties,
79 cl_uint num_devices,
80 const cl_device_id * devices,
81 void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
82 void * user_data,
83 cl_int * errcode_ret)
84{
85//Anything to do with the void parameters is not implemented yet
86 cl_int default_errcode_ret;
87 if(!errcode_ret)
88 errcode_ret = &default_errcode_ret;
89
90 if (!devices || !num_devices || !pfn_notify && user_data}}
91 {
92 *errcode_ret = CL_INVALID_VALUE;
93 return 0;
94 }
95 *errcode_ret = CL_SUCCESS;
96 *ctx = new
97
98 if(*errcode_ret != CL_SUCCESS)
99 {
100 delete ctx;
101 return 0;
102 }
103 return(_cl_context*) ctx;
104
105}
106*/
107
108
Note: See TracBrowser for help on using the repository browser.