You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We allow users to call .to_numpy(copy=False) on arbitrary memory.
This is fine even with pure GPU memory, to either:
transport pointers around w/o access from the host or
use as managed memory from the host (read/write)
For the situation that the pointer is in GPU memory and not managed, we should instead raise a runtime exception with the hint to use .to_numpy(copy=True), .to_cupy(copy=False) or activate managed memory.
These function can be quite expensive, so we should either use them sparsely or check alternatively the arenas if we know them.
These situations in AMReX can create this:
in default Arena and managed allowed
in explicit Managed Arena
in explicit device arena and managed allowed
Then Arena has
// isDeviceAccessible and isHostAccessible can both be true.
[[nodiscard]] virtualboolisDeviceAccessible () const;
[[nodiscard]] virtualboolisHostAccessible () const;
// Note that isManaged, isDevice and isPinned are mutually exclusive. // For memory allocated by cudaMalloc* etc., one of them returns true. // Otherwise, neither is true.
[[nodiscard]] virtualboolisManaged () const;
[[nodiscard]] virtualboolisDevice () const;
[[nodiscard]] virtualboolisPinned () const;
We allow users to call
.to_numpy(copy=False)
on arbitrary memory.This is fine even with pure GPU memory, to either:
For the situation that the pointer is in GPU memory and not managed, we should instead raise a runtime exception with the hint to use
.to_numpy(copy=True)
,.to_cupy(copy=False)
or activate managed memory.We can use
AMReX_GpuUtility.H
forisManaged
,isDevicePtr
,isPinnedPtr
helpers. It wrapscudaPointerGetAttributes
and, once later supported, similar functions for HIP and SYCL.https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__UNIFIED.html#group__CUDART__UNIFIED_1gd89830e17d399c064a2f3c3fa8bb4390
The text was updated successfully, but these errors were encountered: