CLGETPROGRAMINFO(3clc)
okay so bestie, welcome to clGetProgramInfo(3clc) from the OpenCL Manual! This is part 1 of 3, so grab your boba and stay tuned πβ¨
β¨ NAME β¨
clGetProgramInfo β returns info about the program object. Like, all the details, no cap. You wanna know something about a program object? This function is literally your girl π
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 you're querying. That's the one you're asking about, bestie π
and that's just part 1, bestie β there's more coming, so don't go anywhere! π¦
Okay so, 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 table below. π
cl_program_info β Return Type and Info. returned in param_value
CL_PROGRAM_REFERENCE_COUNTβ return type:cl_uint. Returns the program reference count. β¨CL_PROGRAM_CONTEXTβ return type:cl_context. Returns the context specified when the program object is created. πCL_PROGRAM_NUM_DEVICESβ return type:cl_uint. Returns the number of devices associated with program. πCL_PROGRAM_DEVICESβ return type:cl_device_id[]. Returns 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 usingclCreateProgramWithBinary(3clc). π¦CL_PROGRAM_SOURCEβ return type:char[]. Returns the program source code specified byclCreateProgramWithSource(3clc). The source string returned is a concatenation of all source strings specified toclCreateProgramWithSource(3clc)with a null terminator. The concatenation strips any nulls in the original source strings. If program is created usingclCreateProgramWithBinary(3clc)orclCreateProgramWithBuiltInKernels(3clc), 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 inparam_value_size_ret. π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 with program. If a binary is not available for a device(s), a size of zero is returned. If program is created usingclCreateProgramWithBuiltInKernels(3clc), the implementation may return zero in any entries of the returned array. πCL_PROGRAM_BINARIESβ return type:unsigned char *[]. Returns 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 withclCreateProgramWithBinary(3clc)or it can be the executable binary generated byclBuildProgram(3clc)orclLinkProgram(3clc). If program is created withclCreateProgramWithSource(3clc), the binary returned is the binary generated byclBuildProgram(3clc),clCompileProgram(3clc), orclLinkProgram(3clc). 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_valuepoints to an array of n pointers allocated by the caller, where n is the number of devices associated with program. The buffer sizes needed to allocate the memory that these n pointers refer to can be queried using theCL_PROGRAM_BINARY_SIZESquery as described in this table. πCL_PROGRAM_BINARIESβ bestie, this one is the memory address plug π Every single entry in this array is where the implementation goes to copy the program binary for one specific device, if a binary actually exists for it. Wanna know which device each binary belongs to? AskCL_PROGRAM_DEVICESand it'll hand you the device list. It's a whole one-to-one correspondence situation: the array ofnpointers you get fromCL_PROGRAM_BINARIESlines up index-for-index with the array of devices fromCL_PROGRAM_DEVICES. Iconic matched set behavior π
And here's the lil plot twist: if an entry in that array is NULL, the implementation just skips copying the program binary for the device sitting at that array index. No drama, it just moves on π
CL_PROGRAM_NUM_KERNELSβ Return type:size_t
Hands you the number of kernels declared in program that can be made with clCreateKernel(3clc). Heads up though β this tea is only available after a successful program executable has been built for at least one device in the list of devices associated with program. No build, no numbers, periodt.
CL_PROGRAM_KERNEL_NAMESβ Return type:char[]
Gives you a semi-colon separated list of the kernel names in program that can be made with clCreateKernel(3clc). Same rule as above, bestie: this info only shows up after a successful program executable has been built for at least one device in the list of devices associated with program. So don't come asking before the build slays π
πΈ param_value πΈ
A pointer to the memory where the result you're querying gets dropped off. And if param_value is NULL? It's ignored. Simple as that π«Ά
πΈ param_value_size πΈ
This one specifies the size in bytes of the memory that param_value is pointing at. And this size must be β₯ the size of the return type as described in the table above. Too small = not it π
πΈ param_value_size_ret πΈ
Returns the actual size in bytes of the data that got copied into param_value. If param_value_size_ret is NULL, it's ignored. We love a flexible king β¨
π ERRORS π
Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of these:
CL_INVALID_VALUEβ if param_name is not valid, or if the size in bytes specified by param_value_size is < the size of the return type as described in the table above and param_value is notNULL. Both conditions gotta hit, okay?CL_INVALID_PROGRAMβ if program is not a valid program object. Fake program = instant reject π ββοΈCL_INVALID_PROGRAM_EXECUTABLEβ if param_name isCL_PROGRAM_NUM_KERNELSorCL_PROGRAM_KERNEL_NAMESand a successful program executable has not been built for at least one device in the list of devices associated with program. Yeah, you gotta actually build it first bestie.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 π
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
π AUTHORS π
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π¦ NOTES π¦
- OpenCL Specification page 150, section 5.6.7 - Program Object Queries (updated for 1.2 rev 14)
That's the whole page, bestie β we ate and left absolutely zero crumbs π
This one came to you from The Khronos Group, dated 01/14/2021, and the page is literally called CLGETPROGRAMINFO(3clc) if you ever need to find her again. Go query something iconic ππβ¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms