Skip to content

Commit

Permalink
Documentation: .to_xp()
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed May 2, 2024
1 parent 8769017 commit be4ed52
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docs/source/usage/zerocopy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Python binding pyAMReX bridges the compute in AMReX block-structured codes a
As such, it includes zero-copy GPU data access for AI/ML, in situ analysis, application coupling by implementing :ref:`standardized data interfaces <developers-implementation>`.


CPU: numpy
CPU: NumPy
----------

zero-copy read and write access.
Expand All @@ -16,18 +16,30 @@ CPU as well as managed memory CPU/GPU.
Call ``.to_numpy()`` on data objects of pyAMReX.
See the optional arguments of this API.

Writing to the created numpy array will also modify the underlying AMReX memory.
Writing to the created NumPy array will also modify the underlying AMReX memory.


GPU: cupy
GPU: CuPy
---------

GPU zero-copy read and write access.

Call ``.to_cupy()`` on data objects of pyAMReX.
See the optional arguments of this API.

Writing to the created cupy array will also modify the underlying AMReX memory.
Writing to the created CuPy array will also modify the underlying AMReX memory.


CPU/GPU Agnostic Code: NumPy/CuPy
---------------------------------

The previous examples can be written in CPU/GPU agnostics manner.
Either using NumPy (``np``) or CuPy (``cp``), we provide a `common short-hand abbreviation <https://docs.cupy.dev/en/stable/user_guide/basic.html#how-to-write-cpu-gpu-agnostic-code>`__ named ``xp`` .

Call ``.to_xp()`` on data objects of pyAMReX.
See the optional arguments of this API.

Writing to the created NumPy/CuPy array will also modify the underlying AMReX memory.


GPU: numba
Expand Down

0 comments on commit be4ed52

Please sign in to comment.