SoOpenCLContext Class Reference
[OpenCL device]

VSG extension OpenCL device context API More...

#include <Inventor/devices/SoOpenCLContext.h>

Inheritance diagram for SoOpenCLContext:
SoDeviceContext SoRefCounter

List of all members.

Public Member Functions

 SoOpenCLContext (SoOpenCLDevice *device)
void bind ()
void unbind ()
virtual bool isCurrent () const
virtual bool isCompatible (SoDeviceContext *context) const
cl_context getOpenCLContext () const
cl_command_queue getOpenCLCommandQueue () const
SoOpenCLDevicegetDevice () const

Static Public Member Functions

static SoOpenCLContextgetCurrent ()

Detailed Description

VSG extension OpenCL device context API

This class provides functions to manage OpenCL contexts. Each context defines a private working area for the threads which use it.

Before using any OpenCL contexts the application must initialize the Open Inventor OpenCL module by calling SoCuda::init().

A valid OpenCL context is required to use OpenCL buffer objects, to call OpenCL functions or to execute OpenCL algorithms (e.g. SoOpenCLConvolution).

The context can only be current for one thread at a time. If thread1 binds a context, then any other thread that tries to bind the context will block until thread1 unbinds the context.

Notes:

EXAMPLE

SEE ALSO

SoOpenCL, SoOpenCLApi, SoOpenCLDevice, SoOpenCLBufferObject, SoOpenCLArithmetic, SoOpenCLConversion, SoOpenCLConvolution, SoOpenCLSeismic


Constructor & Destructor Documentation

SoOpenCLContext::SoOpenCLContext ( SoOpenCLDevice device  ) 

Regular constructor.

Parameters:
device Device on which to create the context.

Member Function Documentation

void SoOpenCLContext::bind (  )  [virtual]

Bind this context to the current thread.

NOTES

    When the context is bound it is locked, so if a separate thread trys to bind it, that thread will be locked until the first thread calls the unbind function.

    Implements SoDeviceContext.

static SoOpenCLContext* SoOpenCLContext::getCurrent (  )  [static]

Returns the currently bound context (if any) for the current thread.

Returns:
The current OpenCL context.
SoOpenCLDevice* SoOpenCLContext::getDevice (  )  const [inline]

Return attached device.

cl_command_queue SoOpenCLContext::getOpenCLCommandQueue (  )  const [inline]

OpenCL context accessor.

cl_context SoOpenCLContext::getOpenCLContext (  )  const [inline]

OpenCL context accessor.

virtual bool SoOpenCLContext::isCompatible ( SoDeviceContext context  )  const [virtual]

Indicates if the specified context and this one are compatible.


Compatible means that using a buffer from one of these contexts inside the other will not require copying the data.

Parameters:
context The context to compare with this one.
Returns:
True if the specified context is compatible with this one.
virtual bool SoOpenCLContext::isCurrent (  )  const [virtual]

Query if the context is valid and currently active.

Implements SoDeviceContext.

void SoOpenCLContext::unbind (  )  [virtual]

Unbind this context from the current thread and unlock it.


After this call the context can be bound in any thread.

Implements SoDeviceContext.


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/