Skip to content

Commit

Permalink
Merge pull request #95 from lukepfister/master
Browse files Browse the repository at this point in the history
Add ability to get handle to CUDA Arrays
  • Loading branch information
inducer committed Nov 11, 2015
2 parents 88d143b + 2e0e998 commit 0a4afe0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/source/driver.rst
Expand Up @@ -1283,6 +1283,12 @@ Arrays and Textures
Return a :class:`ArrayDescriptor3D` object for this 3D array,
like the one that was used to create it. CUDA 2.0 and above only.

.. attribute:: handle

Return an :class:`int` representing the address in device memory where
this array resides.


.. class:: SurfaceReference()

.. note::
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/cuda.hpp
Expand Up @@ -1059,6 +1059,9 @@ namespace pycuda

CUarray handle() const
{ return m_array; }

intptr_t handle_int() const
{ return (intptr_t) m_array; }
};

// }}}
Expand Down
1 change: 1 addition & 0 deletions src/wrapper/wrap_cudadrv.cpp
Expand Up @@ -1429,6 +1429,7 @@ BOOST_PYTHON_MODULE(_driver)
.def(py::init<const CUDA_ARRAY3D_DESCRIPTOR &>())
.DEF_SIMPLE_METHOD(get_descriptor_3d)
#endif
.add_property("handle", &cl::handle_int)
;
}
// }}}
Expand Down

0 comments on commit 0a4afe0

Please sign in to comment.