CLGETCONTEXTINFO(3clc)
β¨ CLGETCONTEXTINFO β¨
okay so this is clGetContextInfo, straight out of the OpenCL Manual, section 3clc. it's part one of two, so buckle up bestie, we're only getting started π
πΈ NAME πΈ
clGetContextInfo β query information about a context. that's it, that's the whole vibe. you hand her a context and she tells you stuff about it π
π SYNOPSIS π
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);
like, look at her. returns a cl_int. iconic behaviour, fr fr β¨
π PARAMETERS π
contextβ the OpenCL context being queried. she's the one in the hot seat, be nice to her π«Άparam_nameβ an enumeration constant that specifies which piece of information you wanna query. the valid values forparam_nameare:CL_CONTEXT_REFERENCE_COUNT- return type:
cl_uint - returns the context reference count. β οΈ but listen β the reference count returned should be considered immediately stale. it is unsuitable for general use in applications. this feature is provided purely for identifying memory leaks, no cap. so don't go building logic on top of it, okay? π
- return type:
CL_CONTEXT_NUM_DEVICES- return type:
cl_uint - returns the number of devices in the context. clean, simple, slay β¨
- return type:
CL_CONTEXT_DEVICES- return type:
cl_device_id[] - returns the list of devices in the context. the whole roster π
- return type:
CL_CONTEXT_PROPERTIES- return type:
cl_context_properties[] - returns the properties argument specified in
clCreateContext(3clc)orclCreateContextFromType(3clc). - if the properties argument specified in
clCreateContext(3clc)orclCreateContextFromType(3clc)used to create the context is not NULL, the implementation must return the values specified in the properties argument. like, contractually obligated. no skipping π«Ά - but if the properties argument specified in
clCreateContext(3clc)orclCreateContextFromType(3clc)used to create the context is NULL, the implementation has options, and honestly it's giving choose-your-own-adventure:- it may return a
param_value_size_retof0, i.e. there is no context property value to be returned, or - it can return a context property value of
0(where0is used to terminate the context properties list) in the memory thatparam_valuepoints to.
- it may return a
- so yeah, handle both cases bestie, don't get caught out π
- return type:
CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR- return type:
cl_bool - if the
cl_khr_d3d10_sharing(3clc)extension is enabled, returnsCL_TRUEif Direct3D 10 resources created as shared by settingMiscFlagsto includeD3D10_RESOURCE_MISC_SHAREDwill perform faster when shared with OpenCL, compared with resources which have not set this flag. otherwise returnsCL_FALSE. π₯
- return type:
CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR- return type:
cl_bool - if the
cl_khr_d3d11_sharingextension is supported, returnsCL_TRUEif Direct3D 11 resources created as shared by settingMiscFlagsto includeD3D11_RESOURCE_MISC_SHAREDwill perform faster when shared with OpenCL, compared with resources which have not set this flag. otherwise returnsCL_FALSE. π₯
- return type:
param_valueβ a pointer to memory where the appropriate result being queried is returned. ifparam_valueisNULL, it is ignored. she's unbothered, moisturised, in her lane πparam_value_sizeβ the size in bytes of the memory pointed to byparam_value. this size must be greater than or equal to the size of the return type as described in the table above. yes, "the table above" β there was a table, and in our hearts there still is πparam_value_size_retβ returns the actual size in bytes of the data being queried byparam_value. ifparam_value_size_retisNULL, it is ignored. also unbothered π
okay so that's all the params, but we're literally only halfway through this page β part 2 is coming, don't go anywhere bestie π¦
π ERRORS π
Okay bestie, here's the vibe check on what this function hands back. It returns CL_SUCCESS when everything goes right, or one of these lil gremlins below:
CL_INVALID_CONTEXTβ thecontextyou passed in? not a valid context. fake. expired. not the moment. π«CL_INVALID_VALUEβ happens ifparam_nameisn't one of the supported values, OR if thesizein bytes you specified withparam_value_sizeis < the size of the return type as specified in the table above, andparam_valueis not aNULLvalue. like... you didn't give me enough room to put the info, bestie. πCL_OUT_OF_RESOURCESβ there was a failure to allocate resources required by the OpenCL implementation on the device. the device said "no π".CL_OUT_OF_HOST_MEMORYβ there was a failure to allocate resources required by the OpenCL implementation on the host. the host is struggling fr fr. π«
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, the canon text, the blueprint. iykyk. β¨
π SEE ALSO π
clGetDeviceInfo(3clc)β go read that one too, bestie, it's giving sibling energy π¦
π AUTHORS π
The Khronos Group β the ones who actually wrote this. respect. periodt. π
βοΈ 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.
that's the whole legal tea, copied word for word, no edits, no cap. π
ποΈ NOTES ποΈ
- OpenCL Specification β page 58, section 4.4 - Contexts
and that's a wrap on CLGETCONTEXTINFO(3clc) bestie!! this one came from The Khronos Group, dated 01/14/2021, straight out of the man page source/version footer. you ate that whole page, fr fr. go get some water, take a nap, you deserve it. mwah. π«Άπβ¨ππ¦πΈ
π¦ 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