Browse Source

Confusion over the variable name for number of devices was passing a bogus value which likely was causing the zero sized binary issue.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
5848c11004
  1. 11
      ocl.c

11
ocl.c

@ -232,7 +232,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL; return NULL;
} }
size_t nDevices;
cl_uint numDevices; cl_uint numDevices;
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices); status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS) if (status != CL_SUCCESS)
@ -271,7 +270,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (gpu < numDevices) { if (gpu < numDevices) {
char pbuff[100]; char pbuff[100];
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, &nDevices); status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS) if (status != CL_SUCCESS)
{ {
applog(LOG_ERR, "Error: Getting Device Info"); applog(LOG_ERR, "Error: Getting Device Info");
@ -378,12 +377,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (!source) if (!source)
return NULL; return NULL;
binary_sizes = (size_t *)malloc(sizeof(size_t)*nDevices); binary_sizes = (size_t *)malloc(sizeof(size_t)*numDevices);
if (unlikely(!binary_sizes)) { if (unlikely(!binary_sizes)) {
applog(LOG_ERR, "Unable to malloc binary_sizes"); applog(LOG_ERR, "Unable to malloc binary_sizes");
return NULL; return NULL;
} }
binaries = (char **)malloc(sizeof(char *)*nDevices); binaries = (char **)malloc(sizeof(char *)*numDevices);
if (unlikely(!binaries)) { if (unlikely(!binaries)) {
applog(LOG_ERR, "Unable to malloc binaries"); applog(LOG_ERR, "Unable to malloc binaries");
return NULL; return NULL;
@ -503,7 +502,7 @@ build:
return NULL; return NULL;
} }
status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t)*nDevices, binary_sizes, NULL ); status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t)*numDevices, binary_sizes, NULL );
if (unlikely(status != CL_SUCCESS)) { if (unlikely(status != CL_SUCCESS)) {
applog(LOG_ERR, "Error: Getting program info CL_PROGRAM_BINARY_SIZES. (clGetPlatformInfo)"); applog(LOG_ERR, "Error: Getting program info CL_PROGRAM_BINARY_SIZES. (clGetPlatformInfo)");
return NULL; return NULL;
@ -517,7 +516,7 @@ build:
return NULL; return NULL;
} }
binaries[gpu] = (char *)malloc( sizeof(char)*binary_sizes[gpu]); binaries[gpu] = (char *)malloc( sizeof(char)*binary_sizes[gpu]);
status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARIES, sizeof(char *)*nDevices, binaries, NULL ); status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARIES, sizeof(char *)*numDevices, binaries, NULL );
if (unlikely(status != CL_SUCCESS)) { if (unlikely(status != CL_SUCCESS)) {
applog(LOG_ERR, "Error: Getting program info. (clGetPlatformInfo)"); applog(LOG_ERR, "Error: Getting program info. (clGetPlatformInfo)");
return NULL; return NULL;

Loading…
Cancel
Save