logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

clGetContextInfo - Query information about a context.

Authors

TheKhronosGroup

Errors

       Returns CL_SUCCESS if the function executed successfully, or one of the errors below:

       •   CL_INVALID_CONTEXT if context is not a valid context.

       •   CL_INVALID_VALUE if param_name is not one of the supported values or if size in bytes specified by
           param_value_size is < size of return type as specified in the table above and param_value is not a
           NULL value.

       •   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.

Name

       clGetContextInfo - Query information about a context.

       cl_intclGetContextInfo(cl_contextcontext,cl_context_infoparam_name,size_tparam_value_size,void*param_value,size_t*param_value_size_ret);

Notes

        1. OpenCL Specification
           page 58, section 4.4 - Contexts

The Khronos Group                                  11/18/2024                             CLGETCONTEXTINFO(3clc)

Parameters

context
           Specifies the OpenCL context being queried.

        param_name
           An enumeration constant that specifies the information to query. The valid values for param_name are:
           ┌────────────────────────────┬───────────────────────────┬────────────────────────────────┐
           │ cl_context_infoReturnTypeInformationreturnedin        │
           │                            │                           │ param_value                    │
           ├────────────────────────────┼───────────────────────────┼────────────────────────────────┤
           │ CL_CONTEXT_REFERENCE_COUNT │ cl_uint                   │ Return the context 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_CONTEXT_NUM_DEVICES     │ cl_uint                   │ Return the number of devices   │
           │                            │                           │ in context.                    │
           ├────────────────────────────┼───────────────────────────┼────────────────────────────────┤
           │ CL_CONTEXT_DEVICES         │ cl_device_id[]            │ Return the list of devices     │
           │                            │                           │ in context.                    │
           ├────────────────────────────┼───────────────────────────┼────────────────────────────────┤
           │ CL_CONTEXT_PROPERTIES      │ cl_context_- properties[] │ Return the properties          │
           │                            │                           │ argument specified in          │
           │                            │                           │ clCreateContext(3clc) or       │
           │                            │                           │ clCreateContextFromType(3clc). │
           │                            │                           │ If the properties argument     │
           │                            │                           │ specified in                   │
           │                            │                           │ clCreateContext(3clc) or       │
           │                            │                           │ clCreateContextFromType(3clc)  │
           │                            │                           │ used to create context is      │
           │                            │                           │ not NULL, the implementation   │
           │                            │                           │ must return the values         │
           │                            │                           │ specified in the properties    │
           │                            │                           │ argument.                      │
           │                            │                           │                                │
           │                            │                           │ properties argument            │
           │                            │                           │ specified in                   │
           │                            │                           │ clCreateContext(3clc) or       │
           │                            │                           │ clCreateContextFromType(3clc)  │
           │                            │                           │ used to create context is      │
           │                            │                           │ NULL, the implementation may   │
           │                            │                           │ return either a                │
           │                            │                           │ param_value_size_ret of 0,     │
           │                            │                           │ i.e. there is no context       │
           │                            │                           │ property value to be           │
           │                            │                           │ returned or can return a       │
           │                            │                           │ context property value of 0    │
           │                            │                           │ (where 0 is used to            │
           │                            │                           │ terminate the context          │
           │                            │                           │ properties list) in the        │
           │                            │                           │ memory that param_value        │
           │                            │                           │ points to.                     │
           ├────────────────────────────┼───────────────────────────┼────────────────────────────────┤
           │ CL_CONTEXT_D3D10_PREFER_-  │ cl_bool                   │ If the                         │
           │ SHARED_RESOURCES_KHR       │                           │ cl_khr_d3d10_sharing(3clc)     │
           │                            │                           │ extension is enabled, returns  │
           │                            │                           │ CL_TRUE if Direct3D 10         │
           │                            │                           │ resources created as shared by │
           │                            │                           │ setting MiscFlags to include   │
           │                            │                           │ D3D10_RESOURCE_MISC_SHARED     │
           │                            │                           │ will perform faster when       │
           │                            │                           │ shared with OpenCL, compared   │
           │                            │                           │ with resources which have not  │
           │                            │                           │ set this flag. Otherwise       │
           │                            │                           │ returns CL_FALSE.              │
           ├────────────────────────────┼───────────────────────────┼────────────────────────────────┤
           │ CL_CONTEXT_D3D11_PREFER_-  │ cl_bool                   │ If the cl_khr_d3d11_sharing    │
           │ SHARED_RESOURCES_KHR       │                           │ extension is supported,        │
           │                            │                           │ Returns CL_TRUE if Direct3D 11 │
           │                            │                           │ resources created as shared by │
           │                            │                           │ setting MiscFlags to include   │
           │                            │                           │ D3D11_RESOURCE_MISC_SHARED     │
           │                            │                           │ will perform faster when       │
           │                            │                           │ shared with OpenCL, compared   │
           │                            │                           │ with resources which have not  │
           │                            │                           │ set this flag. Otherwise       │
           │                            │                           │ returns CL_FALSE.              │
           └────────────────────────────┴───────────────────────────┴────────────────────────────────┘

         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
           Specifies the size in bytes of memory pointed to by param_value. This size must be greater than or
           equal to the size of return type as described in the table above.

         param_value_size_ret
           Returns the actual size in bytes of data being queried by param_value. If param_value_size_ret is
           NULL, it is ignored.

See Also

clGetDeviceInfo(3clc)

Specification

OpenCLSpecification[1]

See Also