views:

29

answers:

1

Hello, I'm trying to test the OpenCL functionality of building a program from pre-compiled binaries. So far I've managed to create the binary file, but I'm having trouble to load it. I'm trying to adapt this code for use with the C++ bindings:

FILE* fp = fopen("oclLLtoUTM.ptx", "r");
fseek (fp , 0 , SEEK_END);
const size_t lSize = ftell(fp);
rewind(fp);
unsigned char* buffer;
buffer = (unsigned char*) malloc (lSize);
fread(buffer, 1, lSize, fp);
fclose(fp);

cl_int status;
cpProgram = clCreateProgramWithBinary(cxGPUContext, 1, (const cl_device_id *)cdDevices,
&lSize, (const unsigned char**)&buffer,
&status, &ciErr1);

if (ciErr1 != CL_SUCCESS)
{
cout<<"Error in clCreateProgramWithBinary, Line "<<__LINE__<<" in file "<<__FILE__<<" "<<endl;
Cleanup(EXIT_FAILURE);
}

ciErr1 = clBuildProgram(cpProgram, 0, NULL, NULL, NULL, NULL);

Can anyone give me a hand with this, or suggest a link where i can find it solved (I need to use C++ bindings)?

Thanks in advance!

A: 

So what error does the runtime give you, and from which call?

MJH

MJH
Yeah tell us the error codes, or look them up yourself (about one page into the file):http://www.khronos.org/registry/cl/api/1.1/cl.h
Chad Brewbaker