I thought that somewhere I read somewhere (although, for the life of me, I can’t find the source), that using the C ++ API you do not need to release devices / kernels / memory, for example w / C API like destructors for cl :: Kernel, cl :: Buffer, cl :: Device do this when class objects go out of scope (end of program, etc.). However, upon closer inspection of cl.hpp (the latter, 1.1 rev 04), I do not see any destructors at all. For example, here cl :: Device -
class Device : public detail::Wrapper<cl_device_id> { public: Device(cl_device_id device) { object_ = device; } Device() : detail::Wrapper<cl_type>() { } Device(const Device& device) : detail::Wrapper<cl_type>(device) { } Device& operator = (const Device& rhs) { if (this != &rhs) { detail::Wrapper<cl_type>::operator=(rhs); } return *this; } template <typename T> cl_int getInfo(cl_device_info name, T* param) const { return detail::errHandler( detail::getInfo(&::clGetDeviceInfo, object_, name, param), __GET_DEVICE_INFO_ERR); } template <cl_int name> typename detail::param_traits<detail::cl_device_info, name>::param_type getInfo(cl_int* err = NULL) const { typename detail::param_traits< detail::cl_device_info, name>::param_type param; cl_int result = getInfo(name, ¶m); if (err != NULL) { *err = result; } return param; } #if defined(USE_CL_DEVICE_FISSION) cl_int createSubDevices( const cl_device_partition_property_ext * properties, VECTOR_CLASS<Device>* devices) { typedef CL_API_ENTRY cl_int ( CL_API_CALL * PFN_clCreateSubDevicesEXT)( cl_device_id /*in_device*/, const cl_device_partition_property_ext * /* properties */, cl_uint /*num_entries*/, cl_device_id * /*out_devices*/, cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL; __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT); cl_uint n = 0; cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_SUB_DEVICES); } cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id)); err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_SUB_DEVICES); } devices->assign(&ids[0], &ids[n]); return CL_SUCCESS; } #endif };
Does anyone know about this? Should I take care of this? In the documentation for the C ++ shell, they do not even mention anything similar to releaseClMemObject or free (cl_devices), etc.
Thanks.