Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
icl::utils::CLKernel Class Reference

Wrapper for an OpenCL Kernel. More...

#include <CLKernel.h>

Classes

struct  Arg
 Utility structure for the CLKernel's index operator. More...
 
struct  LocalMemory
 struct that represents the dynamic local memory for a kernel More...
 

Public Member Functions

 CLKernel ()
 Default constructor (creates a dummy instance) More...
 
 CLKernel (const CLKernel &other)
 copy constructor (creates shallow copy) More...
 
CLKernel const & operator= (CLKernel const &other)
 assignment operator (creates shallow copy) More...
 
 ~CLKernel ()
 Destructor. More...
 
void apply (int gloW, int gloH=0, int gloC=0, int locW=0, int locH=0, int locC=0) throw (CLKernelException)
 executes kernel with given global and local coordinates More...
 
void finish () throw (CLKernelException)
 calls the finish-fkt. of opencl to wait until the command queue is done More...
 
void setArg (const unsigned idx, const unsigned int &value) throw (CLKernelException)
 Overloaded Kernel argument setter for unsigned int values. More...
 
void setArg (const unsigned idx, const int &value) throw (CLKernelException)
 Overloaded Kernel argument setter for int values. More...
 
void setArg (const unsigned idx, const short &value) throw (CLKernelException)
 Overloaded Kernel argument setter for short values. More...
 
void setArg (const unsigned idx, const long &value) throw (CLKernelException)
 Overloaded Kernel argument setter for long values. More...
 
void setArg (const unsigned idx, const unsigned long &value) throw (CLKernelException)
 Overloaded Kernel argument setter for unsigned long values. More...
 
void setArg (const unsigned idx, const float &value) throw (CLKernelException)
 Overloaded Kernel argument setter for float values. More...
 
void setArg (const unsigned idx, const double &value) throw (CLKernelException)
 Overloaded Kernel argument setter for double values. More...
 
void setArg (const unsigned idx, const char &value) throw (CLKernelException)
 Overloaded Kernel argument setter for char values. More...
 
void setArg (const unsigned idx, const unsigned char &value) throw (CLKernelException)
 Overloaded Kernel argument setter for unsigned char values. More...
 
void setArg (const unsigned idx, const FixedArray< float, 4 > &value) throw (CLKernelException)
 Overloaded Kernel argument setter for 4D vectors. More...
 
void setArg (const unsigned idx, const FixedArray< float, 3 > &value) throw (CLKernelException)
 Overloaded Kernel argument setter for 3D vectors. More...
 
void setArg (const unsigned idx, const CLBuffer &value) throw (CLKernelException)
 Overloaded Kernel argument setter for CLBuffer values (aka arrays/pointers) More...
 
void setArg (const unsigned idx, const CLImage2D &value) throw (CLKernelException)
 Overloaded Kernel argument setter for CLImage2D values (aka arrays/pointers) More...
 
void setArg (const unsigned idx, const LocalMemory &value) throw (CLKernelException)
 Overloaded Kernel argument setter for dynamic local memory. More...
 
template<typename A >
void setArgs (const A &value) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B >
void setArgs (const A &valueA, const B &valueB) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C >
void setArgs (const A &valueA, const B &valueB, const C &valueC) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL, const M &valueM) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL, const M &valueM, const N &valueN) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL, const M &valueM, const N &valueN, const O &valueO) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O , typename P >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL, const M &valueM, const N &valueN, const O &valueO, const P &valueP) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O , typename P , typename Q >
void setArgs (const A &valueA, const B &valueB, const C &valueC, const D &valueD, const E &valueE, const F &valueF, const G &valueG, const H &valueH, const I &valueI, const J &valueJ, const K &valueK, const L &valueL, const M &valueM, const N &valueN, const O &valueO, const P &valueP, const Q &valueQ) throw (CLKernelException)
 sets mutiple kernel arguments at once More...
 
Arg operator[] (int idx)
 for index operator-based setting of kernel arguments More...
 

Private Member Functions

 CLKernel (const string &id, cl::Program &program, cl::CommandQueue &cmdQueue) throw (CLKernelException)
 private constructor (CLKernel instances can only be created by CLPrograms) More...
 

