AnsweredAssumed Answered

Memory Pointer problem of clGetProgramInfo

Question asked by felix on Mar 11, 2014
Latest reply on Mar 12, 2014 by felix

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,

                                    cl_program_info param_name,

                                    size_t param_value_size,

                                    void *param_value,

                                    size_t *param_value_size_ret)

  1. Query devices in the platform and get one device
  2. Query binary size and get programSize
  3. Declare a variable unsigned char **binary
  4. Malloc 4 pointers for binary. binary = (unsigned char **)malloc(sizeof(unsigned char**) * 4);
  5. Init each pointer with a loop. binary[i] = (unsigned char *)malloc(sizeof(unsigned char) * (programSize + 8));
  6. Check all the pointer. binary[0-3] are legal pointers, there are not any NULL pointer.
  7. Get the binary.

         err = clGetProgramInfo(program, CL_PROGRAM_BINARIES,

                                            programSize, binary, &retSize);

        After this call, I get ELF in binary[0]. 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.

Attachments

Outcomes