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>
128 cl_int errid = clSetKernelArg(
m_KernelContainer[kernelIdx], argIdx,
sizeof(cl_mem), manager->GetGPUBufferPointer());
141 manager->GetModifiableGPUBufferedRegionIndex()->GetGPUBufferPointer());
145 m_KernelArgumentReady[kernelIdx][argIdx].m_GPUDataManager = manager->GetModifiableGPUBufferedRegionIndex();
152 manager->GetModifiableGPUBufferedRegionSize()->GetGPUBufferPointer());
156 m_KernelArgumentReady[kernelIdx][argIdx].m_GPUDataManager = manager->GetModifiableGPUBufferedRegionSize();
163 LaunchKernel(
int kernelIdx,
int dim,
size_t * globalWorkSize,
size_t * localWorkSize);
170 size_t globalWorkSizeX,
171 size_t globalWorkSizeY,
172 size_t localWorkSizeX,
173 size_t localWorkSizeY);
177 size_t globalWorkSizeX,
178 size_t globalWorkSizeY,
179 size_t globalWorkSizeZ,
180 size_t localWorkSizeX,
181 size_t localWorkSizeY,
182 size_t localWorkSizeZ);
209 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