Skip to content

Commit

Permalink
Improve docs on buffer/buffer obj ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Nov 14, 2014
1 parent aaf35ed commit d1c9724
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/runtime.rst
Expand Up @@ -386,6 +386,15 @@ Buffers

:class:`Buffer` inherits from :class:`MemoryObject`.

.. note::

Python also defines a type of `buffer object
<https://docs.python.org/3.4/c-api/buffer.html>`_,
and PyOpenCL interacts with those, too, as the host-side
target of :func:`enqueue_copy`. Make sure to always be
clear on whether a :class:`Buffer` or a Python buffer
object is needed.

Note that actual memory allocation in OpenCL may be deferred.
Buffers are attached to a :class:`Context` and are only
moved to a device once the buffer is used on that device.
Expand Down
9 changes: 9 additions & 0 deletions pyopencl/__init__.py
Expand Up @@ -954,6 +954,15 @@ def enqueue_copy(queue, dest, src, **kwargs):
:return: A :class:`NannyEvent` if the transfer involved a
host-side buffer, otherwise an :class:`Event`.
.. note::
Two types of 'buffer' occur in the arguments to this function,
:class:`Buffer` and 'host-side buffers'. The latter are
defined by Python and commonly called `buffer objects
<https://docs.python.org/3.4/c-api/buffer.html>`_.
Make sure to always be clear on whether a :class:`Buffer` or a
Python buffer object is needed.
.. ------------------------------------------------------------------------
.. rubric :: Transfer :class:`Buffer` ↔ host
.. ------------------------------------------------------------------------
Expand Down

0 comments on commit d1c9724

Please sign in to comment.