Skip to content

Commit 8f79ed0

Browse files
committed
move to use .rst for cross-ref; reword on pointer to/of
1 parent e0d3b8e commit 8f79ed0

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎cuda_bindings/docs/source/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
release.md
1212
environment_variables.md
1313
api.rst
14-
tips_and_tricks.md
14+
tips_and_tricks.rst
1515

1616

1717
Indices and tables

‎cuda_bindings/docs/source/tips_and_tricks.md‎

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Tips and Tricks
2+
---------------
3+
4+
Getting the address of underlying C objects from the low-level bindings
5+
=======================================================================
6+
7+
All CUDA C types are exposed to Python as Python classes. For example, the :class:`~cuda.bindings.driver.CUstream` type is exposed as a class with methods :meth:`~cuda.bindings.driver.CUstream.getPtr()` and :meth:`~cuda.bindings.driver.CUstream.__int__()` implemented.
8+
9+
There is an important distinction between the ``getPtr()`` method and the behaviour of ``__int__()``. If you need to get the pointer address *of* the underlying ``CUstream`` C object wrapped in the Python class, you can do so by calling ``int(instance_of_CUstream)``, which returns the address as a Python `int`, while calling ``instance_of_CUstream.getPtr()`` returns the pointer *to* the ``CUstream`` C object (that is, ``&CUstream``) as a Python `int`.

0 commit comments

Comments
 (0)