Image Component Library (ICL)
CLDeviceContext.h
Go to the documentation of this file.
1 /********************************************************************
2  ** Image Component Library (ICL) **
3  ** **
4  ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5  ** Neuroinformatics Group **
6  ** Website: www.iclcv.org and **
7  ** http://opensource.cit-ec.de/projects/icl **
8  ** **
9  ** File : ICLUtils/src/ICLUtils/CLDeviceContext.h **
10  ** Module : ICLUtils **
11  ** Authors: Tobias Roehlig **
12  ** **
13  ** **
14  ** GNU LESSER GENERAL PUBLIC LICENSE **
15  ** This file may be used under the terms of the GNU Lesser General **
16  ** Public License version 3.0 as published by the **
17  ** **
18  ** Free Software Foundation and appearing in the file LICENSE.GPL **
19  ** included in the packaging of this file. Please review the **
20  ** following information to ensure the license requirements will **
21  ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22  ** **
23  ** The development of this software was supported by the **
24  ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25  ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26  ** Forschungsgemeinschaft (DFG) in the context of the German **
27  ** Excellence Initiative. **
28  ** **
29  ********************************************************************/
30 
31 #pragma once
32 
33 #ifdef ICL_HAVE_OPENCL
34 
35 #include <ICLUtils/CompatMacros.h>
36 #include <ICLUtils/CLBuffer.h>
37 #include <ICLUtils/CLKernel.h>
38 #include <ICLUtils/CLImage2D.h>
39 #include <ICLUtils/CLException.h>
40 #include <string>
41 
42 
43 namespace cl{
44  class Device;
45  class CommandQueue;
46  class Context;
47 }
48 
49 namespace icl {
50  namespace utils {
51 
65  struct Impl;
67  Impl *impl;
68 
70  cl::Device &getDevice();
72  cl::CommandQueue &getCommandQueue();
74  cl::Context &getContext();
75 
76  public:
77 
78  friend class CLProgram;
79  friend class CLMemoryAssistant;
80 
84  CLDeviceContext() ;
89  CLDeviceContext(std::string const &device) ;
94  CLDeviceContext(const CLDeviceContext &other);
100  CLDeviceContext const &operator=(CLDeviceContext const& other);
104  ~CLDeviceContext();
105 
106  //accessMode = "r" only read
107  //accessMode = "w" only write
108  //accessMode = "rw" read and write
119  CLBuffer createBuffer(const string &accessMode, size_t size, const void *src=0) ;
120 
130  CLBuffer createBuffer(const string &accessMode, size_t length, size_t byteDepth, const void *src = 0) ;
131 
150  CLImage2D createImage2D(const string &accessMode, const size_t width, const size_t height, int depth, const void *src=0) ;
151 
169  CLImage2D createImage2D(const string &accessMode, const size_t width, const size_t height, int depth, int num_channel, const void *src=0) ;
170 
175  std::string const getDeviceTypeString();
180  std::string const getDeviceTypeString() const;
181 
183  void listSelectedPlatform();
184 
186  void listSelectedDevice();
187 
189  static void listAllPlatformsAndDevices();
190 
192  static void listAllPlatforms();
193 
194  private:
195 
207  CLBuffer *createBufferHeap(const string &accessMode, size_t length, size_t byteDepth, const void *src=0) ;
208 
227  CLImage2D *createImage2DHeap(const string &accessMode, const size_t width, const size_t height, int depth, int num_channel, const void *src=0) ;
228  };
229 
230  }
231 }
232 
233 #endif
undocument this line if you encounter any issues!
Definition: Any.h:37
Definition: CLDeviceContext.h:43
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
Wrapper for an OpenCL Buffer.
Definition: CLBuffer.h:52
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
The CLDeviceContext class allows preparation of the device used for CLPrograms.
Definition: CLDeviceContext.h:61
Impl * impl
Definition: CLDeviceContext.h:65
Wrapper for an OpenCL Image2D.
Definition: CLImage2D.h:57
The CLMemoryAssistant class is a helper class to maintain buffers and images for opencl-program pipel...
Definition: CLMemoryAssistant.h:53
Main class for OpenCL based accelleration.
Definition: CLProgram.h:259