CLRELEASEDEVICE(3clc)

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

✨ 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 β€” device is not a valid sub-device created by a call to clCreateSubDevices(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 Β© 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 πŸ’–

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