warp.set_mempool_release_threshold#

warp.set_mempool_release_threshold(device, threshold)[source]#

Set the CUDA memory pool release threshold on the device.

This is the amount of reserved memory to hold onto before trying to release memory back to the OS. When more than this amount of bytes is held by the memory pool, the allocator will try to release memory back to the OS on the next call to stream, event, or device synchronize.

Values between 0 and 1 are interpreted as fractions of available memory. For example, 0.5 means half of the device’s physical memory. Greater values are interpreted as an absolute number of bytes. For example, 1024**3 means one GiB of memory.

Parameters:
  • device (Device | str | None) – The Device or device identifier for which the operation is to be performed. If None, the default device will be used.

  • threshold (int | float) – An integer representing a number of bytes, or a float between 0 and 1, specifying the desired release threshold.

Raises:
  • ValueError – If device is not a CUDA device.

  • RuntimeError – If device is a CUDA device, but does not support memory pools.

  • RuntimeError – Failed to set the memory pool release threshold.

Return type:

None