From 99f60c44d6d6d13930ead4fea6f78b40120f77a1 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 18 Aug 2011 05:58:56 -0500 Subject: [PATCH] Add __call__ synonym to allocate to the memory pool. --- .gitignore | 1 + doc/source/tools.rst | 6 ++++++ src/wrapper/wrap_mempool.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 95946647..74bc5dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ temp* setuptools.pth distribute-*.tar.gz core +*.sess diff --git a/doc/source/tools.rst b/doc/source/tools.rst index feb65a7d..197e8289 100644 --- a/doc/source/tools.rst +++ b/doc/source/tools.rst @@ -56,6 +56,12 @@ the available memory. Return a :class:`PooledBuffer` of the given *size*. + .. method:: __call__(size) + + Synoynm for :meth:`allocate` to match :class:`CLAllocator` interface. + + .. versionadded: 2011.2 + .. method:: free_held Free all unused memory that the pool is currently holding. diff --git a/src/wrapper/wrap_mempool.cpp b/src/wrapper/wrap_mempool.cpp index a5f3fcc9..af9df05d 100644 --- a/src/wrapper/wrap_mempool.cpp +++ b/src/wrapper/wrap_mempool.cpp @@ -155,6 +155,8 @@ void pyopencl_expose_mempool() wrapper .def("allocate", device_pool_allocate, py::return_value_policy()) + .def("__call__", device_pool_allocate, + py::return_value_policy()) ; expose_memory_pool(wrapper); -- GitLab