diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index cf56c2d3b48aacd76650f1c6b088d5f2c7456eee..2697fd4f7ee8ea1cc549080482872a26a9e4f3fd 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -37,14 +37,6 @@ def compiler_output(text): -class CLAllocator(DeferredAllocator): - def __init__(self, *args, **kwargs): - from warnings import warn - warn("pyopencl.CLAllocator is deprecated. " - "It will be continue to exist throughout the 2013.x " - "versions of PyOpenCL. Use {Deferred,Immediate}Allocator.", - DeprecationWarning, 2) - DeferredAllocator.__init__(self, *args, **kwargs) # {{{ Kernel diff --git a/pyopencl/array.py b/pyopencl/array.py index e4d4626437384633ed7d09f7c451cc2df9d6da3d..f3874c7d7238e059a5b64ddabca2be91b18a8587 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -191,14 +191,14 @@ def elwise_kernel_runner(kernel_getter): -class DefaultAllocator(cl.DeferredAllocator): +class DefaultAllocator(cl.tools.DeferredAllocator): def __init__(self, *args, **kwargs): from warnings import warn warn("pyopencl.array.DefaultAllocator is deprecated. " "It will be continue to exist throughout the 2013.x " "versions of PyOpenCL.", DeprecationWarning, 2) - cl.DeferredAllocator.__init__(self, *args, **kwargs) + cl.tools.DeferredAllocator.__init__(self, *args, **kwargs) # }}} diff --git a/pyopencl/tools.py b/pyopencl/tools.py index ee8560af65313d8ea6815e9864ce8f6017d27afd..22b782e61ef8b48ba989957f172b3cedc08bd12e 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -51,7 +51,19 @@ get_or_register_dtype("cdouble_t", np.complex128) bitlog2 = cl.bitlog2 PooledBuffer = cl.PooledBuffer -CLAllocator = cl.CLAllocator + +from pyopencl._cl import _tools_DeferredAllocator as DeferredAllocator +from pyopencl._cl import _tools_ImmediateAllocator as ImmediateAllocator + +class CLAllocator(DeferredAllocator): + def __init__(self, *args, **kwargs): + from warnings import warn + warn("pyopencl.tools.CLAllocator is deprecated. " + "It will be continue to exist throughout the 2013.x " + "versions of PyOpenCL. Use {Deferred,Immediate}Allocator.", + DeprecationWarning, 2) + DeferredAllocator.__init__(self, *args, **kwargs) + MemoryPool = cl.MemoryPool diff --git a/src/wrapper/wrap_mempool.cpp b/src/wrapper/wrap_mempool.cpp index 411f9d0bec01f0eccc09bde205d5d7e96c358717..4eb6bd8d194c84fb8b2da8f4331d918fb12cee85 100644 --- a/src/wrapper/wrap_mempool.cpp +++ b/src/wrapper/wrap_mempool.cpp @@ -237,7 +237,7 @@ void pyopencl_expose_mempool() { typedef cl_allocator_base cls; - py::class_<cls, boost::noncopyable> wrapper("AllocatorBase", py::no_init); + py::class_<cls, boost::noncopyable> wrapper("_tools_AllocatorBase", py::no_init); wrapper .def("__call__", allocator_call, py::return_value_policy<py::manage_new_object>()) @@ -247,7 +247,7 @@ void pyopencl_expose_mempool() { typedef cl_deferred_allocator cls; - py::class_<cls, py::bases<cl_allocator_base> > wrapper("DeferredAllocator", + py::class_<cls, py::bases<cl_allocator_base> > wrapper("_tools_DeferredAllocator", py::init< boost::shared_ptr<pyopencl::context> const &, py::optional<cl_mem_flags> >()); @@ -255,7 +255,7 @@ void pyopencl_expose_mempool() { typedef cl_immediate_allocator cls; - py::class_<cls, py::bases<cl_allocator_base> > wrapper("ImmediateAllocator", + py::class_<cls, py::bases<cl_allocator_base> > wrapper("_tools_ImmediateAllocator", py::init<pyopencl::command_queue &, py::optional<cl_mem_flags> >()); }