go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
itk::OpenCLContext Class Reference

#include <itkOpenCLContext.h>

Detailed Description

The OpenCLContext class represents an OpenCL context.

The host defines a context for the execution of the kernels. The context includes the following resources:

\table \row \o Devices \o The collection of OpenCL devices to be used by the host. \row \o Kernels \o The OpenCL functions that run on OpenCL devices. \row \o Program Objects \o The program source and executable that implement the kernels. \row \o Memory Objects \o A set of memory objects visible to the host and the OpenCL devices. Memory objects contain values that can be operated on by instances of a kernel. \endtable

The context is created and manipulated by the host using functions from the OpenCL API. The host creates a data structure called a command-queue to coordinate execution of the kernels on the devices. The host places commands into the command-queue which are then scheduled onto the devices within the context.

Context are constructed using OpenCLContext::Create().

if( !context->IsCreated() )
{
std::cerr << "OpenCL-enabled device is not present." << std::endl;
}
static Pointer GetInstance()
See also
OpenCLDevice, OpenCLProgram, OpenCLKernel, OpenCLCommandQueue,
OpenCLBuffer, OpenCLVector, OpenCLUserEvent

Definition at line 76 of file itkOpenCLContext.h.

+ Inheritance diagram for itk::OpenCLContext:

Public Types

typedef SmartPointer< const SelfConstPointer
 
enum  CreateMethod {
  Default = 0x0000 , DevelopmentSingleMaximumFlopsDevice = 0x0001 , DevelopmentMultipleMaximumFlopsDevices = 0x0002 , SingleMaximumFlopsDevice = 0x0004 ,
  MultipleMaximumFlopsDevices = 0x0008
}
 
typedef SmartPointer< SelfPointer
 
typedef OpenCLContext Self
 
typedef LightObject Superclass
 

Public Member Functions

cl_int Barrier (const OpenCLEventList &event_list)
 
OpenCLEvent BarrierAsync (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())
 
OpenCLProgram BuildProgramFromSourceCode (const std::string &sourceCode, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
 
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())
 
