Superclass for all OpenCL based filter.
More...
#include <mitkOclFilter.h>
|
void | AddSourceFile (const char *filename) |
| Add a source file from the resource files to the OpenCL shader file list. Multiple files can be added to the list. More...
|
|
void | SetCompilerFlags (const char *flags) |
| Set specific compilerflags to compile the CL source. Default is set to nullptr; example: "-cl-fast-relaxed-math -cl-mad-enable -cl-strict-aliasing". More...
|
|
virtual bool | IsInitialized () |
| Returns true if the initialization was successfull. More...
|
|
virtual unsigned long | GetDeviceMemory () |
| Returns the amount of global memory of the used device in bytes. More...
|
|
virtual | ~OclFilter () |
| Destructor. More...
|
|
|
| OclFilter () |
| Constructor. More...
|
|
| OclFilter (const char *filename) |
| Constructor ( overloaded ) More...
|
|
void | SetWorkingSize (unsigned int locx, unsigned int dimx, unsigned int locy=1, unsigned int dimy=1, unsigned int locz=1, unsigned int dimz=1) |
| Set the working size for the following OpenCL kernel call. More...
|
|
bool | ExecuteKernel (cl_kernel kernel, unsigned int workSizeDim) |
| Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes. More...
|
|
bool | ExecuteKernelChunks (cl_kernel kernel, unsigned int workSizeDim, size_t *chunksDim) |
| Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim. More...
|
|
bool | ExecuteKernelChunksInBatches (cl_kernel kernel, unsigned int workSizeDim, size_t *chunksDim, size_t batchSize, int waitTimems) |
| Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim and wait between batches of batchSize chunks a time of waitTimems milliseconds. More...
|
|
bool | Initialize () |
| Initialize all necessary parts of the filter. More...
|
|
void | CompileSource () |
| Compile the program source. More...
|
|
void | SetSourcePreambel (const char *preambel) |
| Add some source code on the beginning of the loaded source. More...
|
|
virtual us::Module * | GetModule ()=0 |
| Get the Module of the filter. Needs to be implemented by every subclass. The filter will load the OpenCL sourcefiles from this module context. More...
|
|
void | LoadSourceFiles (CStringList &SourceCodeList, ClSizeList &SourceCodeSizeList) |
| Helper functions that load sourcefiles from the module context in the Initialize function. More...
|
|
Superclass for all OpenCL based filter.
This class takes care of loading and compiling the external GPU program code.
Definition at line 33 of file mitkOclFilter.h.
◆ ClSizeList
◆ CStringList
◆ ~OclFilter()
virtual mitk::OclFilter::~OclFilter |
( |
| ) |
|
|
virtual |
◆ OclFilter() [1/2]
mitk::OclFilter::OclFilter |
( |
| ) |
|
|
protected |
◆ OclFilter() [2/2]
mitk::OclFilter::OclFilter |
( |
const char * |
filename | ) |
|
|
protected |
Constructor ( overloaded )
◆ AddSourceFile()
void mitk::OclFilter::AddSourceFile |
( |
const char * |
filename | ) |
|
Add a source file from the resource files to the OpenCL shader file list. Multiple files can be added to the list.
- Parameters
-
filename | of the file in the resource system |
◆ CompileSource()
void mitk::OclFilter::CompileSource |
( |
| ) |
|
|
protected |
Compile the program source.
◆ ExecuteKernel()
bool mitk::OclFilter::ExecuteKernel |
( |
cl_kernel |
kernel, |
|
|
unsigned int |
workSizeDim |
|
) |
| |
|
protected |
Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes.
◆ ExecuteKernelChunks()
bool mitk::OclFilter::ExecuteKernelChunks |
( |
cl_kernel |
kernel, |
|
|
unsigned int |
workSizeDim, |
|
|
size_t * |
chunksDim |
|
) |
| |
|
protected |
Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim.
◆ ExecuteKernelChunksInBatches()
bool mitk::OclFilter::ExecuteKernelChunksInBatches |
( |
cl_kernel |
kernel, |
|
|
unsigned int |
workSizeDim, |
|
|
size_t * |
chunksDim, |
|
|
size_t |
batchSize, |
|
|
int |
waitTimems |
|
) |
| |
|
protected |
Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim and wait between batches of batchSize chunks a time of waitTimems milliseconds.
◆ GetDeviceMemory()
virtual unsigned long mitk::OclFilter::GetDeviceMemory |
( |
| ) |
|
|
virtual |
Returns the amount of global memory of the used device in bytes.
◆ GetModule()
virtual us::Module* mitk::OclFilter::GetModule |
( |
| ) |
|
|
protectedpure virtual |
Get the Module of the filter. Needs to be implemented by every subclass. The filter will load the OpenCL sourcefiles from this module context.
Implemented in mitk::OclBinaryThresholdImageFilter.
◆ Initialize()
bool mitk::OclFilter::Initialize |
( |
| ) |
|
|
protected |
Initialize all necessary parts of the filter.
The Initialize() method creates the command queue and the m_clProgram. The program is either compiled from the given source or taken from the OclResourceManager if the program was compiled already.
◆ IsInitialized()
virtual bool mitk::OclFilter::IsInitialized |
( |
| ) |
|
|
virtual |
Returns true if the initialization was successfull.
◆ LoadSourceFiles()
Helper functions that load sourcefiles from the module context in the Initialize function.
- Parameters
-
SourceCodeList | holds the sourcecode for every file as string, the SourceCodeSizeList holst the size of every file in bytes. |
SourceCodeSizeList | |
◆ SetCompilerFlags()
void mitk::OclFilter::SetCompilerFlags |
( |
const char * |
flags | ) |
|
Set specific compilerflags to compile the CL source. Default is set to nullptr; example: "-cl-fast-relaxed-math -cl-mad-enable -cl-strict-aliasing".
- Parameters
-
flags | to the modulefolder that contains the gpuSource |
◆ SetSourcePreambel()
void mitk::OclFilter::SetSourcePreambel |
( |
const char * |
preambel | ) |
|
|
protected |
Add some source code on the beginning of the loaded source.
In this way, some preprocessor flags for the CL compiler can at the beginning of the filter
- Parameters
-
preambel | Source preambel for e.g. #define commands to be inserted into the OpenCL source |
◆ SetWorkingSize()
void mitk::OclFilter::SetWorkingSize |
( |
unsigned int |
locx, |
|
|
unsigned int |
dimx, |
|
|
unsigned int |
locy = 1 , |
|
|
unsigned int |
dimy = 1 , |
|
|
unsigned int |
locz = 1 , |
|
|
unsigned int |
dimz = 1 |
|
) |
| |
|
protected |
Set the working size for the following OpenCL kernel call.
◆ m_ClCompilerFlags
const char* mitk::OclFilter::m_ClCompilerFlags |
|
protected |
String that contains the compiler flags.
Definition at line 77 of file mitkOclFilter.h.
◆ m_ClFiles
List of sourcefiles that will be compiled for this filter.
Definition at line 92 of file mitkOclFilter.h.
◆ m_ClProgram
cl_program mitk::OclFilter::m_ClProgram |
|
protected |
◆ m_CommandQue
cl_command_queue mitk::OclFilter::m_CommandQue |
|
protected |
◆ m_FilterID
std::string mitk::OclFilter::m_FilterID |
|
protected |
Unique ID of the filter, needs to be specified in the constructor of the derived class.
Definition at line 86 of file mitkOclFilter.h.
◆ m_GlobalWorkSize
size_t mitk::OclFilter::m_GlobalWorkSize[3] |
|
protected |
◆ m_Initialized
bool mitk::OclFilter::m_Initialized |
|
protected |
◆ m_LocalWorkSize
size_t mitk::OclFilter::m_LocalWorkSize[3] |
|
protected |
◆ m_Preambel
const char* mitk::OclFilter::m_Preambel |
|
protected |
source preambel for e.g. #define
commands to be inserted into the OpenCL source
Definition at line 89 of file mitkOclFilter.h.
The documentation for this class was generated from the following file: