Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitkOclUtils.h File Reference
#include "mitkOpenCL.h"
#include <string>
#include <MitkOpenCLExports.h>

Go to the source code of this file.

Macros

#define CHECK_OCL_ERR(_er)
 

Functions

MITKOPENCL_EXPORT unsigned int iDivUp (unsigned int dividend, unsigned int divisor)
 Method to estimate an integer quotient C from given dividend and divisor higher or equal to the corresponding floating quotient. More...
 
MITKOPENCL_EXPORT std::string GetOclErrorAsString (int _clErr)
 Returns the name of an OpenCL Error as a string. More...
 
MITKOPENCL_EXPORT void GetOclError (int _clErr)
 Checks whether the given value corresponds to an OpenCL Error value and prints this message out as MITK_ERROR if yes. More...
 
MITKOPENCL_EXPORT cl_int oclGetPlatformID (cl_platform_id *selectedPlatform)
 Returns a platform ID of an OpenCL-capable GPU, or throws an exception. More...
 
MITKOPENCL_EXPORT void oclPrintDeviceInfo (cl_device_id)
 Prints out the essential support information about current device. More...
 
MITKOPENCL_EXPORT cl_ulong oclGetGlobalMemSize (cl_device_id device)
 Returns the Global memory size of the current device. More...
 
MITKOPENCL_EXPORT void oclPrintMemObjectInfo (cl_mem memobj)
 Prints the available memory info about the given object to std::cout. More...
 
MITKOPENCL_EXPORT bool oclCheckError (int _err, const char *, int)
 Checks the given code for errors and produces a std::cout output if the _err does not equal CL_SUCCESS. The output includes also the filename and the line number of the method call. More...
 
MITKOPENCL_EXPORT void oclLogBinary (cl_program clProg, cl_device_id clDev)
 Logs the GPU Program binary code. More...
 
MITKOPENCL_EXPORT void oclLogBuildInfo (cl_program clProg, cl_device_id clDev)
 Shows the OpenCL-Program build info, called if clBuildProgram != CL_SUCCES. More...
 
MITKOPENCL_EXPORT void GetSupportedImageFormats (cl_context _context, cl_mem_object_type _type)
 Print out all supported image formats for given image type. More...
 
MITKOPENCL_EXPORT std::string GetImageTypeAsString (const unsigned int _in)
 Translates the internal image type identifier to a human readable description string. More...
 

Macro Definition Documentation

◆ CHECK_OCL_ERR

#define CHECK_OCL_ERR (   _er)

Definition at line 21 of file mitkOclUtils.h.

Function Documentation

◆ GetImageTypeAsString()

MITKOPENCL_EXPORT std::string GetImageTypeAsString ( const unsigned int  _in)

Translates the internal image type identifier to a human readable description string.

◆ GetOclError()

MITKOPENCL_EXPORT void GetOclError ( int  _clErr)

Checks whether the given value corresponds to an OpenCL Error value and prints this message out as MITK_ERROR if yes.

◆ GetOclErrorAsString()

MITKOPENCL_EXPORT std::string GetOclErrorAsString ( int  _clErr)

Returns the name of an OpenCL Error as a string.

Most of the OpenCL Methods ( cl<NAME> ) return an integer error code. This method translates the error value given as parameter to the corresponding error name. For example the value -30 will be translated to CL_INVALID_VALUE

◆ GetSupportedImageFormats()

MITKOPENCL_EXPORT void GetSupportedImageFormats ( cl_context  _context,
cl_mem_object_type  _type 
)

Print out all supported image formats for given image type.

Parameters
_typethe image type ( CL_MEM_OBJECT_2D or CL_MEM_OBJECT_3D )
_contextthe OpenCL context to be examined

◆ iDivUp()

MITKOPENCL_EXPORT unsigned int iDivUp ( unsigned int  dividend,
unsigned int  divisor 
)

Method to estimate an integer quotient C from given dividend and divisor higher or equal to the corresponding floating quotient.

If the divisor is a factor of the dividend, the dividend/divisor is an integer value and is returned. If not, the nearest higher integer is returned. So it holds for the return value C that C * divisor is equal or greater then the dividend. In OpenCL context useful for estimating the local/global working dimension of a NDRange so that all image data is covered by the parallelisation scheme.

◆ oclCheckError()

MITKOPENCL_EXPORT bool oclCheckError ( int  _err,
const char *  ,
int   
)

Checks the given code for errors and produces a std::cout output if the _err does not equal CL_SUCCESS. The output includes also the filename and the line number of the method call.

◆ oclGetGlobalMemSize()

MITKOPENCL_EXPORT cl_ulong oclGetGlobalMemSize ( cl_device_id  device)

Returns the Global memory size of the current device.

◆ oclGetPlatformID()

MITKOPENCL_EXPORT cl_int oclGetPlatformID ( cl_platform_id *  selectedPlatform)

Returns a platform ID of an OpenCL-capable GPU, or throws an exception.

◆ oclLogBinary()

MITKOPENCL_EXPORT void oclLogBinary ( cl_program  clProg,
cl_device_id  clDev 
)

Logs the GPU Program binary code.

Parameters
clProgthe OpenCL Program to log
clDevthe OpenCL-capable device the program was tried to be compiled for

◆ oclLogBuildInfo()

MITKOPENCL_EXPORT void oclLogBuildInfo ( cl_program  clProg,
cl_device_id  clDev 
)

Shows the OpenCL-Program build info, called if clBuildProgram != CL_SUCCES.

Parameters
clProgthe OpenCL Program to log
clDevthe OpenCL-capable device the program was tried to be compiled for

◆ oclPrintDeviceInfo()

MITKOPENCL_EXPORT void oclPrintDeviceInfo ( cl_device_id  )

Prints out the essential support information about current device.

◆ oclPrintMemObjectInfo()

MITKOPENCL_EXPORT void oclPrintMemObjectInfo ( cl_mem  memobj)

Prints the available memory info about the given object to std::cout.