C Specification
To return information about a program object, call the function
// Provided by CL_VERSION_1_0
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);
Parameters
- 
program specifies the program object being queried.
 - 
param_name specifies the information to query. The list of supported param_name types and the information returned in param_value by clGetProgramInfo is described in the Program Object Queries table.
 - 
param_value is a pointer to memory where the appropriate result being queried is returned. If param_value is
NULL, it is ignored. - 
param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Program Object Queries table. If param_value is
NULL, it is ignored. - 
param_value_size_ret returns the actual size in bytes of data being queried by param_name. If param_value_size_ret is
NULL, it is ignored. 
Description
| Program Info | Return Type | Description | 
|---|---|---|
  | 
  | 
Return the program reference count.  | 
  | 
  | 
Return the context specified when the program object is created  | 
  | 
  | 
Return the number of devices associated with program.  | 
  | 
  | 
Return the list of devices associated with the program object. This can be the devices associated with context on which the program object has been created or can be a subset of devices that are specified when a program object is created using clCreateProgramWithBinary.  | 
  | 
  | 
Return the program source code specified by clCreateProgramWithSource. The source string returned is a concatenation of all source strings specified to clCreateProgramWithSource with a null terminator. The concatenation strips any nulls in the original source strings. If program is created using clCreateProgramWithBinary, clCreateProgramWithIL, clCreateProgramWithILKHR, or clCreateProgramWithBuiltInKernels, a null string or the appropriate program source code is returned depending on whether or not the program source code is stored in the binary. The actual number of characters that represents the program source code including the null terminator is returned in param_value_size_ret.  | 
 missing before version 2.1. 
 provided by the   | 
  | 
Returns the program IL for programs created with clCreateProgramWithILKHR or clCreateProgramWithIL. If program is created with clCreateProgramWithSource, clCreateProgramWithBinary or clCreateProgramWithBuiltInKernels the memory pointed to by param_value will be unchanged and param_value_size_ret will be set to 0.  | 
  | 
  | 
Returns an array that contains the size in bytes of the program binary (could be an executable binary, compiled binary or library binary) for each device associated with program. The size of the array is the number of devices associated with program. If a binary is not available for a device(s), a size of zero is returned. If program is created using clCreateProgramWithBuiltInKernels, the implementation may return zero in any entries of the returned array.  | 
  | 
  | 
Return the program binaries (could be an executable binary, compiled binary or library binary) for all devices associated with program. For each device in program, the binary returned can be the binary specified for the device when program is created with clCreateProgramWithBinary or it can be the executable binary generated by clBuildProgram or clLinkProgram. If program is created with clCreateProgramWithSource or clCreateProgramWithIL, the binary returned is the binary generated by clBuildProgram, clCompileProgram or clLinkProgram. The bits returned can be an implementation-specific intermediate representation (a.k.a. IR) or device specific executable bits or both. The decision on which information is returned in the binary is up to the OpenCL implementation.         param_value points to an array of          Each entry in this array is used by the implementation as the
        location in memory where to copy the program binary for a specific
        device, if there is a binary available.
        To find out which device the program binary in the array refers to,
        use the   | 
 missing before version 1.2.  | 
  | 
Returns the number of kernels declared in program that can be created with clCreateKernel. This information is only available after a successful program executable has been built for at least one device in the list of devices associated with program.  | 
 missing before version 1.2.  | 
  | 
Returns a semi-colon separated list of kernel names in program that can be created with clCreateKernel. This information is only available after a successful program executable has been built for at least one device in the list of devices associated with program.  | 
 missing before version 2.2 and deprecated by version 3.0.  | 
  | 
This indicates that the program object contains non-trivial constructor(s) that will be executed by runtime before any kernel from the program is executed. This information is only available after a successful program executable has been built for at least one device in the list of devices associated with program.         Querying   | 
 missing before version 2.2 and deprecated by version 3.0.  | 
  | 
This indicates that the program object contains non-trivial destructor(s) that will be executed by runtime when program is destroyed. This information is only available after a successful program executable has been built for at least one device in the list of devices associated with program.         Querying   | 
clGetProgramInfo returns CL_SUCCESS if the function is executed
successfully.
Otherwise, it returns one of the following errors:
- 
CL_INVALID_if program is a not a valid program object.PROGRAM  - 
CL_INVALID_if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Program Object Queries table and param_value is notVALUE NULL. - 
CL_INVALID_if param_name isPROGRAM_ EXECUTABLE CL_PROGRAM_,NUM_ KERNELS CL_PROGRAM_,KERNEL_ NAMES CL_PROGRAM_, orSCOPE_ GLOBAL_ CTORS_ PRESENT CL_PROGRAM_and a successful program executable has not been built for at least one device in the list of devices associated with program.SCOPE_ GLOBAL_ DTORS_ PRESENT  - 
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES  - 
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY  
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.