Note that there are some explanatory texts on larger screens.

plurals
  1. POerror code (-11):: what are all possible reasons of getting error "cl_build_program_failure" in OpenCL?
    primarykey
    data
    text
    <p>I am using ATI RV770 graphics card, OpenCl 1.0 and ati-stream-sdk-v2.3-lnx64 on linux.</p> <p>While running my host code which includes following two sections to build kernel program, i am getting error code (-11) i.e. <code>cl_build_program_failure</code>. Does it means that kernel program compiled, if not then how is it compiled and debugged?</p> <pre><code>const char* KernelPath = "abc_kernel.cl"; //kernel program is in separate file but in same directory of host code.. </code></pre> <p>/<strong><em>*</em></strong> Create Program object from the kernel source <strong><em>*</em>**<em>*</em>**<em>*</em></strong>/ </p> <pre><code>char* sProgramSource = readKernelSource(KernelPath); size_t sourceSize = strlen(sProgramSource) ; program = clCreateProgramWithSource(context, 1,(const char **) &amp;sProgramSource,&amp;sourceSize, &amp;err); checkStatus("error while creating program",err); </code></pre> <p>/<strong><em>*</em></strong> Build (compile &amp; Link ) Program <strong><em>*</em>**<em>*</em>***</strong>/</p> <pre><code>char* options = (char* )malloc(10*sizeof(char)); strcpy(options, "-g"); err = clBuildProgram(program, num_devices, devices_id, options, NULL, NULL); checkStatus("Build Program Failed", err); //This line throwing the error.... </code></pre> <p>function to read kernel program is as follows::</p> <p>/* read program source file*/</p> <pre><code>char* readKernelSource(const char* kernelSourcePath){ FILE *fp = NULL; size_t sourceLength; char *sourceString ; fp = fopen( kernelSourcePath , "r"); if(fp == 0) { printf("failed to open file"); return NULL; } // get the length of the source code fseek(fp, 0, SEEK_END); sourceLength = ftell(fp); rewind(fp); // allocate a buffer for the source code string and read it in sourceString = (char *)malloc( sourceLength + 1); if( fread( sourceString, 1, sourceLength, fp) !=sourceLength ) { printf("\n\t Error : Fail to read file "); return 0; } sourceString[sourceLength+1]='\0'; fclose(fp); return sourceString; </code></pre> <p>}// end of readKernelSource </p> <p>Can anyone tell how to fix it? </p> <p>Does it means that it is OpenCl compilation error at runtime or something else?</p> <p>//Printing build_log info using clGetProgramBuildInfo() as below, But why is is not printing anything?</p> <p>char* build_log; size_t log_size;</p> <pre><code>// First call to know the proper size err = clGetProgramBuildInfo(program, devices_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &amp;log_size); build_log = (char* )malloc((log_size+1)); // Second call to get the log err = clGetProgramBuildInfo(program, devices_id, CL_PROGRAM_BUILD_LOG, log_size, build_log, NULL); build_log[log_size] = '\0'; printf("--- Build log ---\n "); fprintf(stderr, "%s\n", build_log); free(build_log); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload