18 #ifndef __itkOpenCLContext_h 19 #define __itkOpenCLContext_h 21 #include "itkLightObject.h" 22 #include "itkObjectFactory.h" 73 class OpenCLVectorBase;
74 class OpenCLContextPimpl;
97 static Pointer GetInstance();
106 bool IsCreated()
const;
117 DevelopmentSingleMaximumFlopsDevice = 0x0001,
118 DevelopmentMultipleMaximumFlopsDevices = 0x0002,
119 SingleMaximumFlopsDevice = 0x0004,
120 MultipleMaximumFlopsDevices = 0x0008
142 bool Create(
const std::list< OpenCLDevice > & devices );
174 virtual void Release();
178 cl_context GetContextId()
const;
187 void SetContextId( cl_context
id );
192 std::list< OpenCLDevice > GetDevices()
const;
204 cl_int GetLastError()
const;
208 void SetLastError(
const cl_int error );
213 static std::string GetErrorName(
const cl_int code );
216 void ReportError(
const cl_int code,
const char * fileName =
"",
217 const int lineNumber = 0,
const char * location =
"" );
260 const std::size_t size );
290 template<
typename T >
292 const std::size_t size )
331 OpenCLProgram CreateProgramFromSourceCode(
const std::string & sourceCode,
332 const std::string & prefixSourceCode = std::string(),
333 const std::string & postfixSourceCode = std::string() );
338 OpenCLProgram CreateProgramFromSourceFile(
const std::string & filename,
339 const std::string & prefixSourceCode = std::string(),
340 const std::string & postfixSourceCode = std::string() );
346 OpenCLProgram CreateProgramFromBinaryCode(
const unsigned char * binary,
347 const std::size_t size );
353 OpenCLProgram BuildProgramFromSourceCode(
const std::string & sourceCode,
354 const std::string & prefixSourceCode = std::string(),
355 const std::string & postfixSourceCode = std::string() );
357 OpenCLProgram BuildProgramFromSourceCode(
const std::list< OpenCLDevice > & devices,
358 const std::string & sourceCode,
359 const std::string & prefixSourceCode = std::string(),
360 const std::string & postfixSourceCode = std::string(),
361 const std::string & extraBuildOptions = std::string() );
367 OpenCLProgram BuildProgramFromSourceFile(
const std::string & fileName,
368 const std::string & prefixSourceCode = std::string(),
369 const std::string & postfixSourceCode = std::string() );
371 OpenCLProgram BuildProgramFromSourceFile(
const std::list< OpenCLDevice > & devices,
372 const std::string & fileName,
373 const std::string & prefixSourceCode = std::string(),
374 const std::string & postfixSourceCode = std::string(),
375 const std::string & extraBuildOptions = std::string() );
379 std::list< OpenCLImageFormat > GetSupportedImageFormats(
384 OpenCLSampler CreateSampler(
const bool normalizedCoordinates,
451 void OpenCLProfile( cl_event clEvent,
const std::string & message,
452 const bool releaseEvent =
false );
461 OpenCLProgram CreateOpenCLProgram(
const std::string & filename,
462 const std::string & source,
463 const std::size_t sourceSize );
468 const Self & operator=(
const Self & );
472 std::auto_ptr< OpenCLContextPimpl > d_ptr;
473 static Pointer m_Instance;
476 cl_command_queue GetActiveQueue();
481 OpenCLContextPimpl * d );
487 OpenCLContextPimpl * d );
491 void SetUpProfiling();
495 void OpenCLDebug( const
std::
string & callname );
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
OpenCLEventList class represents a list of OpenCLEvent objects.
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
The OpenCLBuffer class represents an OpenCL buffer object.
The base class for the OpenCLVector implementation.
The OpenCLUserEvent class represents OpenCL user events.
The OpenCLCommandQueue class represents an OpenCL a command-queue on a specific device and valid Open...
The OpenCLContext class represents an OpenCL context.
#define ITK_OPENCL_DECLARE_PRIVATE(Class)
OpenCLVector< T > CreateVector(const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
The OpenCLSampler class represents an OpenCL sampler object.
The OpenCLDevice class represents the collection of OpenCL devices to be used by the host...
SmartPointer< const Self > ConstPointer
The OpenCLKernel class represents an executable entry point function in an OpenCL program...
SmartPointer< Self > Pointer
The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects...
The OpenCLVector class represents a templated OpenCL buffer object.
The OpenCLProgram class represents an OpenCL program object.
OpenCLEvent class represents an OpenCL event object.