OpenCL构建程序来自二进制

时间:2010-06-28 13:41:36

标签: build binary opencl

我正在尝试测试从预编译的二进制文件构建程序的OpenCL功能。到目前为止,我已经设法创建了二进制文件,但是我无法加载它。我正在尝试调整此代码以用于C ++绑定:

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);

任何人都可以帮我解决这个问题,或建议我找到解决方案的链接(我需要使用C ++绑定)吗?

提前致谢!

0 个答案:

没有答案