From a5d85bc7d1b3fc36c7a9c589be069606969a69ce Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Fri, 17 Aug 2018 15:04:56 -0500 Subject: [PATCH] Docs fixes/add missing pieces --- doc/index.rst | 1 + doc/misc.rst | 2 ++ pyopencl/__init__.py | 13 +++++++------ src/wrap_cl_part_1.cpp | 2 +- src/wrap_cl_part_2.cpp | 4 +++- src/wrap_constants.cpp | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index f771ab25..d715d1a2 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -108,6 +108,7 @@ Contents runtime_program runtime_gl array + types algorithm howto tools diff --git a/doc/misc.rst b/doc/misc.rst index 7459f89f..b4e30db7 100644 --- a/doc/misc.rst +++ b/doc/misc.rst @@ -121,6 +121,8 @@ checking `this file Note that the triple-quoted strings containing the source must start with `"""//CL// ..."""`. +.. _ipython-integration: + IPython integration ------------------- diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 793b62d6..042cb9da 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -1038,6 +1038,13 @@ def _add_functionality(): def memory_map_exit(self, exc_type, exc_val, exc_tb): self.release() + MemoryMap.__doc__ = """ + 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 + """ MemoryMap.__enter__ = memory_map_enter MemoryMap.__exit__ = memory_map_exit @@ -1082,12 +1089,6 @@ def _add_functionality(): if get_cl_header_version() >= (2, 0): SVMAllocation.__init__ = svmallocation_init - # FIXME - # SVMAllocation.enqueue_release.__doc__ = """ - # :returns: a :class:`pyopencl.Event` - - # |std-enqueue-blurb| - # """ # }}} diff --git a/src/wrap_cl_part_1.cpp b/src/wrap_cl_part_1.cpp index e102a560..cb44c6b9 100644 --- a/src/wrap_cl_part_1.cpp +++ b/src/wrap_cl_part_1.cpp @@ -194,7 +194,7 @@ void pyopencl_expose_part_1(py::module &m) "If the previous owner of the object will *not* release the reference, " "*retain* should be set to *False*, to effectively transfer ownership to " ":mod:`pyopencl`." - "\n\n.. versionadded:: 2013.2\n", + "\n\n.. versionadded:: 2013.2\n" "\n\n.. versionchanged:: 2016.1\n\n *retain* added.", py::arg("int_ptr_value"), py::arg("retain")=true) diff --git a/src/wrap_cl_part_2.cpp b/src/wrap_cl_part_2.cpp index 2e8e9e4c..0467ec18 100644 --- a/src/wrap_cl_part_2.cpp +++ b/src/wrap_cl_part_2.cpp @@ -245,7 +245,9 @@ void pyopencl_expose_part_2(py::module &m) py::class_<cls>(m, "SVMAllocation", py::dynamic_attr()) .def(py::init<std::shared_ptr<context>, size_t, cl_uint, cl_svm_mem_flags>()) .DEF_SIMPLE_METHOD(release) - .DEF_SIMPLE_METHOD(enqueue_release) + .def("enqueue_release", &cls::enqueue_release, + ":returns: a :class:`pyopencl.Event`\n\n" + "|std-enqueue-blurb|") .def("_ptr_as_int", &cls::ptr_as_int) .def(py::self == py::self) .def(py::self != py::self) diff --git a/src/wrap_constants.cpp b/src/wrap_constants.cpp index e585e117..7b6a97f1 100644 --- a/src/wrap_constants.cpp +++ b/src/wrap_constants.cpp @@ -797,6 +797,7 @@ void pyopencl_expose_constants(py::module &m) ADD_ATTR(KERNEL_ARG_, ADDRESS_QUALIFIER); ADD_ATTR(KERNEL_ARG_, ACCESS_QUALIFIER); ADD_ATTR(KERNEL_ARG_, TYPE_NAME); + ADD_ATTR(KERNEL_ARG_, TYPE_QUALIFIER); ADD_ATTR(KERNEL_ARG_, NAME); #endif } -- GitLab