OpenCLProgram BuildProgramFromSourceFile (const std::string &fileName, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
 
bool Create ()
 
bool Create (const OpenCLContext::CreateMethod method)
 
bool Create (const OpenCLDevice::DeviceType type)
 
bool Create (const OpenCLPlatform &platfrom, const OpenCLDevice::DeviceType type=OpenCLDevice::Default)
 
bool Create (const std::list< OpenCLDevice > &devices)
 
OpenCLBuffer CreateBufferCopy (const void *data, const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
 
OpenCLBuffer CreateBufferDevice (const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
 
OpenCLBuffer CreateBufferHost (void *data, const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
 
OpenCLCommandQueue CreateCommandQueue (const cl_command_queue_properties properties, const OpenCLDevice &device=OpenCLDevice())
 
OpenCLImage CreateImageCopy (const OpenCLImageFormat &format, const void *data, const OpenCLSize &size, const OpenCLMemoryObject::Access access)
 
OpenCLImage CreateImageDevice (const OpenCLImageFormat &format, const OpenCLMemoryObject::Access access, const OpenCLSize &size)
 
OpenCLImage CreateImageHost (const OpenCLImageFormat &format, void *data, const OpenCLSize &size, const OpenCLMemoryObject::Access access)
 
OpenCLProgram CreateProgramFromBinaryCode (const unsigned char *binary, const std::vcl_size_t size)
 
OpenCLProgram CreateProgramFromSourceCode (const std::string &sourceCode, const std::string &prefixSourceCode=std::string(), const std::string &postfixSourceCode=std::string())
 
OpenCLProgram CreateProgramFromSourceFile (const std::string &filename, 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)
 
OpenCLUserEvent CreateUserEvent ()
 
template<typename T >
OpenCLVector< T > CreateVector (const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
 
void Finish ()
 
void Flush ()
 
virtual const char * GetClassName () const
 
OpenCLCommandQueue GetCommandQueue ()
 
cl_context GetContextId () const
 
OpenCLCommandQueue GetDefaultCommandQueue ()
 
OpenCLDevice GetDefaultDevice () const
 
std::list< OpenCLDeviceGetDevices () const
 
cl_int GetLastError () const
 
std::list< OpenCLImageFormatGetSupportedImageFormats (const OpenCLImageFormat::ImageType image_type, const cl_mem_flags flags) const
 
bool IsCreated () const
 
cl_int Marker (const OpenCLEventList &event_list)
 
OpenCLEvent MarkerAsync (const OpenCLEventList &event_list)
 
virtual void Release ()
 
void ReportError (const cl_int code, const char *fileName="", const int lineNumber=0, const char *location="")
 
void SetCommandQueue (const OpenCLCommandQueue &queue)
 
void SetContextId (cl_context id)
 
void SetLastError (const cl_int error)
 

Static Public Member Functions

static std::string GetErrorName (const cl_int code)
 
static Pointer GetInstance ()
 
static Pointer New ()
 
static void SetInstance (OpenCLContext *instance)
 
static cl_int WaitForFinished (const OpenCLEventList &event_list)
 

Protected Member Functions

OpenCLProgram CreateOpenCLProgram (const std::string &filename, const std::string &source, const std::vcl_size_t sourceSize)
 
 OpenCLContext ()
 
void OpenCLProfile (cl_event clEvent, const std::string &message, const bool releaseEvent=false)
 
void SetDefaultDevice (const OpenCLDevice &device)
 
 ~OpenCLContext () override
 

Private Member Functions

void CreateContext (const OpenCLPlatform &platfrom, const OpenCLDevice::DeviceType type, OpenCLContextPimpl *d)
 
void CreateContext (const std::list< OpenCLDevice > &devices, OpenCLContextPimpl *d)
 
cl_command_queue GetActiveQueue ()
 
 OpenCLContext (const Self &other)
 
void OpenCLDebug (const std::string &callname)
 
const Selfoperator= (const Self &)
 
void SetUpProfiling ()
 

Private Attributes

std::unique_ptr< OpenCLContextPimpl > d_ptr
 

Static Private Attributes

static Pointer m_Instance
 

Friends

class OpenCLBuffer
 
class OpenCLCommandQueue
 
class OpenCLImage
 
class OpenCLKernel
 
class OpenCLMemoryObject
 
class OpenCLProgram
 
class OpenCLSampler
 
class OpenCLVectorBase
 

Member Typedef Documentation

◆ ConstPointer

typedef SmartPointer< const Self > itk::OpenCLContext::ConstPointer

Definition at line 84 of file itkOpenCLContext.h.

◆ Pointer

typedef SmartPointer< Self > itk::OpenCLContext::Pointer

Definition at line 83 of file itkOpenCLContext.h.

◆ Self

Standard class typedefs.

Definition at line 81 of file itkOpenCLContext.h.

◆ Superclass

typedef LightObject itk::OpenCLContext::Superclass

Definition at line 82 of file itkOpenCLContext.h.

Member Enumeration Documentation

◆ CreateMethod

Enumerator
Default 
DevelopmentSingleMaximumFlopsDevice 
DevelopmentMultipleMaximumFlopsDevices 
SingleMaximumFlopsDevice 
MultipleMaximumFlopsDevices 

Definition at line 115 of file itkOpenCLContext.h.

Constructor & Destructor Documentation

◆ OpenCLContext() [1/2]

itk::OpenCLContext::OpenCLContext ( )
protected

Constructs a new OpenCL context object. This constructor is typically followed by calls to SetPlatform() and Create().

◆ ~OpenCLContext()

itk::OpenCLContext::~OpenCLContext ( )
overrideprotected

Destroys this OpenCL context object. If the underlying GetContextId() has been created, then it will be released.

◆ OpenCLContext() [2/2]

itk::OpenCLContext::OpenCLContext ( const Self other)
private

Member Function Documentation

◆ Barrier()

cl_int itk::OpenCLContext::Barrier ( const OpenCLEventList event_list)

Enqueues a barrier command which waits for either a list of events to complete, or if the list is empty it waits for all commands previously enqueued in command_queue to complete before it completes.

See also
BarrierAsync()

◆ BarrierAsync()

OpenCLEvent itk::OpenCLContext::BarrierAsync ( const OpenCLEventList event_list)

Asynchronous version of the Barrier() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
Marker()

◆ BuildProgramFromSourceCode() [1/2]

OpenCLProgram itk::OpenCLContext::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() 
)

◆ BuildProgramFromSourceCode() [2/2]

OpenCLProgram itk::OpenCLContext::BuildProgramFromSourceCode ( const std::string &  sourceCode,
const std::string &  prefixSourceCode = std::string(),
const std::string &  postfixSourceCode = std::string() 
)

Creates an OpenCL program object from the supplied STL strings sourceCode, prefixSourceCode and then builds it. Returns a null OpenCLProgram if the program could not be built.

See also
CreateProgramFromSourceCode(), BuildProgramFromSourceFile()

◆ BuildProgramFromSourceFile() [1/2]

OpenCLProgram itk::OpenCLContext::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() 
)

◆ BuildProgramFromSourceFile() [2/2]

OpenCLProgram itk::OpenCLContext::BuildProgramFromSourceFile ( const std::string &  fileName,
const std::string &  prefixSourceCode = std::string(),
const std::string &  postfixSourceCode = std::string() 
)

Creates an OpenCL program object from the contents of the supplied by the STL strings filename, prefixSourceCode and then builds it. Returns a null OpenCLProgram if the program could not be built.

See also
CreateProgramFromSourceFile(), BuildProgramFromSourceFile()

◆ Create() [1/5]

bool itk::OpenCLContext::Create ( )

Creates a new OpenCL context that is defined by CMake. See CMake OPENCL_USE_* variables. Does nothing if the context has already been created. Returns true if the context was created, false otherwise. On error, the status can be retrieved by calling GetLastError().

Note
This is most simple method to create OpenCL context which uses {clCreateContextFromType} and target existing OpenCL platform, which may not be found on the user computer. For production better use context::Create( OpenCLContext::SingleMaximumFlopsDevice ) or similar.
See also
IsCreated(), SetContextId(), Release()

◆ Create() [2/5]

bool itk::OpenCLContext::Create ( const OpenCLContext::CreateMethod  method)

Creates a new OpenCL context that matches method of creating. Does nothing if the context has already been created. Returns true if the context was created, false otherwise. On error, the status can be retrieved by calling GetLastError().

See also
IsCreated(), SetContextId(), Release()

◆ Create() [3/5]

bool itk::OpenCLContext::Create ( const OpenCLDevice::DeviceType  type)

Creates a new OpenCL context that matches type. Does nothing if the context has already been created. This function will search for the first platform that has a device that matches type. The following code can be used to select devices that match type on a specific platform:

context.Create(OpenCLDevice::GetDevices(type, platform));
static std::list< OpenCLDevice > GetDevices(const OpenCLDevice::DeviceType types, const OpenCLPlatform &platform=OpenCLPlatform())

Returns true if the context was created, false otherwise. On error, the status can be retrieved by calling GetLastError().

See also
IsCreated(), SetContextId(), Release()

◆ Create() [4/5]

bool itk::OpenCLContext::Create ( const OpenCLPlatform platfrom,
const OpenCLDevice::DeviceType  type = OpenCLDevice::Default 
)

Creates a new OpenCL context that matches platform and type. Does nothing if the context has already been created. Returns true if the context was created, false otherwise. On error, the status can be retrieved by calling GetLastError().

See also
IsCreated(), SetContextId(), Release()

◆ Create() [5/5]

bool itk::OpenCLContext::Create ( const std::list< OpenCLDevice > &  devices)

Creates a new OpenCL context that matches devices. Does nothing if the context has already been created. All of the devices must be associated with the same platform. Returns true if the context was created, false otherwise. On error, the status can be retrieved by calling GetLastError().

See also
IsCreated(), SetContextId(), Release()

◆ CreateBufferCopy()

OpenCLBuffer itk::OpenCLContext::CreateBufferCopy ( const void *  data,
const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size 
)

Creates an OpenCL memory buffer of size bytes in length, with the specified access mode. The buffer is initialized with a copy of the contents of data. The application's data can be discarded after the buffer is created. Returns the new OpenCL memory buffer object, or a null object if the buffer could not be created.

See also
CreateBufferDevice(), CreateBufferHost(), CreateVector()

◆ CreateBufferDevice()

OpenCLBuffer itk::OpenCLContext::CreateBufferDevice ( const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size 
)

Creates an OpenCL memory buffer of size bytes in length, with the specified access mode. The memory is created on the device and will not be accessible to the host via a direct pointer. Use CreateBufferHost() to create a host-accessible buffer. Returns the new OpenCL memory buffer object, or a null object if the buffer could not be created.

See also
CreateBufferHost(), CreateBufferCopy(), CreateVector()

◆ CreateBufferHost()

OpenCLBuffer itk::OpenCLContext::CreateBufferHost ( void *  data,
const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size 
)

Creates an OpenCL memory buffer of size bytes in length, with the specified access mode. If data is not null, then it will be used as the storage for the buffer. If data is null, then a new block of host-accessible memory will be allocated. Returns the new OpenCL memory buffer object, or a null object if the buffer could not be created.

See also
CreateBufferDevice(), CreateBufferCopy(), CreateVector()

◆ CreateCommandQueue()

OpenCLCommandQueue itk::OpenCLContext::CreateCommandQueue ( const cl_command_queue_properties  properties,
const OpenCLDevice device = OpenCLDevice() 
)

Creates a new command queue on this context for device with the specified properties. If device is null, then GetDefaultDevice() will be used instead. Unlike GetDefaultCommandQueue(), this function will create a new queue every time it is called. The queue will be deleted when the last reference to the returned object is removed.

See also
GetDefaultCommandQueue(), GetLastError()

◆ CreateContext() [1/2]

void itk::OpenCLContext::CreateContext ( const OpenCLPlatform platfrom,
const OpenCLDevice::DeviceType  type,
OpenCLContextPimpl *  d 
)
private

◆ CreateContext() [2/2]

void itk::OpenCLContext::CreateContext ( const std::list< OpenCLDevice > &  devices,
OpenCLContextPimpl *  d 
)
private

◆ CreateImageCopy()

OpenCLImage itk::OpenCLContext::CreateImageCopy ( const OpenCLImageFormat format,
const void *  data,
const OpenCLSize size,
const OpenCLMemoryObject::Access  access 
)

Creates a OpenCL image object with the specified format, size, and access mode. The image is initialized with a copy of the contents of data. The application's data can be discarded after the image is created. Returns the new OpenCL image object, or a null object if the image could not be created.

See also
CreateImageDevice(), CreateImageHost()

◆ CreateImageDevice()

OpenCLImage itk::OpenCLContext::CreateImageDevice ( const OpenCLImageFormat format,
const OpenCLMemoryObject::Access  access,
const OpenCLSize size 
)

Creates a OpenCL image object with the specified format, size, and access mode. The image memory is created on the device and will not be accessible to the host via a direct pointer. Use CreateImageHost() to create a host-accessible image. Returns the new OpenCL image object, or a null object if the image could not be created.

See also
CreateImageHost(), CreateImageCopy()

◆ CreateImageHost()

OpenCLImage itk::OpenCLContext::CreateImageHost ( const OpenCLImageFormat format,
void *  data,
const OpenCLSize size,
const OpenCLMemoryObject::Access  access 
)

Creates a OpenCL image object with the specified format, size, and access mode. If data is not null, then it will be used as the storage for the image. If data is null, then a new block of host-accessible memory will be allocated. Returns the new OpenCL image object, or a null object if the image could not be created.

See also
CreateImageDevice(), CreateImageCopy()

◆ CreateOpenCLProgram()

OpenCLProgram itk::OpenCLContext::CreateOpenCLProgram ( const std::string &  filename,
const std::string &  source,
const std::vcl_size_t  sourceSize 
)
protected

◆ CreateProgramFromBinaryCode()

OpenCLProgram itk::OpenCLContext::CreateProgramFromBinaryCode ( const unsigned char *  binary,
const std::vcl_size_t  size 
)

Creates an OpenCL program object from binary for GetDefaultDevice(). This function can only load the binary for a single device. For multiple devices, use CreateProgramFromBinaries() instead.

See also
CreateProgramFromBinaryFile(), CreateProgramFromBinaries()

◆ CreateProgramFromSourceCode()

OpenCLProgram itk::OpenCLContext::CreateProgramFromSourceCode ( const std::string &  sourceCode,
const std::string &  prefixSourceCode = std::string(),
const std::string &  postfixSourceCode = std::string() 
)

Creates an OpenCL program object from the supplied STL strings sourceCode, prefixSourceCode and postfixSourceCode.

See also
CreateProgramFromSourceFile(), BuildProgramFromSourceCode()

◆ CreateProgramFromSourceFile()

OpenCLProgram itk::OpenCLContext::CreateProgramFromSourceFile ( const std::string &  filename,
const std::string &  prefixSourceCode = std::string(),
const std::string &  postfixSourceCode = std::string() 
)

Creates an OpenCL program object from the contents of the specified by the STL string filename, prefixSourceCode and postfixSourceCode.

See also
CreateProgramFromSourceCode(), BuildProgramFromSourceFile()

◆ CreateSampler()

OpenCLSampler itk::OpenCLContext::CreateSampler ( const bool  normalizedCoordinates,
const OpenCLSampler::AddressingMode  addressingMode,
const OpenCLSampler::FilterMode  filterMode 
)

Creates a sampler for this context from the arguments normalizedCoordinates, addressingMode, and filterMode.

◆ CreateUserEvent()

OpenCLUserEvent itk::OpenCLContext::CreateUserEvent ( )

Creates a user event. User events allow applications to enqueue commands that wait on a user event to finish before the command is executed by the device. Commands that depend upon the user event will not be executed until the application triggers the user event with SetComplete().

◆ CreateVector()

template<typename T >
OpenCLVector< T > itk::OpenCLContext::CreateVector ( const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size 
)
inline

Creates a host-accessible vector of size elements of type T on this context and returns it. The elements will be initially in an undefined state. Note that the access mode indicates how the OpenCL device (e.g. GPU) will access the vector. When the host maps the vector, it will always be mapped as ReadWrite.

See also
CreateBufferHost()

Definition at line 291 of file itkOpenCLContext.h.

◆ Finish()

void itk::OpenCLContext::Finish ( )

Blocks until all previously queued commands on the active command queue have finished execution.

See also
Flush()

◆ Flush()

void itk::OpenCLContext::Flush ( )

Flushes all previously queued commands to the device associated with the active command queue. The commands are delivered to the device, but no guarantees are given that they will be executed.

See also
Finish()

◆ GetActiveQueue()

cl_command_queue itk::OpenCLContext::GetActiveQueue ( )
private

Quick get active queue method for friend classes.

◆ GetClassName()

virtual const char * itk::OpenCLContext::GetClassName ( ) const
virtual

Run-time type information (and related methods).

◆ GetCommandQueue()

OpenCLCommandQueue itk::OpenCLContext::GetCommandQueue ( )

Returns the context's active command queue, which will be GetDefaultCommandQueue() if the queue has not yet been set.

See also
SetCommandQueue(), GetDefaultCommandQueue()

◆ GetContextId()

cl_context itk::OpenCLContext::GetContextId ( ) const

Returns the native OpenCL context identifier associated with this object.

See also
SetContextId()

◆ GetDefaultCommandQueue()

OpenCLCommandQueue itk::OpenCLContext::GetDefaultCommandQueue ( )

Returns the default command queue for GetDefaultDevice(). If the queue has not been created, it will be created with the default properties of in-order execution of commands, and profiling disabled. Use CreateCommandQueue() to create a queue that supports out-of-order execution or profiling. For example:

OpenCLCommandQueue queue = context.CreateCommandQueue(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
context.SetCommandQueue(queue);
The OpenCLCommandQueue class represents an OpenCL a command-queue on a specific device and valid Open...
See also
GetCommandQueue(), CreateCommandQueue(), GetLastError()

◆ GetDefaultDevice()

OpenCLDevice itk::OpenCLContext::GetDefaultDevice ( ) const

Returns the default device in use by this context, which is typically the first element of the GetDevices() list or a null OpenCLDevice if the context has not been created yet.

See also
GetDevices()

◆ GetDevices()

std::list< OpenCLDevice > itk::OpenCLContext::GetDevices ( ) const

Returns the list of devices that are in use by this context. If the context has not been created, returns an empty list.

See also
GetDefaultDevice()

◆ GetErrorName()

static std::string itk::OpenCLContext::GetErrorName ( const cl_int  code)
static

Returns the name of the supplied OpenCL error code. For example, {CL_SUCCESS}, {CL_INVALID_CONTEXT}, etc.

See also
GetLastError()

◆ GetInstance()

static Pointer itk::OpenCLContext::GetInstance ( )
static

Return the singleton instance with no reference counting.

◆ GetLastError()

cl_int itk::OpenCLContext::GetLastError ( ) const

Returns the last OpenCL error that occurred while executing an operation on this context or any of the objects created by the context. Returns {CL_SUCCESS} if the last operation succeeded.

See also
SetLastError(), GetErrorName()

◆ GetSupportedImageFormats()

std::list< OpenCLImageFormat > itk::OpenCLContext::GetSupportedImageFormats ( const OpenCLImageFormat::ImageType  image_type,
const cl_mem_flags  flags 
) const

Returns the list of supported image formats for processing images with the specified image type image_type and memory flags.

◆ IsCreated()

bool itk::OpenCLContext::IsCreated ( ) const

Returns true if the underlying OpenCL GetContextId() has been created, false otherwise.

See also
Create(), SetContextId()

◆ Marker()

cl_int itk::OpenCLContext::Marker ( const OpenCLEventList event_list)

Enqueues a marker command which waits for either a list of events to complete, or if the list is empty it waits for all commands previously enqueued in command_queue to complete before it completes.

See also
MarkerAsync()

◆ MarkerAsync()

OpenCLEvent itk::OpenCLContext::MarkerAsync ( const OpenCLEventList event_list)

Asynchronous version of the Marker() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
Marker()

◆ New()

static Pointer itk::OpenCLContext::New ( )
static

This is a singleton pattern New. There will only be ONE reference to a OpenCLContext object per process. Clients that call this must call Delete on the object so that the reference counting will work. The single instance will be unreferenced when the program exits.

◆ OpenCLDebug()

void itk::OpenCLContext::OpenCLDebug ( const std::string &  callname)
private

◆ OpenCLProfile()

void itk::OpenCLContext::OpenCLProfile ( cl_event  clEvent,
const std::string &  message,
const bool  releaseEvent = false 
)
protected

◆ operator=()

const Self & itk::OpenCLContext::operator= ( const Self )
private

◆ Release()

virtual void itk::OpenCLContext::Release ( )
virtual

Releases this context, destroying it if the reference count is zero. Does nothing if the context has not been created or is already released.

See also
Create()

◆ ReportError()

void itk::OpenCLContext::ReportError ( const cl_int  code,
const char *  fileName = "",
const int  lineNumber = 0,
const char *  location = "" 
)

Report the error based on OpenCL error code with exception object.

◆ SetCommandQueue()

void itk::OpenCLContext::SetCommandQueue ( const OpenCLCommandQueue queue)

Sets the context's active command queue. If queue is null, then GetDefaultCommandQueue() will be used.

See also
GetCommandQueue(), GetDefaultCommandQueue()

◆ SetContextId()

void itk::OpenCLContext::SetContextId ( cl_context  id)

Sets the native OpenCL context identifier associated with this object to id. This function will call {clRetainContext()} to increase the reference count on id. If the identifier was previously set to something else, then {clReleaseContext()} will be called on the previous value.

See also
GetContextId(), Create()

◆ SetDefaultDevice()

void itk::OpenCLContext::SetDefaultDevice ( const OpenCLDevice device)
protected

◆ SetInstance()

static void itk::OpenCLContext::SetInstance ( OpenCLContext instance)
static

Supply a user defined OpenCL context. Call ->Delete() on the supplied instance after setting it.

◆ SetLastError()

void itk::OpenCLContext::SetLastError ( const cl_int  error)

Sets the last error code to error.

See also
GetLastError(), GetErrorName()

◆ SetUpProfiling()

void itk::OpenCLContext::SetUpProfiling ( )
private

◆ WaitForFinished()

static cl_int itk::OpenCLContext::WaitForFinished ( const OpenCLEventList event_list)
static

Waits on the host thread for commands identified by event objects in event_list to complete. A command is considered complete if its execution status is {CL_COMPLETE} or a negative value. The events specified in event_list act as synchronization points.

Friends And Related Function Documentation

◆ OpenCLBuffer

friend class OpenCLBuffer
friend

Definition at line 499 of file itkOpenCLContext.h.

◆ OpenCLCommandQueue

friend class OpenCLCommandQueue
friend

Definition at line 502 of file itkOpenCLContext.h.

◆ OpenCLImage

friend class OpenCLImage
friend

Definition at line 500 of file itkOpenCLContext.h.

◆ OpenCLKernel

friend class OpenCLKernel
friend

Definition at line 501 of file itkOpenCLContext.h.

◆ OpenCLMemoryObject

friend class OpenCLMemoryObject
friend

friends from OpenCL core

Definition at line 498 of file itkOpenCLContext.h.

◆ OpenCLProgram

friend class OpenCLProgram
friend

Definition at line 503 of file itkOpenCLContext.h.

◆ OpenCLSampler

friend class OpenCLSampler
friend

Definition at line 505 of file itkOpenCLContext.h.

◆ OpenCLVectorBase

friend class OpenCLVectorBase
friend

Definition at line 504 of file itkOpenCLContext.h.

Field Documentation

◆ d_ptr

std::unique_ptr< OpenCLContextPimpl > itk::OpenCLContext::d_ptr
private

Definition at line 472 of file itkOpenCLContext.h.

◆ m_Instance

Pointer itk::OpenCLContext::m_Instance
staticprivate

Definition at line 473 of file itkOpenCLContext.h.



Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo