Here is the function declaration in OpenCL 1.2. I have chosen only one GPU device with CL_DEVICE_TYPE_GPU for the whole program.
cl_int clGetProgramInfo (cl_program program,
- Query devices in the platform and get one device
- Query binary size and get programSize
- Declare a variable unsigned char **binary
- Malloc 4 pointers for binary. binary = (unsigned char **)malloc(sizeof(unsigned char**) * 4);
- Init each pointer with a loop. binary[i] = (unsigned char *)malloc(sizeof(unsigned char) * (programSize + 8));
- Check all the pointer. binary[0-3] are legal pointers, there are not any NULL pointer.
- Get the binary.
err = clGetProgramInfo(program, CL_PROGRAM_BINARIES,
programSize, binary, &retSize);
After this call, I get ELF in binary. However, binary[1-3] are set to 0x0, which are NULL pointers.
I just wonder, what is the root cause. This program work well on other platforms. Clinfo output is in the attachment.