Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
BIAS::clfContext Class Reference

OpenCL Context wrapper. More...

#include <OpenCLFramework/clfContext.hh>

Public Types

enum  clfDeviceType { clfContextTypeCPU = 0, clfContextTypeGPU }
 

Public Member Functions

void AcquireGLObject (clfMemory &buffer)
 acquire a buffer allocated from opengl, call glfinish first! More...
 
 clfContext (bool useGLsharing=false, clfDeviceType deviceType=clfContextTypeGPU)
 Create clfContext for first GPU device found. More...
 
clfBufferCreateBuffer ()
 create buffer object More...
 
clfImage2DCreateImage2D ()
 create buffer object More...
 
clfImage3DCreateImage3D ()
 create buffer object More...
 
clfProgramCreateProgram ()
 create program object More...
 
int DivUp (const int mod, int val)
 
void Finish ()
 force finishing the command queue More...
 
unsigned int GetActiveDevice ()
 
clfDeviceInfo GetDeviceInfo (unsigned int device=0)
 
unsigned int GetNumDevices ()
 
bool IsSharedGLContext ()
 
void PrintDeviceInfo (unsigned int device=0, bool verbose=false, std::ostream &out=std::cout)
 print info on computing device More...
 
void PrintPlatformsInfo (std::ostream &out=std::cout)
 print info on available platforms More...
 
void ReleaseGLObject (clfMemory &buffer)
 release a buffer allocated from opengl, call Finish first! More...
 
void RunOn1DRange (clfProgram &program, std::string kernelname, unsigned int globalrange, unsigned int localrange=0)
 run a kernel on a 1D memory range More...
 
void RunOn2DRange (clfProgram &program, std::string kernelname, unsigned int globalrangeX, unsigned int globalrangeY, unsigned int localrangeX=0, unsigned int localrangeY=0)
 run a kernel on a 2D memory range More...
 
void RunOn3DRange (clfProgram &program, std::string kernelname, unsigned int globalrangeX, unsigned int globalrangeY, unsigned int globalrangeZ, unsigned int localrangeX=0, unsigned int localrangeY=0, unsigned int localrangeZ=0)
 run a kernel on a 3D memory range More...
 
void SetActiveDevice (unsigned int device)
 
virtual ~clfContext ()
 deletes context and queue, making objects created from this context invalid! More...
 

Protected Member Functions

void QueryDeviceInfo_ (unsigned int device=0)
 

Static Protected Member Functions

static void clnotify (const char *p1, const void *p2, size_t p3, clfContext *p4)
 internal notification function for status from clf context More...
 

Detailed Description

OpenCL Context wrapper.

OpenCLContext bundles one context and one command queue. After creation, use OpenCLContext to instantiate buffer objects and programs valid for this context.

Author
fkellner 06/11

Definition at line 49 of file clfContext.hh.

Member Enumeration Documentation

Enumerator
clfContextTypeCPU 
clfContextTypeGPU 

Definition at line 51 of file clfContext.hh.

Constructor & Destructor Documentation

BIAS::clfContext::clfContext ( bool  useGLsharing = false,
clfDeviceType  deviceType = clfContextTypeGPU 
)

Create clfContext for first GPU device found.

Parameters
useGLsharingtrue if you want to share GL objects. A valid GL context must be available!

Definition at line 39 of file clfContext.cpp.

BIAS::clfContext::~clfContext ( )
virtual

deletes context and queue, making objects created from this context invalid!

Definition at line 118 of file clfContext.cpp.

Member Function Documentation

void BIAS::clfContext::AcquireGLObject ( clfMemory buffer)

acquire a buffer allocated from opengl, call glfinish first!

Parameters
bufferthe buffer object

Definition at line 271 of file clfContext.cpp.

References BIAS::clfMemory::memory().

Referenced by BIAS::clfTrimmedICP::ComputeNearestPoints_(), and BIAS::clfTrimmedICP::ComputeOptimalMotion_().

void BIAS::clfContext::clnotify ( const char *  p1,
const void *  p2,
size_t  p3,
clfContext p4 
)
staticprotected

