Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update signature for ManagedAllocation.attach() and add documentation.
  • Loading branch information
seibert committed Feb 18, 2014
1 parent ef401e2 commit 7daaae2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion doc/source/driver.rst
Expand Up @@ -1119,7 +1119,7 @@ Managed Memory Allocation

Allocate a managed :class:`numpy.ndarray` of *shape*, *dtype* and *order*.

*mem_flags* may be one of the values in :class:`host_alloc_flags`.
*mem_flags* may be one of the values in :class:`mem_attach_flags`.

For the meaning of the other parameters, please refer to the :mod:`numpy`
documentation.
Expand Down Expand Up @@ -1170,6 +1170,17 @@ have an attribute *base* that references an object of type
this memory is mapped into the device's address space. For
managed memory, this is also the host pointer.

.. method:: attach(mem_flags, stream=None)

Alter the visibility of the managed allocation to be one of the values
in :class:`mem_attach_flags`. A managed array can be made visible to
the host CPU and the entire CUDA context with
*mem_attach_flags.GLOBAL*, or limited to the CPU only with
*mem_attach_flags.HOST*. If *mem_attach_flags.SINGLE* is selected,
then the array will only be visible to CPU and the provided instance
of :class:`Stream`.


Managed Memory Usage
~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/cuda.hpp
Expand Up @@ -1983,7 +1983,7 @@ namespace pycuda
return m_devptr;
}

void attach(py::object stream_py, unsigned flags)
void attach(unsigned flags, py::object stream_py)
{
PYCUDA_PARSE_STREAM_PY;

Expand Down
2 changes: 1 addition & 1 deletion src/wrapper/wrap_cudadrv.cpp
Expand Up @@ -1142,7 +1142,7 @@ BOOST_PYTHON_MODULE(_driver)
wrp
.DEF_SIMPLE_METHOD(get_device_pointer)
.def("attach", &cl::attach,
(py::arg("stream"), py::arg("mem_flags")))
(py::arg("mem_flags"), py::arg("stream")=py::object()))
;
}
#endif
Expand Down

0 comments on commit 7daaae2

Please sign in to comment.