Skip to content

Commit

Permalink
Merge branch 'main' into doc_preview
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang authored Jan 16, 2025
2 parents 7d73e41 + 32fdd2d commit 77c24ba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
REPO_DIR=$(cygpath -w $PWD)
fi
echo "PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
echo "CUDA_BINDINGS_PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}"
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
# CIBW mounts the host filesystem under /host
CIBW_ENVIRONMENT_LINUX: >
CUDA_PATH=/host/${{ env.CUDA_PATH }}
PARALLEL_LEVEL=${{ env.PARALLEL_LEVEL }}
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
CIBW_ENVIRONMENT_WINDOWS: >
CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})"
PARALLEL_LEVEL=${{ env.PARALLEL_LEVEL }}
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
with:
package-dir: ./cuda_bindings/
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4639,7 +4639,7 @@ cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long
err = m_global.lazyInitContextState()
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphExecGetFlags(<cydriver.CUgraphExec>graphExec, flags)
err = <cudaError_t>cydriver._cuGraphExecGetFlags(<cydriver.CUgraphExec>graphExec, <cydriver.cuuint64_t *>flags)
if err != cudaSuccess:
_setLastError(err)
return err
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
release.md
environment_variables.md
api.rst
tips_and_tricks.rst


Indices and tables
Expand Down
9 changes: 9 additions & 0 deletions cuda_bindings/docs/source/tips_and_tricks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Tips and Tricks
---------------

Getting the address of underlying C objects from the low-level bindings
=======================================================================

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.

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 comments on commit 77c24ba

Please sign in to comment.