warp.fem.Temporary#

warp.fem.Temporary[source]#

Temporary array borrowed from a TemporaryStore.

The array will be automatically returned to the temporary pool for reuse upon destruction of this object, unless the temporary is explicitly detached from the pool using detach(). The temporary may also be explicitly returned to the pool before destruction using release().

Temporary is an alias of warp.array. Borrowed arrays use a custom deleter, and get the detach() and release() methods at borrow time.

Methods

assign(src)

Wrap src in an warp.array if it is not already one and copy the contents to self.

contiguous()

Return a contiguous array with this array's data.

cptr()

Return a ctypes cast of the array address.

fill_(value)

Set all array entries to value

flatten()

Return a zero-copy view of the array collapsed to 1-D.

ipc_handle()

Return an IPC handle of the array as a 64-byte bytes object

list()

Return a flattened list of items in the array as a Python list.

mark_init()

Reset this array's read flag.

mark_read()

Mark this array as having been read from in a kernel or recorded function on the tape.

mark_write(**kwargs)

Warn if this array is written to after it has been read from in a recorded launch.

numpy(*[, _suppress_bfloat16_warning])

Convert the array to a numpy.ndarray (aliasing memory through the array interface protocol) If the array is on the GPU, a synchronous device-to-host copy (on the CUDA default stream) will be automatically performed to ensure that any outstanding work is completed.

reshape(shape)

Return a reshaped array.

to(device[, requires_grad])

Return a Warp array with this array's data moved to the specified device, no-op if already on device.

transpose([axes])

Return a zero-copy view of the array with axes transposed.

view(dtype)

Return a zero-copy view of this array's memory with a different data type.

zero_()

Zero out the array entries.

Attributes

grad

Array that accumulates gradients for this array during the backward pass, or None.

memory_kind

Observed memory kind backing this array.

requires_grad

Whether gradients are tracked for this array.

retain_grad

Whether the backward pass preserves this array's gradient instead of zeroing it.

vars

alias of array