diff --git a/doc/runtime_memory.rst b/doc/runtime_memory.rst index f23a29ae4912173f1019b15fc53cc629fd78ab2f..94d7d1979695f3e6185f839f1f824fb6b6faec5c 100644 --- a/doc/runtime_memory.rst +++ b/doc/runtime_memory.rst @@ -321,6 +321,15 @@ Mapping Memory into Host Address Space .. versionchanged:: 2013.2 Added *strides* argument. + Sample usage:: + + mapped_buf = cl.enqueue_map_buffer(queue, buf, ...) + with mapped_buf.base: + # work with mapped_buf + ... + + # memory will be unmapped here + .. function:: enqueue_map_image(queue, buf, flags, origin, region, shape, dtype, order="C", strides=None, wait_for=None, is_blocking=True) |explain-waitfor| diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index b85400cb88ace1effff48580b69bc046358e9cfc..2851b02cae35d8592bba1ca6589cbac35ee488b4 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -941,10 +941,12 @@ class MemoryObject(MemoryObjectHolder): # {{{ MemoryMap class MemoryMap(_Common): - """" - .. automethod:: release - + """ This class may also be used as a context manager in a ``with`` statement. + The memory corresponding to this object will be unmapped when + this object is deleted or :meth:`release` is called. + + .. automethod:: release """ @classmethod