SoCudaContext Class Reference
[CUDA device]

VSG extension CUDA context management class More...

#include <Inventor/devices/SoCudaContext.h>

Inheritance diagram for SoCudaContext:
SoDeviceContext SoRefCounter

List of all members.

Public Member Functions

 SoCudaContext (SoCudaDevice *device)
void bind ()
void unbind ()
virtual bool isCurrent () const
virtual bool isCompatible (SoDeviceContext *context) const

Static Public Member Functions

static SoCudaContextgetCurrent ()

Detailed Description

VSG extension CUDA context management class

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

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

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

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.

EXAMPLE

SEE ALSO

SoCuda, SoCudaApi, SoCudaDevice, SoCudaBufferObject, SoCudaArithmetic, SoCudaConversion, SoCudaConvolution, SoCudaSeismic

See related examples:

ComputeSlice, CudaMarchingCubes


Constructor & Destructor Documentation

SoCudaContext::SoCudaContext ( SoCudaDevice device  ) 

Regular constructor.

Parameters:
device Device on which to create the context.

Member Function Documentation

void SoCudaContext::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 SoCudaContext* SoCudaContext::getCurrent (  )  [static]

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

Returns:
The current CUDA context.
virtual bool SoCudaContext::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 SoCudaContext::isCurrent (  )  const [virtual]

Query if the context is valid and currently active.

Implements SoDeviceContext.

void SoCudaContext::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 by FEI reference manual, generated on 19 Aug 2019
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/