Query information about a context.

cl_int clGetContextInfo ( cl_context context,
  cl_context_info param_name,
  size_t param_value_size,
  void *param_value,
  size_t param_value_size_ret)



Specifies the OpenCL context being queried.


An enumeration constant that specifies the information to query. The valid values for param_name are:

cl_context_info Return Type Information returned in 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_DEVICES cl_device_id[] Return the list of devices in context.
CL_CONTEXT_PROPERTIES cl_context_properties[] Return the properties argument specified in clCreateContext.

A pointer to memory where the appropriate result being queried is returned. If param_value is NULL, it is ignored.


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.


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


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 less than size of return type as specified in the table above and param_value is not a NULL value.


OpenCL Specification

Also see


Copyright © 2007-2009 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.