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!