Accelerated Computation Engine
opencl_device.h
1 #ifndef OPENCL_DEVICE_H
2 #define OPENCL_DEVICE_H
3 #include <CL/cl.h>
4 #include <QObject>
5 #include "opencl.h"
6 //
7 
8 
9 
10 namespace OpenCL
11 {
19  class Device : public QObject
20  {
21  Q_OBJECT
22  public:
26  enum class Type
27  {
31  CPU
35  ,GPU
43  ,Default
44  };
45  explicit Device(cl_device_id id, QObject* parent = nullptr);
46  cl_device_id id() const;
47  bool isAvailable() const;
48  bool hasCompiler() const;
49  const QStringList& extensions() const;
50  qint64 globalMemorySize() const;
51  qint64 localMemorySize() const;
52  int computeUnitSize() const;
53  int clockFrequency() const;
54  QString name() const;
55  OpenCL::Device::Type type() const;
56  cl_platform_id platform() const;
57  private:
58  template<class R,class T> R getInfo(cl_device_info type) const;
59  QString getStringInfo(cl_device_info type) const;
63  cl_device_id _id;
67  bool _available;
71  bool _compiler;
75  QStringList _extensions;
79  qint64 _globalMemorySize;
83  qint64 _localMemorySize;
88  int _computeUnitSize;
92  int _clockFrequency;
96  QString _name;
100  Type _type;
104  cl_platform_id _platform;
105  };
106 }
107 
108 
109 
110 #endif
cl_platform_id platform() const
Definition: opencl_device.cpp:240
Type
Definition: opencl_device.h:26
const QStringList & extensions() const
Definition: opencl_device.cpp:119
OpenCL::Device::Type type() const
Definition: opencl_device.cpp:223
int computeUnitSize() const
Definition: opencl_device.cpp:171
cl_device_id id() const
Definition: opencl_device.cpp:68
QString name() const
Definition: opencl_device.cpp:206
qint64 globalMemorySize() const
Definition: opencl_device.cpp:136
Definition: opencl_device.h:19
int clockFrequency() const
Definition: opencl_device.cpp:189
bool isAvailable() const
Definition: opencl_device.cpp:85
bool hasCompiler() const
Definition: opencl_device.cpp:102
qint64 localMemorySize() const
Definition: opencl_device.cpp:153
Device(cl_device_id id, QObject *parent=nullptr)
Definition: opencl_device.cpp:24
Definition: opencl.h:5