Returns information about the program object.
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)
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 inparam_value
byclGetProgramInfo
is described in the table below.cl_program_info Return Type and Info. returned in param_value
CL_PROGRAM_REFERENCE_COUNT
Return type: cl_uint
Return the
program
reference count.The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.
CL_PROGRAM_CONTEXT
Return type: cl_context
Return the context specified when the program object is created
CL_PROGRAM_NUM_DEVICES
Return type: cl_uint
Return the number of devices associated with
program
.CL_PROGRAM_DEVICES
Return type: cl_device_id[]
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 progam object is created using
clCreateProgramWithBinary
.CL_PROGRAM_SOURCE
Return type: char[]
Return the program source code specified by
clCreateProgramWithSource
. The source string returned is a concatenation of all source strings specified toclCreateProgramWithSource
with a null terminator. The concatenation strips any nulls in the original source strings.If
program
is created usingclCreateProgramWithBinary
,clCreateProgramWithIL
, orclCreateProgramWithBuiltInKernels
, 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
.CL_PROGRAM_IL
Return type: void *
Returns the program IL for programs created with
clCreateProgramWithIL
.If
program
is created withclCreateProgramWithSource
,clCreateProgramWithBinary
orclCreateProgramWithBuiltInKernels
the memory pointed to byparam_value
will be unchanged andparam_value_size_ret
will be set to 0.CL_PROGRAM_BINARY_SIZES
Return type: size_t[]
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 withprogram
. If a binary is not available for a device(s), a size of zero is returned.If
program
is created usingclCreateProgramWithBuiltInKernels
, the implementation may return zero in any entries of the returned array.CL_PROGRAM_BINARIES
Return type: unsigned char *[]
Return the program binaries (could be an executable binary, compiled binary or library binary) for all devices associated with
program
. For each device inprogram
, the binary returned can be the binary specified for the device whenprogram
is created withclCreateProgramWithBinary
or it can be the executable binary generated byclBuildProgram
orclLinkProgram
. Ifprogram
is created withclCreateProgramWithSource
orclCreateProgramWithIL
, the binary returned is the binary generated byclBuildProgram
,clCompileProgram
, orclLinkProgram
. 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 ofn
pointers allocated by the caller, wheren
is the number of devices associated with program. The buffer sizes needed to allocate the memory that thesen
pointers refer to can be queried using theCL_PROGRAM_BINARY_SIZES
query as described in this table.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
CL_PROGRAM_DEVICES
query to get the list of devices. There is a one-to-one correspondence between the array ofn
pointers returned byCL_PROGRAM_BINARIES
and array of devices returned byCL_PROGRAM_DEVICES.
If an entry value in the array is NULL, the implementation skips copying the program binary for the specific device identified by the array index.
CL_PROGRAM_NUM_KERNELS
Return type: size_t
Returns the number of kernels declared in
program
that can be created withclCreateKernel
. This information is only available after a successful program executable has been built for at least one device in the list of devices associated withprogram
.CL_PROGRAM_KERNEL_NAMES
Return type: char[]
Returns a semi-colon separated list of kernel names in
program
that can be created withclCreateKernel
. This information is only available after a successful program executable has been built for at least one device in the list of devices associated withprogram
. param_value
-
A pointer to memory where the appropriate result being queried is returned. If
param_value
is NULL, it is ignored. param_value_size
-
Used to specify the size in bytes of memory pointed to by
param_value
. This size must be ≥ size of return type as described in the table above. param_value_size_ret
-
Returns the actual size in bytes of data copied to
param_value
. Ifparam_value_size_ret
is NULL, it is ignored.
Returns CL_SUCCESS
if the function is executed successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_VALUE
ifparam_name
is not valid, or if size in bytes specified byparam_value_size
is < size of return type as described in the table above andparam_value
is not NULL. -
CL_INVALID_PROGRAM
ifprogram
is not a valid program object. -
CL_INVALID_PROGRAM_EXECUTABLE
ifparam_name
isCL_PROGRAM_NUM_KERNELS
orCL_PROGRAM_KERNEL_NAMES
and a successful program executable has not been built for at least one device in the list of devices associated withprogram
. -
CL_OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device. -
CL_OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.