- cuquantum.custatevec.set_device_mem_handler(intptr_t handle, handler)¶
Set the device memory handler for cuTensorNet.
handlerobject can be passed in multiple ways:
int, it refers to the address of a fully initialized
handleris a Python sequence:
handleris a sequence of length 4, it is interpreted as
(ctx, device_alloc, device_free, name), where the first three elements are the pointer addresses (
int) of the corresponding members.
stras the name of the handler.
handleris a sequence of length 3, it is interpreted as
(malloc, free, name), where the first two objects are Python callables with the following calling convention:
ptr = malloc(size, stream)
free(ptr, size, stream)
with all arguments and return value (
ptr) being Python
nameis the same as above.
handleris a length-3 sequence will the GIL be held whenever a routine requires memory allocation and deallocation, so for all other cases be sure your
handlerdoes not manipulate any Python objects.
handle (intptr_t) – The library handle.
handler – The memory handler object, see above.