internal notification function for status from clf context

Definition at line 121 of file clfContext.cpp.

clfBuffer* BIAS::clfContext::CreateBuffer ( )
inline
clfImage2D* BIAS::clfContext::CreateImage2D ( )
inline
clfImage3D* BIAS::clfContext::CreateImage3D ( )
inline

create buffer object

Returns
buffer bound to context

Definition at line 95 of file clfContext.hh.

clfProgram* BIAS::clfContext::CreateProgram ( )
inline
int BIAS::clfContext::DivUp ( const int  mod,
int  val 
)
void BIAS::clfContext::Finish ( )
unsigned int BIAS::clfContext::GetActiveDevice ( )

Definition at line 411 of file clfContext.cpp.

clfDeviceInfo BIAS::clfContext::GetDeviceInfo ( unsigned int  device = 0)
inline
unsigned int BIAS::clfContext::GetNumDevices ( )
inline

Definition at line 137 of file clfContext.hh.

bool BIAS::clfContext::IsSharedGLContext ( )
inline

Definition at line 145 of file clfContext.hh.

Referenced by BIAS::clfAlgorithm::InitInternal_().

void BIAS::clfContext::PrintDeviceInfo ( unsigned int  device = 0,
bool  verbose = false,
std::ostream &  out = std::cout 
)

print info on computing device

Definition at line 127 of file clfContext.cpp.

void BIAS::clfContext::PrintPlatformsInfo ( std::ostream &  out = std::cout)

print info on available platforms

Definition at line 204 of file clfContext.cpp.

void BIAS::clfContext::QueryDeviceInfo_ ( unsigned int  device = 0)
protected

Definition at line 297 of file clfContext.cpp.

void BIAS::clfContext::ReleaseGLObject ( clfMemory buffer)

release a buffer allocated from opengl, call Finish first!

Parameters
bufferthe buffer object

Definition at line 280 of file clfContext.cpp.

References BIAS::clfMemory::memory().

Referenced by BIAS::clfTrimmedICP::ComputeNearestPoints_(), and BIAS::clfTrimmedICP::ComputeOptimalMotion_().

void BIAS::clfContext::RunOn1DRange ( clfProgram program,
std::string  kernelname,
unsigned int  globalrange,
unsigned int  localrange = 0 
)

run a kernel on a 1D memory range

Parameters
globalrangeoverall memory size in byte, should be multiple of compute units on device
localrangememory range in byte handled by each thread, should be even divisor of compute units on device (or 0)

Definition at line 220 of file clfContext.cpp.

Referenced by BIAS::clfRadixSort::ApplyPermutation(), BIAS::clfTrimmedICP::ComputeNearestPoints_(), BIAS::clfTrimmedICP::ComputeOptimalMotion_(), BIAS::clfRecursiveGauss::FilterGrey(), BIAS::clfRecursiveGauss::FilterGreyColPacked(), BIAS::clfRecursiveGauss::FilterX(), BIAS::clfRecursiveGauss::FilterY(), BIAS::clfRadixSort::Histogram(), BIAS::clfRadixSort::Reorder(), and BIAS::clfRadixSort::ScanHistogram().

void BIAS::clfContext::RunOn2DRange ( clfProgram program,
std::string  kernelname,
unsigned int  globalrangeX,
unsigned int  globalrangeY,
unsigned int  localrangeX = 0,
unsigned int  localrangeY = 0 
)
void BIAS::clfContext::RunOn3DRange ( clfProgram program,
std::string  kernelname,
unsigned int  globalrangeX,
unsigned int  globalrangeY,
unsigned int  globalrangeZ,
unsigned int  localrangeX = 0,
unsigned int  localrangeY = 0,
unsigned int  localrangeZ = 0 
)

run a kernel on a 3D memory range

Definition at line 251 of file clfContext.cpp.

void BIAS::clfContext::SetActiveDevice ( unsigned int  device)

Definition at line 403 of file clfContext.cpp.

Referenced by BIAS::clfAlgorithm::InitInternal_().


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