warp.can_access#

warp.can_access(device, resource)[source]#

Return whether device can directly access resource.

In this release, resource must be a concrete Warp array. The query uses the resource’s observed memory kind where available, including CUDA managed, CUDA device, CUDA mempool, and pinned host memory, and returns False when access cannot be verified.

Parameters:
  • device (Device | str | None) – The device that needs to access resource.

  • resource – The resource to query. Concrete Warp array instances such as warp.array and warp.indexedarray are currently supported.

Returns:

True if Warp can verify that device can directly access resource, otherwise False.

Raises:

TypeError – If resource is not a concrete Warp array.

Return type:

bool