Skip to content

CLGetInfoString

CLGetInfoString

Returns string value of a property for OpenCL object or device.

bool  CLGetInfoString(
   int  handle,                           // OpenCL object handle or OpenCL device number
   ENUM_OPENCL_PROPERTY_STRING  prop,     // requested property
   string&  value                         // referenced string
   );

Parameters

handle

[in] OpenCL object handle or OpenCL device number. The numbering of OpenCL devices starts with zero.

prop

[in] Type of requested property from ENUM_OPENCL_PROPERTY_STRING enumeration, the value of which should be obtained.

value

[out] String for receiving the property value.

Return Value

true if successful, otherwise false. For information about the error, use the GetLastError() function.

ENUM_OPENCL_PROPERTY_STRING

IdentifierDescription
CL_PLATFORM_PROFILECL_PLATFORM_PROFILE - OpenCL Profile. Profile name may be one of the following values:
- FULL_PROFILE - implementation supports OpenCL (functionality is defined as the part of the kernel specification without requiring additional extensions for OpenCL support);
- EMBEDDED_PROFILE - implementation supports OpenCL as a supplement. Amended profile is defined as a subset for each OpenCL version.
CL_PLATFORM_VERSIONOpenCL version
CL_PLATFORM_VENDORPlatform vendor name
CL_PLATFORM_EXTENSIONSList of extensions supported by the platform. Extension names should be supported by all devices related to this platform
CL_DEVICE_NAMEDevice name
CL_DEVICE_VENDORVendor name
CL_DRIVER_VERSIONOpenCL driver version in major_number.minor_number format
CL_DEVICE_PROFILEOpenCL device profile. Profile name may be one of the following values:
- FULL_PROFILE - implementation supports OpenCL (functionality is defined as the part of the kernel specification without requiring additional extensions for OpenCL support);
- EMBEDDED_PROFILE - implementation supports OpenCL as a supplement. Amended profile is defined as a subset for each OpenCL version.
CL_DEVICE_VERSIONOpenCL version in “OpenCL<major_version.minor_version>” format
CL_DEVICE_EXTENSIONSList of extensions supported by the device. The list may contain extensions supported by the vendor, as well as one or more approved names:
cl_khr_int64_base_atomics
cl_khr_int64_extended_atomics
cl_khr_fp16
cl_khr_gl_sharing
cl_khr_gl_event
cl_khr_d3d10_sharing
cl_khr_dx9_media_sharing
cl_khr_d3d11_sharing
CL_DEVICE_BUILT_IN_KERNELSThe list of supported kernels separated by “;”.
CL_DEVICE_OPENCL_C_VERSIONThe maximum version supported by the compiler for this device. Version format:
“OpenCLC<major_version.minor_version> "
CL_ERROR_DESCRIPTIONText description of an OpenCL error

Example:

void OnStart()
  {
   int cl_ctx;
   string str;
//--- initialize OpenCL context
   if((cl_ctx=CLContextCreate(CL_USE_GPU_ONLY))==INVALID_HANDLE)
     {
      Print("OpenCL not found");
      return;
     }
//--- Display information about the platform
   if(CLGetInfoString(cl_ctx,CL_PLATFORM_NAME,str))
      Print("OpenCL platform name: ",str);
   if(CLGetInfoString(cl_ctx,CL_PLATFORM_VENDOR,str))
      Print("OpenCL platform vendor: ",str);
   if(CLGetInfoString(cl_ctx,CL_PLATFORM_VERSION,str))
      Print("OpenCL platform ver: ",str);
   if(CLGetInfoString(cl_ctx,CL_PLATFORM_PROFILE,str))
      Print("OpenCL platform profile: ",str);
   if(CLGetInfoString(cl_ctx,CL_PLATFORM_EXTENSIONS,str))
      Print("OpenCL platform ext: ",str);
//--- Display information about the device
   if(CLGetInfoString(cl_ctx,CL_DEVICE_NAME,str))
      Print("OpenCL device name: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_PROFILE,str))
      Print("OpenCL device profile: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_BUILT_IN_KERNELS,str))
      Print("OpenCL device kernels: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_EXTENSIONS,str))
      Print("OpenCL device ext: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_VENDOR,str))
      Print("OpenCL device vendor: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_VERSION,str))
      Print("OpenCL device ver: ",str);
   if(CLGetInfoString(cl_ctx,CL_DEVICE_OPENCL_C_VERSION,str))
      Print("OpenCL open c ver: ",str);
//--- Display general information about the OpenCL device
   Print("OpenCL type: ",EnumToString((ENUM_CL_DEVICE_TYPE)CLGetInfoInteger(cl_ctx,CL_DEVICE_TYPE)));
   Print("OpenCL vendor ID: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_VENDOR_ID));
   Print("OpenCL units: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_COMPUTE_UNITS));
   Print("OpenCL freq: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_CLOCK_FREQUENCY));
   Print("OpenCL global mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_GLOBAL_MEM_SIZE));
   Print("OpenCL local mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_LOCAL_MEM_SIZE));
//--- free OpenCL context
   CLContextFree(cl_ctx);
  }
Last updated on