Quantcast
Channel: AMD Developer Forums: Message List
Viewing all articles
Browse latest Browse all 4265

Re: My first program from OpenCL

$
0
0

Hi,

 

Welcome to the OpenCL community.

 

After calling the API clBuildProgram() [ i.e. [line] clerr = clBuildProgram(program1, 0, NULL, clcompileflags, NULL, NULL); ], please call clGetProgramBuildInfo() with param_name CL_PROGRAM_BUILD_LOG (see clGetProgramBuildInfo) to check details of the compilation error.


For your reference, you can add similar to the following code to get the details:

[Note: please replace variables with BOLD letters corresponding to your program variables]

 

-------------------------------------------------------------------------------------------------------------------------------------

if (clerr!= CL_SUCCESS){

        for (unsigned i=0; i<NUM_DEVICE; i++)

        {

        char *str;

        size_t sstr;

   

        status = clGetProgramBuildInfo(PROGRAM, DEVICE_LIST[i], CL_PROGRAM_BUILD_LOG, NULL, NULL, &sstr);

        str = (char*)malloc(sstr);

       

        if (str == NULL)

        {exit(-1);}

 

        status |= clGetProgramBuildInfo(PROGRAM, DEVICE_LIST[i], CL_PROGRAM_BUILD_LOG, sstr, str, NULL);

        printf("\nBuild Log:\t %s \n", str);

        free(str);

 

        if (status != CL_SUCCESS)

        {exit(-1);}

 

        }

     exit(-1);

    }

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Hope you'll be able to debug your kernel code.

 

Regards,


Viewing all articles
Browse latest Browse all 4265

Latest Images

Trending Articles



Latest Images