CLRELEASEDEVICE(3clc)
β¨ CLRELEASEDEVICE(3clc) β¨
okay bestie, we're in the OpenCL Manual today and this one is a whole mood: it's the lil function that says "you can let go now π " to a sub-device.
πΈ NAME πΈ
clReleaseDevice β decrements the device reference count. that's it, that's the whole job, and honestly? iconic for it.
cl_int clReleaseDevice(cl_device_id device);
π«Ά NOTES π«Ά
so here's the tea β β if device is a valid sub-device that came from a call to clCreateSubDevices(3clc), the device reference count goes down by one. bye bestie π
but plot twist: if device is a root level device β like, a cl_device_id that clGetDeviceIDs(3clc) handed you β then the device reference count stays exactly the same. nothing happens. no cap. it's giving "you can't fire me, I quit" energy. π
and once the device reference count hits zero, and all the objects attached to device (command-queues and friends, you know the type π) are released too, then the device object itself gets deleted. gone. poof. β¨
π ERRORS π
returns CL_SUCCESS if the function executed successfully, slay. otherwise it hands you one of these lil guys:
CL_INVALID_DEVICEβdeviceis not a valid sub-device created by a call toclCreateSubDevices(3clc). yeah. rude. πCL_OUT_OF_RESOURCESβ there was a failure to allocate resources required by the OpenCL implementation on the device. πCL_OUT_OF_HOST_MEMORYβ there was a failure to allocate resources required by the OpenCL implementation on the host. also π
π SPECIFICATION π
OpenCL Specification[1] β the source of truth, the blueprint, the moment π
β SEE ALSO β
(the friend group π« β retain and release are literally the duo of the century)
π AUTHORS π
The Khronos Group
π 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 following condition:
the condition being that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. periodt. π
π NOTES π
- OpenCL Specification β page 52, section 4.3 - Partitioning a Device π
okay that's the whole page, we ate and left no crumbs π
sign-off time: this was brought to you by The Khronos Group, dated 01/14/2021, for the page CLRELEASEDEVICE(3clc) β go release your sub-devices responsibly, 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