warp.ScopedMempool#

class warp.ScopedMempool(device, enable)[source]#

Context manager to temporarily enable or disable memory pool allocators.

On context exit, the original mempool setting is restored.

Parameters:
  • device (DeviceLike) – The device on which to modify the mempool setting.

  • enable (bool) – Whether to enable (True) or disable (False) the mempool.

Example

with wp.ScopedMempool(device, enable=True):
    # Memory allocations here use the memory pool
    arr = wp.zeros(1000, dtype=wp.float32, device=device)
__init__(device, enable)[source]#
Parameters:

Methods

__init__(device, enable)