18#ifndef itkOpenCLContext_h
19#define itkOpenCLContext_h
21#include "itkLightObject.h"
22#include "itkObjectFactory.h"
73class OpenCLVectorBase;
74class OpenCLContextPimpl;
121 DevelopmentSingleMaximumFlopsDevice = 0x0001,
122 DevelopmentMultipleMaximumFlopsDevices = 0x0002,
123 SingleMaximumFlopsDevice = 0x0004,
124 MultipleMaximumFlopsDevices = 0x0008
148 Create(
const std::list<OpenCLDevice> & devices);
203 std::list<OpenCLDevice>
233 ReportError(
const cl_int code,
const char * fileName =
"",
const int lineNumber = 0,
const char * location =
"");
309 template <
typename T>
356 const std::string & prefixSourceCode = std::string(),
357 const std::string & postfixSourceCode = std::string());
364 const std::string & prefixSourceCode = std::string(),
365 const std::string & postfixSourceCode = std::string());
380 const std::string & prefixSourceCode = std::string(),
381 const std::string & postfixSourceCode = std::string());
385 const std::string & sourceCode,
386 const std::string & prefixSourceCode = std::string(),
387 const std::string & postfixSourceCode = std::string(),
388 const std::string & extraBuildOptions = std::string());
396 const std::string & prefixSourceCode = std::string(),
397 const std::string & postfixSourceCode = std::string());
401 const std::string & fileName,
402 const std::string & prefixSourceCode = std::string(),
403 const std::string & postfixSourceCode = std::string(),
404 const std::string & extraBuildOptions = std::string());
408 std::list<OpenCLImageFormat>
489 OpenCLProfile(cl_event clEvent,
const std::string & message,
const bool releaseEvent =
false);
500 CreateOpenCLProgram(
const std::string & filename,
const std::string & source,
const std::size_t sourceSize);
509 std::unique_ptr<OpenCLContextPimpl> d_ptr;
519 CreateContext(const std::list<
OpenCLDevice> & devices, OpenCLContextPimpl * d);
534 OpenCLDebug(const std::
string & callname);
The OpenCLBuffer class represents an OpenCL buffer object.
The OpenCLCommandQueue class represents an OpenCL a command-queue on a specific device and valid Open...
The OpenCLContext class represents an OpenCL context.
OpenCLContext(const Self &other)=delete
cl_int Marker(const OpenCLEventList &event_list)
OpenCLImage CreateImageCopy(const OpenCLImageFormat &format, const void *data, const OpenCLSize &size, const OpenCLMemoryObject::Access access)
std::list< OpenCLDevice > GetDevices() const
cl_int GetLastError() const
OpenCLProgram CreateProgramFromBinaryCode(const unsigned char *binary, const std::vcl_size_t size)
bool Create(const OpenCLPlatform &platfrom, const OpenCLDevice::DeviceType type=OpenCLDevice::Default)
OpenCLProgram BuildProgramFromSourceFile(const std::list< OpenCLDevice > &devices, const std::string &fileName, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string(), const std::string &extraBuildOptions=std::string())
~OpenCLContext() override
OpenCLImage CreateImageDevice(const OpenCLImageFormat &format, const OpenCLMemoryObject::Access access, const OpenCLSize &size)
bool Create(const OpenCLContext::CreateMethod method)
static std::string GetErrorName(const cl_int code)
OpenCLEvent BarrierAsync(const OpenCLEventList &event_list)
OpenCLCommandQueue GetCommandQueue()
OpenCLVector< T > CreateVector(const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
void SetLastError(const cl_int error)
void SetContextId(cl_context id)
OpenCLProgram BuildProgramFromSourceCode(const std::string &sourceCode, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
OpenCLSampler CreateSampler(const bool normalizedCoordinates, const OpenCLSampler::AddressingMode addressingMode, const OpenCLSampler::FilterMode filterMode)
void SetCommandQueue(const OpenCLCommandQueue &queue)
cl_int Barrier(const OpenCLEventList &event_list)
OpenCLProgram BuildProgramFromSourceCode(const std::list< OpenCLDevice > &devices, const std::string &sourceCode, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string(), const std::string &extraBuildOptions=std::string())
OpenCLBuffer CreateBufferDevice(const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
OpenCLProgram CreateProgramFromSourceFile(const std::string &filename, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
cl_context GetContextId() const
void SetDefaultDevice(const OpenCLDevice &device)
static Pointer GetInstance()
OpenCLProgram BuildProgramFromSourceFile(const std::string &fileName, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
const Self & operator=(const Self &)=delete
OpenCLBuffer CreateBufferCopy(const void *data, const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
OpenCLDevice GetDefaultDevice() const
OpenCLUserEvent CreateUserEvent()
OpenCLProgram CreateOpenCLProgram(const std::string &filename, const std::string &source, const std::vcl_size_t sourceSize)
OpenCLImage CreateImageHost(const OpenCLImageFormat &format, void *data, const OpenCLSize &size, const OpenCLMemoryObject::Access access)
static cl_int WaitForFinished(const OpenCLEventList &event_list)
OpenCLProgram CreateProgramFromSourceCode(const std::string &sourceCode, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
SmartPointer< const Self > ConstPointer
OpenCLEvent MarkerAsync(const OpenCLEventList &event_list)
OpenCLBuffer CreateBufferHost(void *data, const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
bool Create(const OpenCLDevice::DeviceType type)
void ReportError(const cl_int code, const char *fileName="", const int lineNumber=0, const char *location="")
OpenCLCommandQueue CreateCommandQueue(const cl_command_queue_properties properties, const OpenCLDevice &device=OpenCLDevice())
std::list< OpenCLImageFormat > GetSupportedImageFormats(const OpenCLImageFormat::ImageType image_type, const cl_mem_flags flags) const
bool Create(const std::list< OpenCLDevice > &devices)
OpenCLCommandQueue GetDefaultCommandQueue()
static void SetInstance(OpenCLContext *instance)
void OpenCLProfile(cl_event clEvent, const std::string &message, const bool releaseEvent=false)
The OpenCLDevice class represents the collection of OpenCL devices to be used by the host.
OpenCLEventList class represents a list of OpenCLEvent objects.
OpenCLEvent class represents an OpenCL event object.
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
The OpenCLKernel class represents an executable entry point function in an OpenCL program.
The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects.
The OpenCLProgram class represents an OpenCL program object.
The OpenCLSampler class represents an OpenCL sampler object.
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
The OpenCLUserEvent class represents OpenCL user events.
The base class for the OpenCLVector implementation.
The OpenCLVector class represents a templated OpenCL buffer object.
#define ITK_OPENCL_DECLARE_PRIVATE(Class)