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 is allocation-aware for built-in Warp allocators and returns False for cross-device allocations whose access rules 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