cuda.bindings._v2.driver.user_object_create#

cuda.bindings._v2.driver.user_object_create(
ptr,
intptr_t destroy,
unsigned int initial_refcount,
unsigned int flags,
) → intptr_t#

Create a user object.

Create a user object with the specified destructor callback and initial reference count. The initial references are owned by the caller. Destructor callbacks cannot make CUDA API calls and should avoid blocking behavior, as they are executed by a shared internal thread. Another thread may be signaled to perform such actions, if it does not block forward progress of tasks scheduled through CUDA. See CUDA User Objects in the CUDA C++ Programming Guide for more information on user objects.

Parameters:
  • ptr (bytes) – The pointer to pass to the destroy function.

  • destroy (intptr_t) – Callback to free the user object when it is no longer in use.

  • initial_refcount (unsigned int) – The initial refcount to create the object with, typically 1. The initial references are owned by the calling thread.

  • flags (unsigned int) – Currently it is required to pass CU_USER_OBJECT_NO_DESTRUCTOR_SYNC, which is the only defined flag. This indicates that the destroy callback cannot be waited on by any CUDA API. Users requiring synchronization of the callback should signal its completion manually.

Returns:

Location to return the user object handle.

Return type:

intptr_t

See also

cuUserObjectCreate