0
|
1 /**
|
|
2 *
|
|
3 */
|
|
4 module opencl.device;
|
|
5
|
3
|
6 import opencl.c.cl;
|
0
|
7 import opencl.platform;
|
|
8 import opencl.wrapper;
|
|
9
|
|
10 /// device class
|
|
11 class CLDevice : CLWrapper!(cl_device_id, clGetDeviceInfo)
|
|
12 {
|
|
13 private:
|
|
14 CLPlatform _platform;
|
|
15
|
|
16 public:
|
3
|
17 /// need a constructor without platform, if we need to wrap a retrieved cl_device_id
|
|
18 this(cl_device_id device)
|
|
19 {
|
|
20 super(device);
|
|
21 // TODO: retrieve platform ID via CL call and set _platform
|
|
22 }
|
|
23
|
0
|
24 ///
|
|
25 this(CLPlatform platform, cl_device_id device)
|
|
26 {
|
|
27 super(device);
|
|
28 _platform = platform;
|
|
29 }
|
|
30
|
|
31 /// get the associated platform
|
|
32 CLPlatform platform() {return _platform;} // TODO: maybe check with GetDeviceInfo if IDs match
|
|
33
|
|
34 /// get device name
|
|
35 string name() {return getStringInfo(CL_DEVICE_NAME);}
|
|
36
|
|
37 /// get device vendor
|
|
38 string vendor() {return getStringInfo(CL_DEVICE_VENDOR);}
|
|
39
|
|
40 /// get device OpenCL driver version in the form major_number.minor_number
|
|
41 string driverVersion() {return getStringInfo(CL_DRIVER_VERSION);}
|
|
42
|
|
43 /**
|
|
44 * get OpenCL profile string
|
|
45 *
|
|
46 * Returns the profile name supported by the device.
|
|
47 * The profile name returned can be one of the following strings:
|
|
48 * FULL_PROFILE - if the device supports the OpenCL specification
|
|
49 * (functionality defined as part of the core specification and does not require
|
|
50 * any extensions to be supported).
|
|
51 *
|
|
52 * EMBEDDED_PROFILE - if the device supports the OpenCL embedded profile.
|
|
53 */
|
|
54 string profile() {return getStringInfo(CL_DEVICE_PROFILE);}
|
|
55
|
|
56 /**
|
|
57 * get OpenCL version string
|
|
58 *
|
|
59 * Returns:
|
|
60 * OpenCL version supported by the device.
|
|
61 * This version string has the following format:
|
|
62 * OpenCL<space><major_version.minor_version><space><vendor-specific information>
|
|
63 */
|
|
64 string clVersion() {return getStringInfo(CL_DEVICE_VERSION);}
|
|
65
|
|
66 /**
|
|
67 * get extensions supported by the device
|
|
68 *
|
|
69 * Returns:
|
|
70 * Returns a space separated list of extension names
|
|
71 * (the extension names themselves do not contain any spaces).
|
|
72 */
|
|
73 string extensions() {return getStringInfo(CL_DEVICE_EXTENSIONS);}
|
|
74
|
|
75
|
|
76 } |