saint_shark
saint_shark

Reputation: 17

clGetProgramBuildInfo returns CL_BUILD_NONE though the program gives correct output

I was testing a simple vector add program from Nvidia's opencl code examples. It gives the correct vector addition results. Just to experiment, I was trying to see the program build status and build log by adding the following lines after clBuildProgram is called:

size_t size = 0;
ret=clGetProgramBuildInfo(program,device_id, CL_PROGRAM_BUILD_STATUS ,0,NULL,&size);

cl_build_status *status=(cl_build_status *)malloc(sizeof(cl_build_status));
clGetProgramBuildInfo(program,device_id, CL_PROGRAM_BUILD_STATUS ,size,status,NULL);
printf("\nBuild status=%d\n",*status); 

ret = clGetProgramBuildInfo(program,device_id, CL_PROGRAM_BUILD_LOG ,0,NULL,&size);
char *buildlog=(char*)malloc(size);
buildlog[size] = '\n';
ret = clGetProgramBuildInfo(program,device_id, CL_PROGRAM_BUILD_LOG ,size,buildlog,NULL);
printf("\n\nBuildlog:   %s\n\n",buildlog);

The status returns "0" which means CL_BUILD_NONE and the buildlog doen't print anything(probably returns an empty string)

According to the opencl documentation, CL_BUILD_NONE is returned when no build has been performed on the specified program object for device.

Upvotes: 0

Views: 218

Answers (1)

HEKTO
HEKTO

Reputation: 4191

From the cl.h header:

/* cl_build_status */
#define CL_BUILD_SUCCESS                            0
#define CL_BUILD_NONE                               -1
#define CL_BUILD_ERROR                              -2
#define CL_BUILD_IN_PROGRESS                        -3

So, you got right info.

Upvotes: 1

Related Questions