Private Attributes

Impl * impl
 internal implementation More...
 

Friends

class CLProgram
 for tight integration with the CLProgram class More...
 
class CLDeviceContext
 

Detailed Description

Wrapper for an OpenCL Kernel.

A Kernel is a callable OpenCL function. CLKernel instances can only be created by CLProgram instances. Please refer to the CLProgram reference for further details.

Kernel Arguments

    Before, a Kernel (aka an OpenCL function) is called, its
    arguments have to be set. This can either be done step by step
    using one of the overloaded CLKernel.setArg-methods or using
    the assignment operator or with the templated CLKernel::setArgs method.

    <code>
    kernel.setArgs(inBuffer, outBuffer, inSize, outSize);

or: kernel[0] = inBuffer; kernel[1] = outBuffer; kernel[2] = inSize; kernel[3] = outSize;

Constructor & Destructor Documentation

icl::utils::CLKernel::CLKernel ( const string &  id,
cl::Program &  program,
cl::CommandQueue &  cmdQueue 
)
throw (CLKernelException
)
private

private constructor (CLKernel instances can only be created by CLPrograms)

icl::utils::CLKernel::CLKernel ( )

Default constructor (creates a dummy instance)

icl::utils::CLKernel::CLKernel ( const CLKernel other)

copy constructor (creates shallow copy)

icl::utils::CLKernel::~CLKernel ( )

Destructor.

Member Function Documentation

void icl::utils::CLKernel::apply ( int  gloW,
int  gloH = 0,
int  gloC = 0,
int  locW = 0,
int  locH = 0,
int  locC = 0 
)
throw (CLKernelException
)

executes kernel with given global and local coordinates

gloW can be accessed in the kernel code by get_global_id(0), and so on

void icl::utils::CLKernel::finish ( )
throw (CLKernelException
)

calls the finish-fkt. of opencl to wait until the command queue is done

CLKernel const& icl::utils::CLKernel::operator= ( CLKernel const &  other)

assignment operator (creates shallow copy)

Arg icl::utils::CLKernel::operator[] ( int  idx)
inline

for index operator-based setting of kernel arguments

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const unsigned int &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for unsigned int values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const int &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for int values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const short &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for short values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const long &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for long values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const unsigned long &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for unsigned long values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const float &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for float values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const double &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for double values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const char &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for char values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const unsigned char &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for unsigned char values.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const FixedArray< float, 4 > &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for 4D vectors.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const FixedArray< float, 3 > &  value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for 3D vectors.

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const CLBuffer value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for CLBuffer values (aka arrays/pointers)

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const CLImage2D value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for CLImage2D values (aka arrays/pointers)

void icl::utils::CLKernel::setArg ( const unsigned  idx,
const LocalMemory value 
)
throw (CLKernelException
)

Overloaded Kernel argument setter for dynamic local memory.

template<typename A >
void icl::utils::CLKernel::setArgs ( const A &  value)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL,
const M &  valueM 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL,
const M &  valueM,
const N &  valueN 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL,
const M &  valueM,
const N &  valueN,
const O &  valueO 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O , typename P >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL,
const M &  valueM,
const N &  valueN,
const O &  valueO,
const P &  valueP 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

template<typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I , typename J , typename K , typename L , typename M , typename N , typename O , typename P , typename Q >
void icl::utils::CLKernel::setArgs ( const A &  valueA,
const B &  valueB,
const C &  valueC,
const D &  valueD,
const E &  valueE,
const F &  valueF,
const G &  valueG,
const H &  valueH,
const I &  valueI,
const J &  valueJ,
const K &  valueK,
const L &  valueL,
const M &  valueM,
const N &  valueN,
const O &  valueO,
const P &  valueP,
const Q &  valueQ 
)
throw (CLKernelException
)
inline

sets mutiple kernel arguments at once

Friends And Related Function Documentation

friend class CLDeviceContext
friend
friend class CLProgram
friend

for tight integration with the CLProgram class

Member Data Documentation

Impl* icl::utils::CLKernel::impl
private

internal implementation

internally used data


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