23#ifndef itkGPUKernelManager_h
24#define itkGPUKernelManager_h
76 GetDeviceInfo(cl_kernel_work_group_info paramName,
size_t argSize,
void * argValue);
79 SetKernelArg(
int kernelIdx, cl_uint argIdx,
size_t argSize,
const void * argVal);
118 template <
typename TGPUImageDataManager>
130 errid = clSetKernelArg(
m_KernelContainer[kernelIdx], argIdx,
sizeof(cl_mem), manager->GetGPUBufferPointer());
143 manager->GetModifiableGPUBufferedRegionIndex()->GetGPUBufferPointer());
147 m_KernelArgumentReady[kernelIdx][argIdx].m_GPUDataManager = manager->GetModifiableGPUBufferedRegionIndex();
154 manager->GetModifiableGPUBufferedRegionSize()->GetGPUBufferPointer());
158 m_KernelArgumentReady[kernelIdx][argIdx].m_GPUDataManager = manager->GetModifiableGPUBufferedRegionSize();
165 LaunchKernel(
int kernelIdx,
int dim,
size_t * globalWorkSize,
size_t * localWorkSize);
172 size_t globalWorkSizeX,
173 size_t globalWorkSizeY,
174 size_t localWorkSizeX,
175 size_t localWorkSizeY);
179 size_t globalWorkSizeX,
180 size_t globalWorkSizeY,
181 size_t globalWorkSizeZ,
182 size_t localWorkSizeX,
183 size_t localWorkSizeY,
184 size_t localWorkSizeZ);
211 template <
typename TArg>
Singleton class to store the GPU context.
GPU memory manager implemented using OpenCL. Required by GPUImage class.
GPU kernel manager implemented using OpenCL.
~GPUKernelManager() override
bool SetKernelArgWithLongLong(int kernelIdx, cl_uint argIdx, long long argVal)
bool LaunchKernel3D(int kernelIdx, vcl_size_t globalWorkSizeX, vcl_size_t globalWorkSizeY, vcl_size_t globalWorkSizeZ, vcl_size_t localWorkSizeX, vcl_size_t localWorkSizeY, vcl_size_t localWorkSizeZ)
cl_int GetKernelWorkGroupInfo(int kernelIdx, cl_kernel_work_group_info paramName, void *value)
bool SetKernelArgWithULongLong(int kernelIdx, cl_uint argIdx, unsigned long long argVal)
bool SetKernelArgWithChar(int kernelIdx, cl_uint argIdx, char argVal)
bool LaunchKernel2D(int kernelIdx, vcl_size_t globalWorkSizeX, vcl_size_t globalWorkSizeY, vcl_size_t localWorkSizeX, vcl_size_t localWorkSizeY)
bool SetKernelArgWithUShort(int kernelIdx, cl_uint argIdx, unsigned short argVal)
bool SetKernelArgWithFloat(int kernelIdx, cl_uint argIdx, float argVal)
bool LoadProgramFromString(const char *cSource, const char *cPreamble="")
bool SetKernelArg(int kernelIdx, cl_uint argIdx, vcl_size_t argSize, const void *argVal)
void ResetArguments(int kernelIdx)
int GetCurrentCommandQueueID() const
void SetCurrentCommandQueue(int queueid)
bool SetKernelArgWithShort(int kernelIdx, cl_uint argIdx, short argVal)
bool SetKernelArgWithDouble(int kernelIdx, cl_uint argIdx, double argVal)
bool LaunchKernel1D(int kernelIdx, vcl_size_t globalWorkSize, vcl_size_t localWorkSize)
bool SetKernelArgWithInt(int kernelIdx, cl_uint argIdx, int argVal)
bool SetTypedKernelArg(int kernelIdx, cl_uint argIdx, TArg argVal)
std::vector< cl_kernel > m_KernelContainer
bool LaunchKernel(int kernelIdx, int dim, vcl_size_t *globalWorkSize, vcl_size_t *localWorkSize)
cl_int GetDeviceInfo(cl_kernel_work_group_info paramName, vcl_size_t argSize, void *argValue)
GPUContextManager * m_Manager
bool SetKernelArgWithImageAndBufferedRegion(int kernelIdx, cl_uint &argIdx, TGPUImageDataManager *manager)
int CreateKernel(const char *kernelName)
bool LoadProgramFromFile(const char *filename, const char *cPreamble="")
bool SetKernelArgWithUInt(int kernelIdx, cl_uint argIdx, unsigned int argVal)
bool SetKernelArgWithUChar(int kernelIdx, cl_uint argIdx, unsigned char argVal)
std::vector< std::vector< KernelArgumentList > > m_KernelArgumentReady
bool CheckArgumentReady(int kernelIdx)
bool SetKernelArgWithImage(int kernelIdx, cl_uint argIdx, GPUDataManager *manager)
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
void OpenCLCheckError(cl_int error, const char *filename="", int lineno=0, const char *location="")
GPUDataManager::Pointer m_GPUDataManager