Skip to content

Commit 0e1bb93

Browse files
Merge branch 'main' into ksimpson/add_program_options
2 parents f4b0f0a + 32fdd2d commit 0e1bb93

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
REPO_DIR=$(cygpath -w $PWD)
7777
fi
7878
79-
echo "PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
79+
echo "CUDA_BINDINGS_PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV
8080
CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}"
8181
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
8282
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
@@ -139,10 +139,10 @@ jobs:
139139
# CIBW mounts the host filesystem under /host
140140
CIBW_ENVIRONMENT_LINUX: >
141141
CUDA_PATH=/host/${{ env.CUDA_PATH }}
142-
PARALLEL_LEVEL=${{ env.PARALLEL_LEVEL }}
142+
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
143143
CIBW_ENVIRONMENT_WINDOWS: >
144144
CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})"
145-
PARALLEL_LEVEL=${{ env.PARALLEL_LEVEL }}
145+
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
146146
with:
147147
package-dir: ./cuda_bindings/
148148
output-dir: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}

cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4639,7 +4639,7 @@ cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long
46394639
err = m_global.lazyInitContextState()
46404640
if err != cudaSuccess:
46414641
return err
4642-
err = <cudaError_t>cydriver._cuGraphExecGetFlags(<cydriver.CUgraphExec>graphExec, flags)
4642+
err = <cudaError_t>cydriver._cuGraphExecGetFlags(<cydriver.CUgraphExec>graphExec, <cydriver.cuuint64_t *>flags)
46434643
if err != cudaSuccess:
46444644
_setLastError(err)
46454645
return err

cuda_bindings/docs/source/index.rst

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

1516

1617
Indices and tables
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)