opencl_utils.h File Reference
#include <CL/cl.h>
#include <fstream>
Go to the source code of this file.
Defines |
#define | oclCheckError(a, b) oclCheckErrorEX(a, b, 0) |
#define | oclCheckErrorEX(a, b, c) __oclCheckErrorEX(a, b, c, __FILE__ , __LINE__) |
Functions |
void | __oclCheckErrorEX (cl_int iSample, cl_int iReference, void(*pCleanup)(int), const char *cFile, const int iLine) |
cl_context | dxGetDeviceContext () |
cl_command_queue | dxGetDeviceQueue () |
void | dxGlobalSync () |
void | dxInitDevice () |
void | dxShutdownDevice () |
const char * | oclErrorString (cl_int error) |
char * | oclFindFilePath (const char *filename, const char *executablePath) |
cl_device_id | oclGetFirstDev (cl_context cxGPUContext) |
cl_context | oclGetGlobalContext () |
cl_command_queue | oclGetGlobalQueue () |
cl_int | oclGetPlatformID (cl_platform_id *clSelectedPlatformID) |
void | oclGetProgBinary (cl_program cpProgram, cl_device_id cdDevice, char **binary, size_t *length) |
void | oclInit () |
void | oclInitializeKernels (cl_context cxGPUContext, cl_command_queue cqCommandQueue) |
char * | oclLoadProgSource (const char *cFilename, const char *cPreamble, size_t *szFinalLength) |
void | oclLogBuildInfo (cl_program cpProgram, cl_device_id cdDevice) |
void | oclLogPtx (cl_program cpProgram, cl_device_id cdDevice, const char *cPtxFileName) |
void | oclShutdown (cl_context clContext, cl_command_queue clQueue) |
void | oclShutdownKernels (void) |
Define Documentation
#define oclCheckError |
( |
a, |
|
|
b |
|
) |
oclCheckErrorEX(a, b, 0) |
#define oclCheckErrorEX |
( |
a, |
|
|
b, |
|
|
c |
|
) |
__oclCheckErrorEX(a, b, c, __FILE__ , __LINE__) |
Function Documentation
void __oclCheckErrorEX |
( |
cl_int |
iSample, |
|
|
cl_int |
iReference, |
|
|
void(*)(int) |
pCleanup, |
|
|
const char * |
cFile, |
|
|
const int |
iLine | |
|
) |
| | [inline] |
cl_context dxGetDeviceContext |
( |
|
) |
[inline] |
cl_command_queue dxGetDeviceQueue |
( |
|
) |
[inline] |
void dxGlobalSync |
( |
|
) |
[inline] |
void dxInitDevice |
( |
|
) |
[inline] |
void dxShutdownDevice |
( |
|
) |
[inline] |
const char* oclErrorString |
( |
cl_int |
error |
) |
|
char* oclFindFilePath |
( |
const char * |
filename, |
|
|
const char * |
executablePath | |
|
) |
| | |
cl_device_id oclGetFirstDev |
( |
cl_context |
cxGPUContext |
) |
|
Get the first device associated with the given context
- Returns:
- the first device id associated with the context
- Parameters:
-
| cxGPUContext | the context with which the device is associated |
Definition at line 96 of file opencl_utils.cpp.
cl_context oclGetGlobalContext |
( |
|
) |
|
cl_command_queue oclGetGlobalQueue |
( |
|
) |
|
cl_int oclGetPlatformID |
( |
cl_platform_id * |
clSelectedPlatformID |
) |
|
Gets the platform ID for NVIDIA if available, otherwise default
- Returns:
- the id
- Parameters:
-
| clSelectedPlatformID | OpenCL platoform ID |
Definition at line 30 of file opencl_utils.cpp.
void oclGetProgBinary |
( |
cl_program |
cpProgram, |
|
|
cl_device_id |
cdDevice, |
|
|
char ** |
binary, |
|
|
size_t * |
length | |
|
) |
| | |
Get the binary (PTX) of the program associated with the device
- Parameters:
-
| cpProgram | OpenCL program |
| cdDevice | device of interest |
| binary | returned code |
| length | length of returned code |
Definition at line 211 of file opencl_utils.cpp.
Initializes the global context and command queue
Definition at line 116 of file opencl_utils.cpp.
void oclInitializeKernels |
( |
cl_context |
cxGPUContext, |
|
|
cl_command_queue |
cqCommandQueue | |
|
) |
| | |
char* oclLoadProgSource |
( |
const char * |
cFilename, |
|
|
const char * |
cPreamble, |
|
|
size_t * |
szFinalLength | |
|
) |
| | |
Loads a Program file and prepends the cPreamble to the code.
- Returns:
- the source string if succeeded, 0 otherwise
- Parameters:
-
| cFilename | program filename |
| cPreamble | code that is prepended to the loaded file, typically a set of defines or a header |
| szFinalLength | returned length of the code string |
Definition at line 155 of file opencl_utils.cpp.
void oclLogBuildInfo |
( |
cl_program |
cpProgram, |
|
|
cl_device_id |
cdDevice | |
|
) |
| | |
Get and log the binary (PTX) from the OpenCL compiler for the requested program & device
- Parameters:
-
| cpProgram | OpenCL program |
| cdDevice | device of interest |
Definition at line 328 of file opencl_utils.cpp.
void oclLogPtx |
( |
cl_program |
cpProgram, |
|
|
cl_device_id |
cdDevice, |
|
|
const char * |
cPtxFileName | |
|
) |
| | |
Get and log the binary (PTX) from the OpenCL compiler for the requested program & device
- Parameters:
-
| cpProgram | OpenCL program |
| cdDevice | device of interest |
| const | char* cPtxFileName optional PTX file name |
Definition at line 259 of file opencl_utils.cpp.
void oclShutdown |
( |
cl_context |
clContext, |
|
|
cl_command_queue |
clQueue | |
|
) |
| | |
Releases the global context and command queue
- Parameters:
-
| clContext | the context to release |
| clQueue | the command queue to release |
Definition at line 140 of file opencl_utils.cpp.
void oclShutdownKernels |
( |
void |
|
) |
|