Skip to content

Commit

Permalink
opencl: Fix type of parameter for clGetContextInfo
Browse files Browse the repository at this point in the history
CL_CONTEXT_NUM_DEVICES expects a cl_uint.

Passing size_t results in a wrong value for numDevices on hosts where
sizeof(cl_uint) != sizeof(size_t). This results in errors like these:

  Tesseract Open Source OCR Engine v3.05.00dev with Leptonica
  OpenCL error code is -44 at   when clCreateKernel kernel_HistogramRectAllChannels .
  OpenCL error code is -44 at   when clCreateKernel kernel_HistogramRectAllChannelsReduction .
  OpenCL error code is -48 at   when clSetKernelArg imageBuffer .
  ...

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Nov 12, 2016
1 parent a461592 commit ec5b1bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opencl/openclwrapper.cpp
Expand Up @@ -595,7 +595,7 @@ int OpenclDevice::CompileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
const char *source;
size_t source_size[1];
int b_error, binary_status, binaryExisted, idx;
size_t numDevices;
cl_uint numDevices;
cl_device_id *mpArryDevsID;
FILE *fd, *fd1;
const char* filename = "kernel.cl";
Expand Down

0 comments on commit ec5b1bd

Please sign in to comment.