CLGETCONTEXTINFO(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

✨ 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 for param_name are:
    • 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? πŸ’€
    • CL_CONTEXT_NUM_DEVICES
      • return type: cl_uint
      • returns the number of devices in the context. clean, simple, slay ✨
    • CL_CONTEXT_DEVICES
      • return type: cl_device_id[]
      • returns the list of devices in the context. the whole roster πŸ’…
    • CL_CONTEXT_PROPERTIES
      • return type: cl_context_properties[]
      • returns the properties argument specified in clCreateContext(3clc) or clCreateContextFromType(3clc).
      • if the properties argument specified in clCreateContext(3clc) or clCreateContextFromType(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) or clCreateContextFromType(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_ret of 0, i.e. there is no context property value to be returned, or
        • it 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.
      • so yeah, handle both cases bestie, don't get caught out πŸ™ˆ
    • CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR
      • return type: cl_bool
      • if the 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_SHARED_RESOURCES_KHR
      • return type: cl_bool
      • if the cl_khr_d3d11_sharing 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. she's unbothered, moisturised, in her lane πŸ’†
  • param_value_size β€” the size in bytes of the memory pointed to by param_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 by param_value. if param_value_size_ret is NULL, 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 β€” the context you passed in? not a valid context. fake. expired. not the moment. 🚫
  • CL_INVALID_VALUE β€” happens if param_name isn't one of the supported values, OR if the size in bytes you specified with param_value_size is < the size of the return type as specified in the table above, and param_value is not a NULL value. 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 πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group β€” the ones who actually wrote this. respect. periodt. πŸ’…


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 πŸ—’οΈ

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