Medical Imaging Interaction Toolkit  2016.11.0
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 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

Function Documentation

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

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

Definition at line 430 of file mitkOclUtils.cpp.

Referenced by GetSupportedImageFormats().

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.

Definition at line 362 of file mitkOclUtils.cpp.

References GetOclErrorAsString(), MITK_ERROR, and MITK_WARN.

Referenced by oclCheckError().

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

Definition at line 214 of file mitkOclUtils.cpp.

Referenced by GetOclError(), and mitk::OclImageToImageFilter::InitExec().

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

Definition at line 383 of file mitkOclUtils.cpp.

References CHECK_OCL_ERR, GetImageTypeAsString(), and MITK_INFO.

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.

Definition at line 23 of file mitkOclUtils.cpp.

Referenced by mitk::OclFilter::SetWorkingSize().

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.

Definition at line 370 of file mitkOclUtils.cpp.

References GetOclError(), and MITK_ERROR.

MITKOPENCL_EXPORT cl_int oclGetPlatformID ( cl_platform_id *  selectedPlatform)

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

Definition at line 27 of file mitkOclUtils.cpp.

References MITK_ERROR.

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

Definition at line 517 of file mitkOclUtils.cpp.

References MITK_INFO.

Referenced by mitk::OclFilter::CompileSource().

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

Definition at line 562 of file mitkOclUtils.cpp.

References MITK_INFO.

Referenced by mitk::OclFilter::CompileSource().

MITKOPENCL_EXPORT void oclPrintDeviceInfo ( cl_device_id  )

Prints out the essential support information about current device.

Definition at line 134 of file mitkOclUtils.cpp.

References MITK_INFO.

MITKOPENCL_EXPORT void oclPrintMemObjectInfo ( cl_mem  memobj)

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

Definition at line 54 of file mitkOclUtils.cpp.

References CHECK_OCL_ERR, and MITK_INFO.

Referenced by mitk::OclImage::TransferDataToCPU().