Results 1 to 4 of 4

Thread: clBuildProgram() function error...!!

  1. #1

    clBuildProgram() function error...!!

    I solved another problem.... and I wrote a new opencl kernel source.
    The new kernel source is hextile code in opencl. I want to control the hextile encoding to the openCL(GPU).
    I'm changed the source code to use opencl.
    When it is builded, the error is occured.

    I seek this error. It is "CL_INVALID_BINARY" error.
    CL_INVALID_BINARY means if program is created with clCreateWithProgramBinary and devices listed in device_list do not have a valid program binary loaded.
    But I didn't call the clCreateWithProgramBinary() function. I called clCreateProgramWithSource() function.

    why is this occured the problem?

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: clBuildProgram() function error...!!

    What OpenCL implementation are you using? AMD/NVidia/Apple?

    Did you remember to call clBuildProgram() after you called clCreateProgramWithSource()?
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3

    Re: clBuildProgram() function error...!!

    Quote Originally Posted by david.garcia
    What OpenCL implementation are you using? AMD/NVidia/Apple?

    Did you remember to call clBuildProgram() after you called clCreateProgramWithSource()?

    First I called clCreateProgramWithSource() and then I called clBuildProgram() function.

    Also I am using NVidia implementation.

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: clBuildProgram() function error...!!

    Did you check if clBuildProgram returned some kind of error? Try something like this:

    Code :
    cl_build_status build_status;
    cl_int errcode = clBuildProgram(program, num_devices, devices, options, NULL, NULL);
     
    if(errcode != CL_SUCCESS && errcode != CL_BUILD_PROGRAM_FAILURE)
    {
        panic();
    }
     
    for(i = 0; i < num_devices; ++i)
    {
        do
        {
            // Query if compilation was successful
            errcode = clGetProgramBuildInfo(program, device[i], CL_PROGRAM_BUILD_STATUS,
                                                sizeof(build_status), &build_status, NULL);
            if(errcode) panic();
     
            if(build_status == CL_BUILD_ERROR)
            {
                    // Compilation failed. Print the build log
                    cl_char *build_log     = NULL;
                    size_t   build_log_len = 0;
     
                    errcode = clGetProgramBuildInfo(state->program, env->device[i], CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_len);
                    if(errcode) panic();
     
                    build_log = malloc(build_log_len + 1);
                    if(!build_log)
                        panic();
     
                    errcode = clGetProgramBuildInfo(program, device[i], CL_PROGRAM_BUILD_LOG, build_log_len, build_log, NULL);
                    if(errcode)
                    {
                        free(build_log);
                        panic();
                    }
     
                    printf("Program build failed. Build log follows:\n%s", build_log);
     
                    free(build_log);
            }
        }
        while(build_status == CL_BUILD_IN_PROGRESS);
    }

    Note for OpenCL experts: I'm well aware that the code above is far from ideal
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. clBuildProgram return -45 error
    By xstopka in forum OpenCL
    Replies: 3
    Last Post: 05-07-2011, 05:57 AM
  2. error in the clBuildProgram
    By caravel_6 in forum OpenCL
    Replies: 1
    Last Post: 09-08-2010, 09:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •